Excel 2013

 Copy code hover
[image]

Excel 2013
Send feedback

Published: July 16, 2012

Excel product logo The following resources will help you quickly get started developing for Excel 2013. You will find in-depth articles, how-to topics, and other resources—from core development concepts to advanced programming techniques―to help you create powerful business and financial solutions.

Explore Excel 2013 developer resources

New features and scenarios

New features

What's new for Excel 2013 developers

Get started

Get started

Getting Started with VBA in Excel

References

Reference

Excel 2013 Developer Reference

Visual Basic for Applications

Learn how to develop VBA for Excel.

Get started

Excel 2013 developer reference
Make a Macro Do Simple Tasks
Using the Vlookup Function in Excel
Editing Data in an Excel 2007 Open XML File with VBA
Working with Lists and Tables in Excel: VBA Samples
Show the Developer Tab
What is a Macro and Why You Should Care
Create or Delete a Macro
Working with Excel 4.0 Macros

Top APIs

Range object
Range members
Workbook object
Workbook members
Application object
Application members
Worksheet object
Worksheet members
Sheets object
Sheets members

Top articles

Using the Solver VBA Functions
Excel 2010 Object Model Changes Since Earlier Versions
New Objects, Collections, and Enumerations
Microsoft Graph Visual Basic Reference Overview
Language-Specific Properties, Methods, and Functions
New Members and Constants
Sending Email to a List of Recipients Using Excel and Outlook
OLE DB for OLAP Properties Used by Excel
Looping Through a Range of Cells
Formatting and VBA Codes for Headers and Footers

Code samples and downloads

Get a jump-start on developing with these sample apps and code walkthroughs.

Downloads

Excel 2010 XLL SDK
Office Fluent User Interface XML Schema

CodePlex

Excel Data Reader - Read Excel File in .NET
ExcelPackage: Office Open XML Format File Creation
ExtremeML
Import Excel Data to SharePoint List
NPOI
OLAP PivotTable Extensions
PHPExcel

Developer code samples

More Excel code samples
101 VBA samples for Office 2010
COM Access to Excel Web Services
Excel Exporter
Excel Financial Functions for .NET
ExcelUtility
Generating Excel Document Templates from Data
Managed Excel Automation Add-in UDFs
Microsoft Solver Foundation - Express Edition
Open XML Converter Interface Sample Code
Reading an Excel Spreadsheet Using ADO.NET
Using Cell Text to Filter a PivotTable

Excel Services

Learn how to load, calculate, and display Excel workbooks on SharePoint.

Developer resources

Excel Services Overview
Excel Services Best Practices

Visual How Tos

Retrieving an Entire Workbook or a Snapshot of a Workbook in Excel Services
Developing Custom Applications by Using Excel Web Services in SharePoint Server
Creating Managed-Code UDFs for Excel Services
Adding Excel Web Parts to Pages Programmatically in SharePoint Server
More Excel Visual How Tos

More Excel Services content

An Introduction to Excel Services
Building Custom Solutions
Excel Services Technical Overview
Ten Tips for Using SharePoint Server with Excel Services
Extending the Excel Services Programmability Framework
Overview of Excel Services Architecture
Administer Excel Services in SharePoint Server 2013
Developing BI Applications: What is Business Intelligence?
Interacting with the Excel Web Services API for SharePoint Server
How to: Programmatically Add an Excel Web Access Web Part to a Page

Find training and other resources about Office

Download

Office developer downloads

How To

Build apps for Office
Office SDKs
Office developer training
Open specifications

Sites

Excel Developer Center
Office developers
Office 365 developers

Help

Office developer support

© 2013 Microsoft Corporation. All rights reserved.


What's new for Excel 2013 developers

 Copy code hover
[image]

What's new for Excel 2013 developers
Send feedback

Published: July 16, 2012

This document provides a top-level view of the enhancements and additions for developers in Microsoft Excel 2013. It also provides links to other articles and references that will enable you to get started programming Excel 2013.

Updated: March 2013

In this article
Introduction
Apps for Office in Excel
New Worksheet functions
Quick Analysis
Availability of new data sources
Using the DataModel OM
Creating PivotCharts and PivotTables independently
Single Document Interface
Turning animations on and off programmatically
Timeline
Protecting sheets takes longer
Conclusion
Additional resources

Introduction

If you develop custom workbook solutions, you can use the following programmability and feature improvements in Microsoft Excel 2013

Apps for Office in Excel

Microsoft Excel 2013 brings the web to Excel. New apps for Office offer a wealth of interesting, new scenarios and solutions in an easy-to-use environment for dynamic web application development. You now can use popular dynamic languages (such as Python, PHP, Perl, and JavaScript) and web development tools (such as Microsoft Visual Studio 2012) for application development. Web development also enables you to use the strong global developer communities and the availability of various code samples, frameworks and libraries, which broaden application applicability for different scenarios. You can create two kinds of apps for Office in Excel, Content apps and Task pane apps.

Content apps for Office integrate web-based features as content that can be shown in line with the document. Content apps for Office let you integrate rich, web-based data visualizations; embedded media scenarios, such as integrating a YouTube video player or a picture gallery; as well as other external content capabilities. Figure 1 shows one implementation of a content app in Excel 2013.

Figure 1. Content app in Excel 2013

Content app in Excel 2013

Task pane apps for Office work side-by-side with an Office document, and let app for Office developers supply contextual information and functionality to enhance the document viewing and authoring experience. For example, a task pane app for Office can look up and retrieve product information from a web service based on the product name or part number the users selects in the document.

Figure 2. Task pane app in Excel 2013

New Worksheet functions

Microsoft Excel 2013 adds about 50 new worksheet functions for compatibility with the Open Document Format (ODF 1.2).

And you can now use web service functions (in the Web functions category) to anonymously access REST Web services. Of special note is the FILTERXML function, which lets you use XPath expressions to filter the XML returned by a WEBSERVICE function call.

Quick Analysis

Quick Analysis, as shown in Figure 3, is a new contextual UI tool that enables single-click access to data-analysis features, such as formulas, conditional formatting, Sparklines, tables, charts, and PivotTables. You can enable and disable the display of the new Quick Analysis feature in Excel 2013 programmatically by using the Show and Hide methods of the QuickAnalysis object.

Figure 3. Quick Analysis tool

Availability of new data sources

You can connect to a set of new data sources supported by PowerPivot, including OData feeds, Azure, SharePoint Data Feeds, and additional OLE DB providers. The new DataFeedConnection, ModelConnection, TextConnection, and WorksheetDataConnection objects contain data and functionality needed to connect to new data sources.

Note Note

Documentation for new objects and members in Excel 2013 is not yet complete.

Using the DataModel OM

A new DataModel object model (an addition to the existing Visual Basic for Applications object model) enables you to load and refresh data sources programmatically. This extension to the PowerPivot model introduced in Excel 2010 lets you integrate additional data sources and the ability to combined data from multiple data sources programmatically. Important new objects in this model include the Model, ModelChanges, ModelRelationship, and ModelTable objects.

Creating PivotCharts and PivotTables independently

You can use the decoupling of PivotCharts from PivotTables in Excel 2013. PivotCharts and PivotTables based on an OLAP or PowerPivot data source can be decoupled such that you can create a PivotChart independently of any PivotTable, and you can navigate through data by using a PivotChart-only experience. This is in contrast to the current paradigm where a PivotChart is created as a companion to a PivotTable. This decoupling is represented in both the Excel 2013 Client and Microsoft Excel Services.

Single Document Interface

The change to a single-document interface (SDI) in Excel 2013 has implications for programmability. SDI means that each workbook will have its own top-level app window and will have its own corresponding ribbon. All existing application-level window methods, events, and properties are unaffected by this change. All existing workbook-level window methods, events, and properties now operate on the top-level window for that workbook.

Turning animations on and off programmatically

You can use the new EnableMacroAnimations property on the Application object to toggle the display of animations. Animations are disabled by default during macro execution. To enable animation, add Application.EnableMacroAnimations = True at the start of the macro. To allow Excel to show animations during macro execution, make this setting for each macro.

Timeline

Excel 2013 includes a new Timeline control for filtering modeled data. Timeline offers a visual way to view and change a contiguous range of dates and filter pivot-based objects, such as PivotTables and PivotCharts. Timelines are related to slicers and extend existing slicer-related object model members. In addition, two new Timeline-specific objects are introduced: the TimelineState and TimelineViewState objects.

Protecting sheets takes longer

Protecting sheets takes much longer than in previous Excel versions. It's not noticeable when you're manually protecting a sheet, but if you have code that protects or unprotects sheets repeatedly, it can become a performance issue.

The delay is caused by increased security in Excel 2013 for password-protected files, because it uses a stronger hashing algorithm (SHA-512). In Office 2010, the default hashing algorithm for password protected files is SHA1. This change makes Excel password protected workbooks more secure than they were in previous versions, but can cause a performance issue for some Office Developers. This is by design, so there is no workaround.

Conclusion

Excel 2013 provides a wealth of new features for developers. Apps for Office provide an exciting opportunity for developers to integrate web-based features into Excel 2013, either as content that can be shown in line with the worksheet, or side-by-side with the worksheet. Other new features that extend the existing Excel 2013 VBA object model include Quick Analysis, the Timeline, a new DataModel OM, the availability of new data sources, and the ability to create PivotCharts and PivotTables independently of each other. In addition, there are new worksheet functions and the ability to use Web service functions to anonymously access REST web services.

Additional resources

  • Excel 2013 Developer Reference

  • Build apps for Office

  • What's New for Office 2013 Developers


Welcome to the Excel 2013 developer reference

 Copy code hover
[image]

Welcome to the Excel 2013 developer reference
See also Send feedback

Published: July 16, 2012

Welcome to the Excel 2013 Developer Reference. This reference contains conceptual overviews, programming tasks, samples, and references to help you develop Excel solutions.

We welcome your comments or questions about this content: docthis@microsoft.com

Publish date of this reference: October 2012

This documentation contains the following sections:

  • What's New for Developers in Excel 2013: Provides a list of new members by object and in alphabetical order.

  • How Do I... in Excel: Provides a map of how-to topics for developing custom Excel solutions.

  • Concepts: Provides important concepts for developing custom Excel solutions.

  • Reference: Provides reference materials for the Excel object model.

  • Microsoft Graph Visual Basic Reference: Provides reference information about the collections, objects, methods, properties, and enumerations in the Microsoft Graph object model.

See also

Concepts

Office 2013 documentation copyright notice

Other resources

Excel Developer Center
Accessibility in Microsoft Products
Document Conventions
Microsoft Online Privacy Notice


Concepts (Excel 2013 developer reference)

 Copy code hover
[image]

Concepts (Excel 2013 developer reference)
Send feedback

Published: July 16, 2012

This section provides important concepts for developing custom Excel solutions. You can use the table of contents to navigate through the topics.


About the PowerPivot Model Object in Excel 2013

 Copy code hover
[image]

About the PowerPivot Model Object in Excel 2013
Send feedback

Learn about the PowerPivot add-in model and its object model in Microsoft Excel 2013.

Applies to: Excel 2013

In this article
About the PowerPivot Model Object
Relationships defined
Single Models Only
Working with OLAP data sources
Triggering the creation of a PowerPivot Model
Undoing the creation of a PowerPivot Model
The PowerPivot Model Object Model
Conclusion
Additional Resources

About the PowerPivot Model Object

The PowerPivot add-in enables you to visually build your own cubes. A data cube is an array of data defined in dimensions or layers. The Model object in Excel 2010 implemented by the PowerPivot add-in provides the foundation to load and combine source data from several data sources for data analysis on the desktop, including relational databases, multidimensional sources, cloud services, data feeds, Excel files, text files, and data from the Web. Microsoft Excel 2013 integrates additional data sources and enables the ability to combine data from multiple data sources.

The creation and deletion of the PowerPivot Model (PPM) is triggered by user exposed actions and cannot be created directly by the developer.

Relationships defined

Throughout this article, we will refer to the connection between two tables that establishes how the data should be correlated as relationships.

Relationships join together data from previously unrelated data sources. Each relationship has a Primary Key and a Foreign Key. Relationships allow the data to be joined together into a single model. This allows for:

  • Filtering data in one table by data in a related table - Filtering data by related columns

  • Integrating columns from multiple tables into a PivotTable/PivotChart

  • Keeping workbooks smaller by not having to repeat data

Single Models Only

Excel 2013 with the PowerPivot add-in creates a single model in the workbook to which it can add data sources, create, modify, and relate tables. There can only be a single model in a workbook.

Working with OLAP data sources

When connecting to an OLAP data source such as Analysis Services and creating OLAP PivotTables, Pivot Charts, Slicers or Cube functions, no model is created. Workbooks created with the PowerPivot add-in can be uploaded to SharePoint, loaded in memory on the server, and accessed by other workbooks as if it were a normal instance of SQL Server Analysis Services.

Triggering the creation of a PowerPivot Model

By default, XLSX files in Excel 2010 and Excel 2013 do not have a PPM initialized in them until the model is deemed necessary. Certain actions trigger the creation of a PPM if there is no existing model in the workbook. The following sections describe the actions that will trigger the creation of a PPM when it does not exist in the workbook.

Adding a new non-legacy data source

Any time you import certain types of data, a new model is created in the workbook (if one does not already exist) that contains the connection properties, table representation of the workbook data sources, and the relationships between them. This includes internal data sources like ranges and tables. Table 1 lists the different data sources that can be integrated with the PPM.

Table 1. Data sources compatible with the PowerPivot Model

Data Source | Description | Table Preview | Query Supported
Microsoft SQL Server | Already supported in Excel | Yes | Yes
Microsoft SQL Azure Data Market | Supported as a new data feed data source | Yes | No
Microsoft SQL Server Parallel Data Warehouse | Supported via installed OLE DB driver | Yes | Yes
Microsoft Access | Already supported in Excel | Yes | Yes
Oracle | Already supported in Excel | Yes | Yes
Teradata | Available if OLE DB or ODBC driver is installed | No | No
Sybase | Available if OLE DB or ODBC driver is installed | No | No
Informix | Available if OLE DB or ODBC driver is installed | No | No
IBM Db2 | Available if OLE DB or ODBC driver is installed | No | No
Microsoft Analysis Services | Already supported in Excel | Yes | Yes
Report (SSRS) | Can read and use connections, but no authoring in Excel 2013 client | Yes | No
Text | From Excel dialog in Ribbon UI | Yes | No
Data Feeds (OData) | Supported as a new data source | Yes | Yes
XML | Already supported in Excel | No | No
SharePoint Lists | Already supported in Excel. Excel 2013 uses the DataFeed provider to connect to SharePoint | No | No
SharePoint | New feature in Excel 2013 | Yes | Yes
Excel Tables | User defined table in Excel used for new data feature. A Worksheet data connection is created to the table when the table is created. | N/A | N/A
Excel Ranges | User defined range in Excel used for new data feature. A Worksheet data connection in this case is created to the range only if a data feature like a chart or PivotTable uses the range. | N/A | N/A

Creating a new Excel 2013 non-OLAP PivotTable

New Excel 2013 PivotTables, other than the ones created from an OLAP data source, will be based on a PPM therefore if a PPM is not present in the file a new one is created as part of the PivotTable creation action. This includes the following:

  • Using the insert PivotTable user interface

  • Summarizing data with PivotTable user interface

  • PivotTable based off of a non-OLAP data source created through the Microsoft Visual Basic for Applications (VBA) object model

Creating a new Excel 2013 non-OLAP PivotChart

In Excel 2013, PivotTables and Pivot Charts have the ability to be no longer coupled. Therefore on insertion of a PivotChart in a workbook without a model, a PPM will be created.

Pasting Excel 2013 non-OLAP PivotTables from another workbook

When pasting a PivotTable or PivotChart from another workbook that is based off of a PPM into one that does not have a PPM, a new PPM will be created in the destination workbook. A new data source will be added to the newly created model pointing to the underlying data of the originating PivotTable/PivotChart.

Undoing the creation of a PowerPivot Model

All actions that lead to the creation of a PPM can be undone. If these actions are selected from the undo menu, the actual model creation will not be undone but nothing will be added to it; therefore it will remain empty. When the workbook is saved, if the model is empty, the model will not be saved with the file. There is no explicit way for you to manually delete a model created in the workbook.

Note Note

Similar to the behavior in Excel 2010, there is a restriction in what model sizes can be undone. When a model grows to this limit size undo functionality for actions such as refresh will no longer be provided. The current limit for native PivotTables is 300,000 rows, at 28 bytes a cell this limit is roughly 8MB in memory. These values can be set by using Advanced Options in Excel 2013 as shown in Figure 1.
Figure 1. Set the size for large Data Model undo operations

Set size of Data Model undo operations

The PowerPivot Model Object Model

A workbook will be able to have one and only one Model object. The Model object represents the top level object that contains all its connections, relationships, and tables.

You are not able to manually create a model in a workbook; creation of the model is triggered through the actions described in a previous section in this article. If any of these actions are performed through the Object Model (OM), a new model is created. The purpose of this OM is for the programmatic creation of relationships between model tables resulting in joined tables, combining PivotTables, and so forth. For you to be able to this, you must be able to explore the model to find the appropriate tables and within the tables find the appropriate columns that would be used to create the relationship.

Model Object

The Model object stores references to workbook connections and information about the tables and relationships contained within the PPM. Table 2 lists the properties of the Model object.

Table 2. Properties of the Model object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified Model object.
ModelTables | Read-only | ModelTable | Collection of tables inside the PPM.
ModelRelationships | Read-only | ModelRelationships | Collection of relationships between PPM tables.
DataModelConnection | N/A | WorkbookConnection | Returns the model workbook connection object from the workbook connections collection which connects to the model.

Model.AddConnection Method

Adds a new workbook connection to the model with the same properties as the one supplied as an argument. This method only works on non-model external connections and will return an error if called with an external model connection as its argument. When calling this method, a new model connection is created and it is named the same as the legacy connection with an integer at the end to make the name unique. Table 3 lists the parameters of the AddConnection method.

Table 3. Parameters of the Model.AddConnection method

Name | Required/Optional | Type | Description
ConnectionToDataSource | Required | WorkbookConnection | The Workbook connection

Model.CreateModelWorkbookConnection Method

Calling this method returns a WorkbookConnection object of type ModelConnection. A model connection connected to the specified table is returned. This type of connection can only be used by query tables in Excel 2013. Table 4 lists the parameters of the CreateModelWorkbookConnection method.

Table 4. Parameters of the Model.CreateModelWorkbookConnection method

Name | Required/Optional | Type | Description
ModelTable | Required | Variant | Either a model table name or a model table object.

Model.Initialize Method

The Initialize method of the Model object has no parameters. Initializes the PPM. This is called by default the first time the model is used.

Model.Refresh Method

The Refresh method of the Model object has no parameters. Refreshes all data sources associated with the model, fully reprocesses the model and updates all Excel data features associated with the Model object.

ModelChanges Object

Represents changes made to the PPM. The ModelChanges object contains information about which changes were made to the data model when the Workbook.ModelChange event occurs after a model operation. When Excel makes changes to the data model, multiple changes can be made in the same operation and the ModelChanges object will include information about all the changes made in one model operation. Table 5 lists the properties of the ModelChanges object.

Table 5. Properties of the ModelChanges object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
ColumnsAdded | Read-only | ModelColumnNames | Returns a ModelColumnNames collection of ModelColumnName objects which represent all columns added as part of a model operation.
ColumnsChanged | Read-only | ModelColumnChanges | Returns a ModelColumnChanges collection of ModelColumnChange objects which represent table names and column names of all table columns for which the data type was changed as part of a model operation.
ColumnsDeleted | Read-only | ModelColumnNames | Returns a ModelColumnNames collection of ModelColumnName objects which represent all columns which were deleted as part of a model operation.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
MeasuresAdded | Read-only | ModelMeasureNames | Returns a ModelMeasureNames collection of ModelMeasureName objects which represent all measures which were added as part of a model operation.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelChanges object.
RelationshipChange | Read-only | Boolean | When True, one or more relationships in the model were changed (added, deleted or modified) as part of a model operation. When False, no relationships were changed during the operation.
TableNamesChanged | Read-only | ModelTableNameChanges | Returns a ModelTableNameChanges collection of ModelTableNameChange objects that represents old and new names of all tables which were renamed in the model as part of a model operation.
TablesAdded | Read-only | ModelTableNames | Returns a ModelTableNames collection of table names as strings that represents all tables which were added to the model as part of a model operation.
TablesDeleted | Read-only | ModelTableNames | Returns a ModelTableNames collection of table names as strings that represents all tables which were deleted from the model as part of a model operation.
TablesModified | Read-only | ModelTableNames | Returns a ModelTableNames collection of table names as strings that represents all tables which were refreshed or recalculated as part of a model operation.
UnknownChange | Read-only | Boolean | True when a non-specified change was made to the model as part of a model transaction.

ModelColumnChanges Collection

A collection of ModelColumnChange objects that represent columns for which the data type was change in the PPM. Table 6 lists the properties of the ModelColumnChanges collection.

Table 6. Properties of the ModelColumnChanges collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelColumnChange objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelColumnChanges object.

ModelColumnChanges.Item Method

Returns a single object from the ModelColumnChanges collection. Table 7 lists the parameters of the Item method.

Table 7. Parameters of the ModelColumnChanges.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelColumnChange Object

An object that represents a column in a table in the PPM for which the data type was changed. Table 8 lists the properties of the ModelColumnChange object.

Table 8. Properties of the ModelColumnChange object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
ColumnName | Read-only | String | String that represents the name of a column for which the data type was changed.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelColumnChange object.
TableName | Read-only | String | String that represents the name of a table in the PPM for which the data type of a column was changed.

ModelColumnNames Collection

A collection of ModelColumnName objects that represents columns of tables in the PPM. Table 9 lists the properties of the ModelColumnNames collection.

Table 9. Properties of the ModelColumnNames collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelColumnName objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelColumnNames collection.

ModelColumnNames.Item Method

Returns a single object from the ModelColumnNames collection. Table 10 lists the parameters of the Item method

Table 10. Parameters of the ModelColumnNames.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelColumnName Object

An object that represents the name of a column in the PPM. Table 11 lists the properties of the ModelColumnName object.

Table 11. Properties of the ModelColumnName object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
ColumnName | Read-only | String | String that represents the name of a column of the table identified by the TableName property.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelColumnName object.
TableName | Read-only | String | String that represents the name of a table in the PPM.

ModelConnection Object

The ModelConnection object will contain information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated PPM. Table 12 lists the properties of the ModelConnection object.

Table 12. Properties of the ModelConnection object

Property | Read/Write | Type | Description
ADOConnection | Read-only | ADOConnection | Used to create an open connection to a data source. Enables add-ins, such as the PowerViewer, to create a direct connection to the engine and hence the data model.
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
CommandText | Read/Write | Variant | Returns or sets the command string for the specified data source (table).
CommandType | Read/Write | xlCmdType | Returns or sets one of the xlCmdType constants specifying the command type.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelConnection object.

ModelMeasureNames Collection

The ModelMeasureNames collection contains a collection of ModelMeasureName objects in the PPM. Table 13 lists the properties of the ModelMeasureNames collection.

Table 13. Properties of the ModelMeasureNames collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelMeasureName objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelMeasureNames collection.

ModelMeasureNames.Item Method

Returns a single object from the ModelMeasureNames collection. Table 14 list the parameters of the Item method.

Table 14. Parameters of the ModelMeasureNames.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelMeasureName Object

An object that represents the name of a measure in the PPM. Table 15 lists the properties of the ModelMeasureName object.

Table 15. Properties of the ModelMeasureName object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
MeasureName | Read-only | String | String that represents the new name a measure which was added to the ModelTable object identified by the TableName property.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelMeasureName object.
TableName | Read-only | String | String that represents the name of a table in the PPM.

ModelRelationships Collection

The ModelRelationships collection contains a collection of ModelRelationship objects in the PPM. Table 16 lists the properties of the ModelRelationships collection.

Table 16. Properties of the ModelRelationships collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelRelationship objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelRelationships collection.

ModelRelationships.Add Method

Adds a relationship to the ModelRelationships collection. Table 17 lists the parameters of the Add method.

Table 17. Parameters of the ModelRelationships.Add method

Name | Required/Optional | Type | Description
ForeignKeyColumn | Required | ModelTableColumn | A ModelTableColumn object that represents the foreign key column in the table on the many side of the one-to-many relationship.
PrimaryKeyColumn | Required | ModelTableColumn | A ModelTableColumn object that represents the primary key column in the table on the one side of the one-to-many relationship.

ModelRelationships.Item Method

Returns a single object from the ModelRelationships collection. Table 18 lists the parameters of the Item method.

Table 18. Parameters of the ModelRelationships.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelRelationship Object

Represent a relationship between ModelTableColumn objects. Used when programmatically creating relationships. Table 19 lists the properties of the ModelRelationship object.

Table 19. Properties of the ModelRelationship object

Property | Read/Write | Type | Description
Active | Read/Write | Boolean | When True, the relationship is active.
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
ForeignKeyColumn | Read-only | ModelTableColumn | Contains the ModelTableColumn object that represents the foreign key column on the many side of the one-to-many relationship.
ForeignKeyTable | Read-only | ModelTable | Contains the ModelTable object that represents the table on the many side of the one-to-many relationship.
Parent | Read-only | Object | Returns an Object model object that represents the model the ModelRelationship object resides in.
PrimaryKeyColumn | Read-only | ModelTableColumn | Contains the ModelTableColumn object that represents the primary key column in the table on the one side of the one-to-many relationship.
PrimaryKeyTable | Read-only | ModelTable | Contains the ModelTable object that represents the table on the one side of the one-to-many relationship.

ModelRelationship.Delete Method

The Delete method of the ModelRelationship object has no parameters. Deletes a relationship.

ModelTables Collection

The ModelTables collection contains a collection of ModelTable objects in the PPM. Table 20 lists the properties of the ModelTables collection.

Table 20. Properties of the ModelTables collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelTable objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelTables collection.

ModelTables.Item Method

Returns a single object from the ModelTables collection. Table 21 lists the parameters of the Item method.

Table 21. Parameters of the ModelTables.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelTable Object

Represent a table in the Model object. The ModelTable object is read only which means it cannot be created or edited through the object model. There is a ModelTable object for every table in the model. Table 22 lists the properties of the ModelTable object.

Table 22. Properties of the ModelTable object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
ModelTableColumns | Read-only | ModelTableColumns | Collection of ModelTableColumn objects that make up the ModelTable object.
Name | Read-only | String | Returns the name of the ModelTable object.
Parent | Read-only | Object | Returns an Object that represents the model the ModelTable object resides in.
RecordCount | Read-only | Integer | Returns the total row count for the ModelTable object.
SourceName | Read-only | String | Name of table at the data source. If table has no data source (created in the model), the property will return an error.
SourceWorkbookConnection | Read-only | WorkbookConnection | Returns the workbook connection from which the ModelTable object originated.

ModelTable.Refresh Method

The Refresh method of the ModelTable object has no parameters. Refreshes the model table source connections.

ModelTableColumns Collection

The ModelTableColumns collection contains a collection of ModelTableColumn objects in the PPM. Table 23 lists the properties of the ModelTableColumns collection.

Table 23. Properties of the ModelTableColumns collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelTableColumn objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelTableColumns collection.

ModelTableColumns.Item Method

Returns a single object from the ModelTableColumns collection. Table 24 lists the parameters of the Item method.

Table 24. Parameters of the ModelTableColumns.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelTableColumn Object

Represent a single column in the ModelTable object. Used when programmatically creating relationships. Table 25 lists the properties of the ModelTableColumn object.

Table 25. Properties of the ModelTableColumn object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
DataType | Read-only | XlParameterDataType | Returns the data type of the column.
Name | Read-only | String | Returns the name of the ModelTableColumn object.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelTableColumn object.

ModelTableNames Collection

The ModelTableNames collection contains a collection of ModelTableName objects in the PPM. Table 26 lists the properties of the ModelTableNames collection.

Table 26. Properties of the ModelTableNames collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelTableName objects in the collection
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelTableNames object.

ModelTableNames.Item Method

Returns a single object from the ModelTableNames collection. Table 27 lists the parameters of the Item method.

Table 27. Parameters of the ModelTableNames.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelTableNameChanges Collection

The ModelTableNameChanges collection contains a collection of ModelTableNameChange objects in the PPM. Table 28 lists the properties of the ModelTableNameChanges collection.

Table 28. Properties of the ModelTableNameChanges collection

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Count | Read-only | Long | Returns number of ModelTableNameChange objects in the collection.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the parent object of the specified ModelTableNameChanges collection.

ModelTableNameChanges.Item Method

Returns a single object from the ModelTableNameChanges collection. Table 29 lists the parameters of the Item method.

Table 29. Parameters of the ModelTableNameChanges.Item method

Name | Required/Optional | Type | Description
Index | Required | Variant | The index number or name of the object.

ModelTableNameChange Object

An object that represents the old and new name of a table which was renamed in the PPM. Table 30 lists the properties of the ModelTableNameChange object.

Table 30. Properties of the ModelTableNameChange object

Property | Read/Write | Type | Description
Application | Read-only | Application | Returns an object that represents the Microsoft Excel application.
Creator | Read-only | xlCreator | Returns a 32-bit integer that indicates the application in which the specified object was created.
Parent | Read-only | Object | Returns an Object that represents the model the ModelTableNameChange object resides in.
TableNameNew | Read-only | String | Returns the new name of the table.
TableNameOld | Read-only | String | Returns the old name of the table.

Conclusion

The PowerPivot add-in enables you to build your own cubes instead of using the default ones Excel creates for you behind Power tables. With this add-in, can see the cubes in a visual context and change cube-specific properties. The Model object stores references to workbook connections and information about the Tables and Relationships contained within the PowerPivot Model.

Additional Resources

  • PowerPivot for Excel Tutorial Introduction

  • PowerPivot for Excel Tutorial Sample Data

  • Using PowerPivot with Excel 2010


Language-Specific Properties, Methods, and Functions

 Copy code hover
[image]

Language-Specific Properties, Methods, and Functions
Send feedback

Published: July 16, 2012

The Microsoft Excel Visual Basic for Applications (VBA) object model has language-specific elements for use with Asian and right-to-left languages.

The following table lists methods that have language-specific arguments. Methods that have new arguments or fewer arguments than in earlier versions of Excel are noted.

Method | Objects | Comments
Add | Phonetics |
AddLabel | Shapes |
AddTextbox | Shapes |
AutoFormat | Range |
CheckSpelling | Application, Chart, Range, Worksheet | Added SpellLang and removed IgnoreInitialAlefHamza and IgnoreFinalYaa
Find | Application, Range | Removed MatchControlCharacters, MatchDiacritics, MatchKashida, and MatchAlefHamza
GetPhonetic | Application |
Replace | Range | Removed MatchControlCharacters, MatchDiacritics, MatchKashida, and MatchAlefHamza
SetPhonetic | Range |
Sort | Range | Removed IgnoreControlCharacters, IgnoreDiacritics, and IgnoreKashida
SortSpecial | Range |

Properties that return or set language-specific attributes are listed in the following table.

Property | Objects
AddIndent | Range, Style
AddressLocal | Range
Alignment | Phonetic, Phonetics, TextEffectFormat, TickLabels
CharacterType | Phonetic, Phonetics
ControlCharacters | Application
CursorMovement | Application
DefaultSheetDirection | Application
DisplayRightToLeft | Window, Worksheet
FileFormat | Workbook
HorizontalAlignment | AxisTitle, ChartTitle, DataLabel, DataLabels, DisplayUnitLabel, Range, Style, TextFrame
IMEMode | Validation
International | Application
Item | Phonetics
Length | Phonetics
Phonetic | Range
PhoneticCharacters | Characters
Phonetics | Range
ReadingOrder | AxisTitle, ChartTitle, DataLabel, DataLabels, DisplayUnitLabel, Range, Style, TextFrame, TickLabels
Start | Phonetics
VerticalAlignment | AxisTitle, ChartTitle, DataLabel, DataLabels, DisplayUnitLabels, Range, Style, TextFrame

The following are language-specific worksheet functions:

  • FindB

  • ReplaceB

  • SearchB

  • USDollar


OLE DB for OLAP Properties Used by Excel

 Copy code hover
[image]

OLE DB for OLAP Properties Used by Excel
Send feedback

Published: July 16, 2012

Microsoft Excel uses an OLE DB for OLAP (OnLine Analytical Processing) provider to connect to OLAP cubes. When connecting to an OLAP cube, Excel reads and sets various OLE DB and OLE DB for OLAP properties. Excel considers Connection properties, Data Source Information Properties, Schema Rowset Queries, and Cell properties.

Rather than address all the existing properties, this topic focuses on the properties that have a unique relationship with Excel. OLAP connections in Excel are used for PivotTables and OLAP Formulas. When you are testing an existing OLAP provider, it is recommended that you have Excel read a set of provider properties to determine whether an OLAP provider supports the features required for OLAP PivotTable design and functionality. If the provider does not support certain capabilities, the features that depend on these capabilities are either disabled or limited. Other properties are set in order to get desired behavior, and if these properties are not implemented for an OLAP provider, Excel might not work with it.

Connection Properties

Property Set | Property | Set if | Set to
DBPROPSET_MSOLAPINIT | DBPROP_MSMD_SAFETY_OPTIONS | Supported | OLAPUDFSecurity reg key or DBPROPVAL_MSMD_SAFETY_OPTIONS_ALLOW_SAFE See also: Safety Options Property.
DBPROPSET_MSOLAPINIT | DBPROP_MSMD_MDXCOMPATIBILITY | Supported | DBPROP_MSMD_MDXCOMPATIBILITY_70 See also: MDX Compatibility Property.
DBPROPSET_MSOLAPINIT | DBPROP_MSMD_SOURCE_DSN_SUFFIX | DBPROP_MSMD_SOURCE_DSN in DBPROPSET_MSOLAPINIT is present | String "Prompt=CompleteRequired;Window Handle=0x<hwnd>" See also: Source_DSN_Suffix Property.
DBPROPSET_MSOLAPINIT | DBPROP_MSMD_MDX_MISSING_MEMBER_MODE | Supported | If property is supported, Excel sets it to the string "Error". Ignored if not supported.
DBPROPSET_DBINIT | DBPROP_INIT_LCID | Supported | Set before making the connection. It is possible to specify any LCID to be used in the connection. If translations are turned on for the connection, Excel sets this to the UI language (default). If property is not supported, Excel has no problem other than losing the functionality of having translations based on UI language.
DBPROPSET_DBINIT | DBPROP_INIT_PROMPT | Supported | Not OLAP specific. Set before making the connection. If setting this property fails because a certain value is not supported, Excel ignores the failure.
DBPROPSET_DBINIT | DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO | Supported | Not OLAP specific. Set before making the connection. Excel appears to always set this to True.
DBPROPSET_DBINIT | DBPROP_INIT_HWND | Supported | Not OLAP specific. Set before making the connection. Excel sets this to the main window of the application so the provider displays the alert using the correct parent window.
DBPROPSET_DBINIT | DBPROP_INIT_ASYNCH | Supported | Not OLAP specific. Set before making the connection. Excel sets this property to DBPROPVAL_ASYNCH_INITIALIZE based on a registry setting (you can also disable it by using a registry setting). If property is not supported, Excel ignores it and does not set it.
DBPROPSET_DBINIT | DBPROP_CMD_PROMPT | Supported | Not OLAP specific. Set before making the connection.
DBPROPSET_DBINIT | DBPROP_CMD_HWND | Supported | Not OLAP specific. Set before making the connection.

Data Source Information

Property Set

Property

Value

Use

DBPROPSET_MDX_EXTENSIONS

DBPROP_MSMD_MDX_DDL_EXTENSIONS

If bit set for DBPROPVAL_MDX_DLL_CREATESESSIONCUBE.

The grouping feature of OLAP PivotTables is enabled if CREATE SESSION CUBE is supported.

DBPROPSET_MDX_EXTENSIONS

DBPROP_MSMD_MDX_DDL_EXTENSIONS

If bit set for DBPROPVAL_MDX_DDL_REFRESHCUBE.

If REFRESH CUBE command is supported, Excel executes it when an OLAP PivotTable is refreshed.

DBPROPSET_MDX_EXTENSIONS

DBPROP_MSMD_MDX_CALCMEMB_EXTENSIONS

If bit set for DBPROPVAL_MDX_CALCMEMB_ADD.

The show calculated members feature in OLAP PivotTable is enabled if ADDCALCULATEDMEMBERS is supported in MDX (Multidimensional Expressions).

DBPROPSET_DATASOURCEINFO

MDPROP_MDX_FORMULAS

If both bits set MDPROPVAL_MF_SCOPE_SESSION, MDPROPVAL_MF_CREATE_CALCMEMBERS.

If the provider supports creating session members (CREATE SESSION MEMBER), Excel enables this feature in OLAP PivotTables (only available in the object model in Excel).

DBPROPSET_SESSION

DBPROP_VISUALMODE

If supported (and subselect not supported, see MDPROP_MDX_SUBQUERIES below).

Enables control of Include hidden items in totals (toggle visual totals).

DBPROPSET_DATASOURCEINFO

MDPROP_MDX_SUBQUERIES

If the two lowest bits are set (with this, Excel does not support non-visual totals, see DBPROP_VISUALMODE above).

Enables Label, Date, and Value filtering in Excel PivotTables. Generally uses Excel MDX query construction.

Note that this property is introduced with SQL Server 2005 Service Pack 2. Value is always VARIANT_TRUE in msolap90.dll.

DBPROPSET_DATASOURCEINFO

MDPROP_MDX_DRILL_FUNCTIONS

If the two lowest bits of this property are set, Excel interprets it as the server supporting tuple-based drilling with the DrillDownLevel and DrillDownMember functions.

However, Excel only allows attribute drilling if the lowest two bits of MDPROP_MDX_SUBQUERIES are also set (subselects supported).

DBPROPSET_DATASOURCEINFO

MDPROP_FLATTENING_SUPPORT

Check that it is set to MDPROPVAL_FS_FULL_SUPPORT.

Read by Excel, and if it is not set to MDPROPVAL_FS_FULL_SUPPORT, an error occurs because Excel does not consider it an OLAP provider.

DBPROPSET_DATASOURCEINFO

MDPROP_NAMED_LEVELS

Excel checks that the lowest bit is set (MDPROPVAL_NL_NAMEDLEVELS).

If the lowest bit of this property is not set, Excel fails.

DBPROPSET_DATASOURCEINFO

MDPROP_MDX_SET_FUNCTIONS

Excel queries for this property, but it has no feature-relevant effect.

DBPROPSET_DATASOURCEINFO

DBPROP_DBMSVER

Excel checks whether this value is a string.

Excel does not check the actual value of this property; it only verifies whether it is a string. If it is not a string, Excel fails to connect.

DBPROPSET_DATASOURCEINFO

DBPROP_DATASOURCE_TYPE

Excel checks whether the second lowest bit is set (DBPROPVAL_DST_MDP).

If the lowest bit is set, the provider is considered a multidimensional (OLAP) provider.

DBPROPSET_ROWSET

DBPROP_ROWSET_ASYNCH

If supported.

Excel tries to set this to DBPROPVAL_ASYNCH_INITIALIZE but if this fails, Excel falls back into synchronous mode.

If supported, it enables Excel to support the user pressing the Esc key to stop query execution before it is finished.

Schema Rowset Queries

Schema Rowset

Column

Value

Controls

MDSCHEMA_CUBES

IS_DRILLTHROUGH_ENABLED

TRUE

If set to TRUE, the drill-through (Show Details) feature is enabled for cells in the OLAP PivotTable values area.

MDSCHEMA_HIERARCHIES

STRUCTURE

MD_STRUCTURE_UNBALANCED

Excel has special handling of filtering for unbalanced hierarchies, so these are marked as such for control purposes.

MDSCHEMA_HIERARCHIES

HIERARCHY_ORIGIN

MD_ORIGIN_ATTRIBUTE set and not MD_ORIGIN_USER_DEFINED

Excel has special handling of attribute hierarchies in OLAP PivotTables, so attribute hierarchies are marked as such.

MDSCHEMA_HIERARCHIES

HIERARCHY_DISPLAY_FOLDER

Based on this property, the PivotTable Field List displays hierarchies in folders under their dimensions.

MDSCHEMA_MEASUREGROUPS

MEASUREGROUP_NAME

Measures are listed in a folder representing their measure group in the PivotTable Field List.

MDSCHEMA_MEASUREGROUPS

MEASUREGROUP_CAPTION

Measures are listed in a folder representing their measure group with this caption in the PivotTable Field List.

MDSCHEMA_SETS

SET_DISPLAY_FOLDER

Excel reads the display folder property to enable it to place sets in display folders in the PivotTable Field List.

MDSCHEMA_SETS

SET_CAPTION

Excel reads the set caption for displaying in the PivotTable report and in the PivotTable Field List.

MDSCHEMA_KPIS

KPI_DISPLAY_FOLDER

KPIs (key performance indicators) defined on the server are listed in the PivotTable field list, and the components (value, goal, status, and trend) can be added to the values area.

Excel reads this property to place the KPI in the correct display folder in the PivotTable Field List.

MDSCHEMA_KPIS

KPI_PARENT_KPI_NAME

Excel reads this property to place child KPIs in subfolders under their parent KPI in the PivotTable Field List (if display folders are defined, those are used instead).

MDSCHEMA_KPIS

KPI_TREND_GRAPHIC

Excel reads this property and, based on the value, maps it to the closest conditional formatting icon set in Excel when Trend is added to the PivotTable.

MDSCHEMA_KPIS

KPI_STATUS_GRAPHIC

Excel reads this property and, based on the value, maps it to the closest conditional formatting icon set in Excel when Status is added to the PivotTable.

MDSCHEMA_ACTIONS

Additional Actions feature. Excel exposes server-defined actions in the shortcut menu of an OLAP PivotTable report when actions exist on the server for the selected context.

MDSCHEMA_MEASURES

MEASURE_DISPLAY_FOLDER

Read by Excel so it can place measures in the correct display folder in the PivotTable Field List.

MDSCHEMA_MEASURES

EXPRESSION

Read by Excel to determine whether a measure is calculated. If it is a string and not empty, Excel considers it a calculated measure.

MDSCHEMA_PROPERTIES

PROPERTY_NAME

"MEMBER_VALUE"

This schema also used for getting regular member properties. The "MEMBER_VALUE" value is a special case, but there are other usage.

Excel gets the member value property of the key attribute in a dimension by restricting to "MEMBER_VALUE" in the PROPERTY_NAME column.

If the data type (DATA_TYPE) of the MEMBER_VALUE property of the key attribute of a Time dimension is Date, the PivotTable exposes date filtering instead of label filtering. The actual date filtering is done based on the member value property of the key independent of which hierarchy of that dimension is filtered.

Note Note

Date filtering requires support for subselects (see MDPROP_MDX_SUBQUERIES above).

MDSCHEMA_DISCOVER

RESTRICTIONS

Depending on usage, Excel restricts on hierarchies, levels, or measures when reading the MDSCHEMA_DISCOVER rowset to get the RESTRICTIONS.

Excel reads schema row by row and finds list of restrictions for all other relevant schemas to obtain the index of the restrictions that affect Excel.

The RESTRICTIONS column has a chapter handle to another row set from which Excel looks at the NAME column.

In the NAME column, Excel expects to find the strings HIERARCHY_VISIBILITY, MEASURE_VISIBILITY, LEVEL_VISIBILITY (if the provider supports restriction on visibility).

If Excel cannot find <xxx>_VISIBILITY strings (or if MDSCHEMA_DISCOVER is not supported) it will assume that provider doesn't support returning hidden items, and it will not query for them.

MDSCHEMA_LEVELS

LEVEL_ATTRIBUTE_HIERARCHY_NAME

Used by Excel to hide special grouping levels with system-generated names. Note that this is not needed with Microsoft SQL Server 2005 Analysis Services Service Pack 2.

MDSCHEMA_LEVELS

CUSTOM_ROLLUP_SETTINGS

0

If not 0, Excel assumes the level has custom rollup. Excel checks this for all levels of each hierarchy, and if custom rollup is present, some operations are disabled (such as grouping).

Cell Properties

Property Name

Use

Language

LCID for determining how to interpret FORMAT_STRING when it is CURRENCY.

Excel uses this property to determine which currency symbol to use when formatting values with FORMAT_STRING set to Currency.

Retrieving Cell Properties

Example of calculated measure definition specifying the LANGUAGE property for the client application to pick up:

Copy code Copy code
CREATE MEMBER CURRENTCUBE.[Measures].[Internet Gross Profit]
 AS
[Measures].[Internet Sales Amount]
-
[Measures].[Internet Total Product Cost],

FORMAT_STRING = "Currency",
BACK_COLOR = 12615680 /*R=0, G=128, B=192*/,
FORE_COLOR = 65408 /*R=128, G=255, B=0*/,
FONT_FLAGS = 3 /*Bold, Italic*/,
NON_EMPTY_BEHAVIOR = { [Internet Sales Amount],[Internet Total Product Cost] },
VISIBLE = 1,
LANGUAGE = 1033 /*Telling client application to display US currency symbol*/;


Programming for the Single Document Interface in Excel 2013

 Copy code hover
[image]

Programming for the Single Document Interface in Excel 2013
Send feedback

Learn about programming considerations for the Single Document Interface in Microsoft Excel 2013.

Applies to: Excel 2013

In this article
Comparing Single and Multiple Document Interfaces in Excel 2010 and Excel 2013
What's changed in the User Interface
Recalculation and Formulas
Custom Task Panes
Custom Ribbons
Considerations for VBA code
Deprecating Protect Workbook Windows
Solutions for SDI Issues
Summary
Additional resources

Comparing Single and Multiple Document Interfaces in Excel 2010 and Excel 2013

A new feature of Microsoft Excel 2013 is the single document interface (SDI). SDI is a method of organizing graphical user interface (UI) applications into individual windows that the operating system window manager handles separately. For Excel 2013, each workbook in a single instance of Excel contains its own ribbon UI (see Figure 1).

Figure 1. Single Document Interface in Excel 2013

Single Document Interface in Excel 2013

This contrasts with a multiple document interface (MDI), in which a single parent window is used to contain multiple nested child windows, with only the parent window having a menu or tool bar. For Microsoft Excel 2010, each workbook in a single instance of Excel utilized a common ribbon UI (see Figure 2).

Figure 2. Multiple Document Interface in Excel 2010

Multiple Document Interface in Excel 2010

Excel 2010, Excel 2007, Excel 2003, and Excel 2001 use the MDI which means that there is a single application-level window holding all the workbooks that are open in a particular instance of Excel. The windows of the workbook can be arranged inside the Excel app window, all sharing the same Ribbon UI. SDI in Excel 2013 means that each workbook will have its own top level app window, and has its own corresponding Ribbon UI.

Note Note

There is no MDI compatibility option in Excel 2013.

In dual-monitor systems, the SDI in Excel enables side-by-side comparisons of two workbooks by dragging each workbook to a different monitor. Each workbook works independently of the other.

To see SDI and MDI in action, if you have both Excel 2010 and Excel 2013 available, perform the following steps.

To contrast the number of processes for MDI and SDI interfaces:

  1. On the Windows Start menu, start Excel 2010.

  2. Start a second occurrence of Excel 2010. Verify that the two Excel windows are displayed.

  3. On the Windows Task Bar, choose and then select Start Task Manager.

  4. Choose the Processes tab and then scroll down until you see the two Excel.exe entries. This tells you that, by default, Excel 2010 opens the workbooks in their own processes.

  5. Close the two instances of Excel 2010.

  6. On the Windows Start menu, choose Excel 2013.

  7. Start a second occurrence of Excel 2013. Verify that the two Excel windows are displayed.

  8. Start the Task Manager again.

  9. On the Processes tab scroll down until you see Excel.exe. Be aware that although you opened two occurrences of Excel 2013, the two workbooks are contained in the same single instance of Excel.

To see how SDI and MDI work inside of an instance of Excel, perform the following steps.

To compare the number of Excel instances for MDI and SDI interfaces:

  1. On the Windows Start menu, choose Excel 2010.

  2. Choose the Excel window to make it active and verify that Book1 is the current workbook.

  3. Press CTRL + N to open another workbook. Verify that Book2 is now the current workbook.

  4. Minimize Book2 and then see Book1. Both workbooks are contained in the same instance of Excel 2010.

  5. Close Excel 2010.

  6. On the Windows Start menu, choose Excel 2013.

  7. Choose the Excel window to make it active and verify that Book1 is the current workbook.

  8. Press CTRL + N to open another workbook. Verify that Book2 is opened in a separate instance of Excel.

  9. Close Excel 2013.

Note Note

It is possible to open multiple instances of Excel 2013, if desired, by using the following command line switch: excel.exe /x. This switch starts Excel in a new process.

In this article, we will discuss the implementation of the SDI in the Excel UI and how it impacts programmability in Excel.

What's changed in the User Interface

If you look closely after opening an Excel 2013 workbook, you no longer see the window state buttons (minimize, maximize, and restore) in the upper-left corner of the ribbon. Figure 3 shows the window state buttons that are available in Excel 2010 and Excel 2007. Because the top-level window is now tied directly to a single workbook or workbook view, there is no longer a need for the windows management UI in Excel.

Figure 3. Windows state UI in Excel 2010

Windows state UI in Excel 2010

Additionally, starting in Excel 2013, there are no longer multiple workbook windows inside of a single Excel instance window such as seen in Figure 4.

Figure 4. Multiple workbooks in a single Excel instance window

Multiple workbooks in a single Excel instance

Recalculation and Formulas

Recalculations in Excel 2013 will still be "global" meaning that they occur across workbooks in the same instance of Excel. Formulas that reference across workbooks that are open in the same instance of Excel 2013 will participate in calculations together and will share the same workbook calculation mode (automatic, automatic except for data tables, and manual).

In MDI, there is only one formula bar to handle all open workbooks in that instance of Excel. In SDI, there is one formula bar per workbook. For SDI, when editing cross-book references in a formula, both the source and target workbook formula bars will show the formula currently being edited as shown in Figure 5.

Figure 5. Updating cross-workbook formulas

Updating cross-workbook formulas

Custom Task Panes

Custom Task Panes that attached to a top level window in MDI are now attached to a particular workbook's window in SDI. Switching to a different workbook will activate that workbook window, which won't necessarily have the custom task pane attached, unless the developer's code is updated to specifically display the custom task pane for that workbook.

To summarize, as a developer, you will want to:

  • Ensure that for any workbooks where you want to want to show the custom task pane, you write code to explicitly do that.

  • Ensure that you explicitly handle updating the custom task pane state across all instances, if you want all of the custom task panes to reflect the same state. For example, a check box is toggled to ON by the user, and you want that to be reflected across all of the custom task panes in all instances of Excel.

Custom Ribbons

Custom ribbon tabs and controls that assumed a single ribbon UI per application instance in previous versions of Excel will now be propagated onto each workbook ribbon in Excel 2013. Whereas in MDI the custom ribbon developer didn't need to consider multiple instances of their controls on different instances of Excel's ribbon UI, with SDI they will need to account for this situation.

If you want to keep all the ribbon UI controls in the same state across open workbooks, you will need to:

  • Ensure that the code is able to cycle through the workbook windows and update the state of the controls.

OR

  • Cache the state of the controls so that when the user switches to another workbook, that event can be captured and the controls updated as part of the window switch.

Additionally, consider the case where you develop code to add a custom UI control by using Application.Commandbar to access the ribbon. When you try to access that control at a later time, your code will need to account for the fact that the active workbook may not be the same workbook where you added the control.

Considerations for VBA code

With the shift to SDI, all of the Excel application-level window methods, events, and properties remain unaffected and work the way they have in previous versions of Excel (for example, Application.ActiveWindow, Application.Windows, and so on).

In Excel 2013, all of the workbook-level window methods, events, and properties now operate on the top level window (for example, the Workbook.WindowActivate event is still triggered when you switch to a particular workbook, the Workbook.Resize event is still triggered when that workbook is resized, and ThisWorkbook.Windows(1).Height, ThisWorkbook.Windows(1).Width, ThisWorkbook.Windows(1).Left, ThisWorkbook.Windows(1).Right, ThisWorkbook.Windows(1).Minimize, ThisWorkbook.Windows(1).Maximize and so forth will operate on the top level window for the active workbook).

Special cases are listed in the following table.

Table 1. Object Model Behavior with the SDI

Function

Description

SDI Implications

Application.Visible

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

If all windows are hidden:

  • Application.Visible becomes False

  • Setting Application.Visible to True displays all hidden windows

  • Opening a document via the shell only shows that window and Application.Visible is now True

Additionally:

  • Application.Visible = False hides everything and Application.Visible = True displays everything, ignoring any document-level settings

  • If all of the windows are hidden via the window-level setting then the application-level setting toggles as well

  • Having at least one window displayed means that the application-level setting is True

Application.ShowWindowsInTaskbar

True if there's a separate Windows taskbar button for each open workbook. The default value is True. Read/write Boolean.

This setting is deprecated in Excel 2013.

Application.Caption

Returns or sets a String value that represents the name that appears in the title bar of the main Microsoft Excel window.

Updates all windows for that instance of Excel.

Application.Hwnd

Returns a Long indicating the top-level window handle of the Microsoft Excel window. Read-only.

Will return the active window's handle.

Application.FormulaBarHeight

Enables the user to specify the height of the formula bar in lines. Read/write Long.

Operates on the currently active workbook window; not all of the windows for this instance of Excel.

Application.DisplayFormulaBar

True if the formula bar is displayed. Read/write Boolean.

Operates on all windows for this instance of Excel.

Workbook.Windows

Returns a Windows collection that represents all the windows in the specified workbook. Read-only Windows Object.

No change in behavior. Returns the collection of windows for this book such as task panes, additional views.

Workbook.WindowResize

Occurs when any workbook window is resized.

No change in behavior. Is triggered when a workbook window (the top-level) is resized.

Window.Caption

Returns or sets a Variant value that represents the name that appears in the title bar of the document window.

No change in behavior.

Workbook.Protect(Password, Structure, Windows)

Protects a workbook so that it cannot be modified.

Regardless of the value for the Windows parameter (True or False), the window structure protection will NOT be enabled. No runtime error is displayed if True is specified, but that portion of the procedure call will return a NO-OP.
Note Note

There are no changes required in custom code so that XLM commands continue to work as expected in SDI Excel.

Deprecating Protect Workbook Windows

In SDI, each workbook has its own top-level window that you can restore, minimize, and close. To minimize any confusion you might encounter in not being about to move, resize, or close this top-level window, the Windows option in the Protect Workbook feature in Excel 2013 is no longer available (see Figure 6). Table 2 describes this action further.

Figure 6. Windows option of the Protect Workbook dialog box is disabled

Windows option of the Protect Workbook dialog
Action | Behavior
Open a workbook created in an earlier version of Excel, with Window Protection enabled | Excel 2013 will recognize the window location and size attributes, but will not prevent the user from arranging or closing these windows.
View the Protect Structure and Windows dialog box | Excel 2013 will display the dialog box but with the Windows option disabled.

Solutions for SDI Issues

The following section provides workarounds for issues you may encounter when using the SDI.

  • A workbook cannot be closed by clicking the red "X" Close button when that workbook is programmatically opened via a modal user form. To work around this issue, it is suggested that you add the following code to the user form Layout event procedure and then open the user form as modeless.

    VBA Copy code Copy code
    Private Sub UserForm_Layout()
    Static fSetModal As Boolean
    If fSetModal = False Then
        fSetModal = True
        Me.Hide
        Me.Show 1
    End If
End Sub

    Another option is to open the workbook window, activate any other window, and then reactivate the workbook window. You should now be able to close the workbook using the Close button.

  • Assume that your VBA code opens multiple workbooks and uses the DataEntryMode property to control data entry and workbook closure. In the Excel 2013 SDI model, because each workbook is contained in its own process, the DataEntryMode property used in one workbook does not recognize the existence of other workbook and therefore has little to no effect on their interaction. To work around this issue, there are a couple of options. You can hide the extra workbooks or worksheets by using Window.Visible = False or Sheet.Visible = False, respectively. You can also detect and cancel any closing events by using Workbook.BeforeClose(Cancel) = True.

  • Toolbars added to Excel 2013 workbooks via command bar code and XLA files will not be displayed until after you close and reopen the workbook. Using command bars to customize the UI was deprecated starting in Excel 2007. The optimal solution is to customize the ribbon UI by using XML files as described in detail in the article Customizing the 2007 Office Fluent Ribbon for Developers

    Another option is to use an application-level event to detect new workbooks opening and then use Application.Windows instead of workbooks to add the ribbon control. The following is sample code that can be used to accomplish this.

    VBA Copy code Copy code
    Private Sub Workbook_Open()
    ToolBarsAdd
End Sub

Sub ToolBarsAdd()
    Dim oBar As CommandBar

    ToolBarsDelete
    Set oBar = Application.CommandBars.Add(Name:="MyToolBar")
    '
    With oBar
        With .Controls.Add(Type:=msoControlButton)
            .OnAction = "SayHello"
            .FaceId = 800
        End With
    End With
    oBar.Visible = True
End Sub

Sub SayHello()
    MsgBox "Hello from '" & ActiveWorkbook.Name & "'"
End Sub

    The following code would then be used to remove the toolbar before closing the workbook.

    VBA Copy code Copy code
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ToolBarsDelete
End Sub

Sub ToolBarsDelete()
Dim wnd As Window
On Error Resume Next
    For Each wnd In Application.Windows
        wnd.Activate
        Application.CommandBars("MyToolBar ").Delete
    Next wnd
End Sub

  • In Excel 2010, Excel 2007, Excel 2003, and Excel 2001, a modeless user form is displayed as the top-level window on top of all Excel windows by default. In Excel 2013, a modeless user form is only visible on top of the workbook window that was active when the user form was displayed. Excel Most Valuable Professional (MVP) Jan Karel Pieterse provides an explanation of the issue and a solution on his web page at http://www.jkp-ads.com/articles/keepuserformontop.asp.

Summary

The new Single Document Interface in Excel 2013 makes it easy to work with multiple workbooks. You can even drag the workbooks to different monitors for convenience. You just need to remember that there is only one top-level window and one ribbon UI menu per workbook. This may require that you update any existing code to cache the state of controls and settings as you move from workbook to workbook.

Additional resources

Find addition information on the topics discussed in this article at the following locations.

  • Open Excel workbooks in separate windows and view them side by side

  • What's new for Excel 2013 developers

  • Excel 2013 single document interface (SDI): How to rebuild your task panes to support it

  • Wikipedia: Single document interface

  • Wikipedia: Multiple document interface

  • Customizing the 2007 Office Fluent Ribbon for Developers


Functions (Excel)

 Copy code hover
[image]

Functions (Excel)
Send feedback

Published: July 16, 2012

In this section

  • Using the Solver VBA Functions

  • SolverAdd Function

  • SolverChange Function

  • SolverDelete Function

  • SolverFinish Function

  • SolverFinishDialog Function

  • SolverGet Function

  • SolverLoad Function

  • SolverOk Function

  • SolverOkDialog Function

  • SolverOptions Function

  • SolverReset Function

  • SolverSave Function

  • SolverSolve Function


Using the Solver VBA Functions

 Copy code hover
[image]

Using the Solver VBA Functions
Send feedback

Published: July 16, 2012

Before you can use the Solver VBA functions from VBA, you must enable the Solver add-in in the Excel Options dialog box.

  1. Click the File tab, and then click Options below the Excel tab.

  2. In the Excel Options dialog box, click Add-Ins.

  3. In the Manage drop-down box, select Excel Add-ins, and then click Go.

  4. In the Add-Ins dialog box, select Solver Add-in, and then click OK.

After you have enabled the Solver add-in, Excel will auto-install the Add-in if it is not already installed, and the Solver command will be added to the Analysis group on the Data tab in the ribbon.

Before you can use the Solver VBA functions in the Visual Basic Editor, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

The following functions can be used to control the Solver add-in from VBA. Each function corresponds to an action that you can perform interactively, through the Solver Parameters, Solver Options, and Solver Results dialog boxes of the Solver add-in.

  • SolverAdd Function

  • SolverChange Function

  • SolverDelete Function

  • SolverFinish Function

  • SolverFinishDialog Function

  • SolverGet Function

  • SolverLoad Function

  • SolverOk Function

  • SolverOkDialog Function

  • SolverOptions Function

  • SolverReset Function

  • SolverSave Function

  • SolverSolve Function


SolverAdd Function

 Copy code hover
[image]

SolverAdd Function
Send feedback

Published: July 16, 2012

Adds a constraint to the current problem. Equivalent to clicking Solver in the Data | Analysis group and then clicking Add in the Solver Parameters dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, the Solver add-in must be enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverAdd(CellRef, Relation, FormulaText)

CellRef Required Variant. A reference to a cell or a range of cells that forms the left side of a constraint.

Relation Required Integer. The arithmetic relationship between the left and right sides of the constraint. If you choose 4, 5, or 6, CellRef must refer to decision variable cells, and FormulaText should not be specified.

Relation | Arithmetic relationship
1 | <=
2 | =
3 | >=
4 | Cells referenced by CellRef must have final values that are integers.
5 | Cells referenced by CellRef must have final values of either 0 (zero) or 1.
6 | Cells referenced by CellRef must have final values that are all different and integers.

FormulaText Optional Variant. The right side of the constraint.

Remarks

After constraints are added, you can manipulate them with the SolverChange and SolverDelete functions.

Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverAdd function is used to add three constraints to the current problem.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions precision:=0.001
SolverOK setCell:=Range("TotalProfit"), _
 maxMinVal:=1, _
 byChange:=Range("C4:E6")
SolverAdd cellRef:=Range("F4:F6"), _
 relation:=1, _
 formulaText:=100
SolverAdd cellRef:=Range("C4:E6"), _
 relation:=3, _
 formulaText:=0
SolverAdd cellRef:=Range("C4:E6"), _
 relation:=4
SolverSolve userFinish:=False
SolverSave saveArea:=Range("A33")


SolverChange Function

 Copy code hover
[image]

SolverChange Function
Send feedback

Published: July 16, 2012

Changes an existing constraint. Equivalent to clicking Solver in the Data | Analysis group and then clicking Change in the Solver Parameters dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, the Solver add-in must be enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverChange(CellRef, Relation, FormulaText)

CellRef Required Variant. A reference to a cell or a range of cells that forms the left side of a constraint.

Relation Required Integer. The arithmetic relationship between the left and right sides of the constraint. If you choose 4 or 5, CellRef must refer to adjustable (changing) cells, and FormulaText should not be specified.

Relation | Arithmetic relationship
1 | <=
2 | =
3 | >=
4 | Cells referenced by CellRef must have final values that are integers.
5 | Cells referenced by CellRef must have final values of either 0 (zero) or 1.
6 | Cells referenced by CellRef must have final values that are all different and integers.

FormulaText Optional Variant. The right side of the constraint.

Remarks

If CellRef and Relation do not match an existing constraint, you must use the SolverDelete and SolverAdd functions to change the constraint.

Example

This example loads the previously calculated Solver model stored on Sheet1, changes one of the constraints, and then solves the model again.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad loadArea:=Range("A33:A38")
SolverChange cellRef:=Range("F4:F6"), _
 relation:=1, _
 formulaText:=200
SolverSolve userFinish:=False


SolverDelete Function

 Copy code hover
[image]

SolverDelete Function
Send feedback

Published: July 16, 2012

Deletes an existing constraint. Equivalent to clicking Solver in the Data | Analysis group and then clicking Delete in the Solver Parameters dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, the Solver add-in must be enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverDelete(CellRef, Relation, FormulaText)

CellRef Required Variant. A reference to a cell or a range of cells that forms the left side of a constraint.

Relation Required Integer. The arithmetic relationship between the left and right sides of the constraint. If you choose 4, 5, or 6, CellRef must refer to decision variable cells, and FormulaText should not be specified.

Relation | Arithmetic relationship
1 | <=
2 | =
3 | >=
4 | Cells referenced by CellRef must have final values that are integers.
5 | Cells referenced by CellRef must have final values of either 0 (zero) or 1.
6 | Cells referenced by CellRef must have final values that are all different and integers.

FormulaText Optional Variant. The right side of the constraint.

Example

This example loads the previously calculated Solver model stored on Sheet1, deletes one of the constraints, and then solves the model again.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad loadArea:=Range("A33:A38")
SolverDelete cellRef:=Range("C4:E6"), _
 relation:=4
SolverSolve userFinish:=False


SolverFinish Function

 Copy code hover
[image]

SolverFinish Function
Send feedback

Published: July 16, 2012

Tells Microsoft Office Excel what to do with the results and what kind of report to create when the solution process is completed.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverFinish(KeepFinal, ReportArray,OutlineReports)

KeepFinal Optional Variant. Can be either 1 or 2. If KeepFinal is 1 or omitted, the final solution values are kept in the changing cells, replacing any former values. If KeepFinal is 2, the final solution values are discarded, and the former values are restored.

ReportArray Optional Variant. The kind of report that Excel will create when Solver is finished:

  • When the Simplex LP or GRG Nonlinear Solving method is used, 1 creates an Answer report, 2 creates a Sensitivity report, and 3 creates a Limit report.

  • When the Evolutionary Solving method is used, 1 creates an Answer report, and 2 creates a Population report.

  • When SolverSolve returns 5 (Solver could not find a feasible solution), 1 creates a Feasibility Report, and 2 creates a Feasibility-Bounds report.

  • When SolverSolve returns 7 (the linearity conditions are not satisfied), 1 creates a Linearity report.

Use the Array function to specify the reports you want to display — for example, ReportArray:= Array(1,3).

OutlineReports Optional Variant. Can be either True or False. If OutlineReports is False or omitted, reports are produced in the "regular" format, without outlining. If OutlineReports is True, reports are produced with outlined groups corresponding to the cell ranges you've entered for decision variables and constraints.

Example

This example loads the previously calculated Solver model stored on Sheet1, solves the model again, and then generates an answer report on a new worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad LoadArea:=Range("A33:A38")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1, ReportArray:=Array(1)


SolverFinishDialog Function

 Copy code hover
[image]

SolverFinishDialog Function
Send feedback

Published: July 16, 2012

Tells Microsoft Office Excel what to do with the results and what kind of report to create when the solution process is completed. Equivalent to the SolverFinish function, but also displays the Solver Results dialog box after solving a problem.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverFinishDialog(KeepFinal, ReportArray, OutlineReports)

KeepFinal Optional Variant. Can be either 1 or 2. If KeepFinal is 1 or omitted, the final solution values are kept in the changing cells, replacing any former values. If KeepFinal is 2, the final solution values are discarded, and the former values are restored.

ReportArray Optional Variant. The kind of report that Excel will create when Solver is finished:

  • When the Simplex LP or GRG Nonlinear Solving method is used, 1 creates an Answer report, 2 creates a Sensitivity report, and 3 creates a Limit report.

  • When the Evolutionary Solving method is used, 1 creates an Answer report, and 2 creates a Population report.

  • When SolverSolve returns 5 (Solver could not find a feasible solution), 1 creates a Feasibility Report, and 2 creates a Feasibility-Bounds report.

  • When SolverSolve returns 7 (the linearity conditions are not satisfied), 1 creates a Linearity report.

Use the Array function to specify the reports you want to display, for example, ReportArray:= Array(1,3).

OutlineReports Optional Variant. Can be either True or False. If OutlineReports is False or omitted, reports are produced in the "regular" format, without outlining. If OutlineReports is True, reports are produced with outlined groups corresponding to the cell ranges you've entered for decision variables and constraints.

Example

This example loads the previously calculated Solver model stored on Sheet1, solves the model again, and then displays the Finish dialog box with two preset options.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad loadArea:=Range("A33:A38")
SolverSolve userFinish:=True
SolverFinishDialog keepFinal:=1, reportArray:=Array(1)


SolverGet Function

 Copy code hover
[image]

SolverGet Function
Send feedback

Published: July 16, 2012

Returns information about current settings for Solver. The settings are specified in the Solver Parameters and Solver Options dialog boxes.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverGet(TypeNum, SheetName)

TypeNum Required Integer. A number specifying the type of information you want. The following settings are specified in the Solver Parameters dialog box.

TypeNum | Returns
1 | The reference in the Set Target Cell box, or the #N/A error value if Solver has not been used on the active sheet.
2 | A number corresponding to the Equal To option: 1 represents Max, 2 represents Min, and 3 represents Value Of.
3 | The value in the Value Of box.
4 | The reference (as a multiple reference, if necessary) in the By Changing Cells box.
5 | The number of constraints.
6 | An array of the left sides of the constraints, in text form.
7 | An array of numbers corresponding to the relationships between the left and right sides of the constraints: 1 represents <=, 2 represents =, 3 represents >=, 4 represents int, and 5 represents bin.
8 | An array of the right sides of the constraints, in text form.
13 | True if the Simple LP Solving method is selected; False if another Solving method is selected.
20 | True if the Make Unconstrained Variables Non-Negative check box is selected; False if it is cleared.

The following settings are specified in the Solver Options dialog box.

TypeNum | Returns
9 | The Max Time (Seconds) option (All Methods tab).
10 | The Iterations option (All Methods tab).
11 | The Constraint Precision option (All Methods tab).
12 | The Integer Optimality (%) option (All Methods tab).
14 | True if the Show Iteration Results check box is selected; False if it is cleared.
15 | True if the Use Automatic Scaling check box is selected; False if it is cleared (All Methods tab).
16 | A number corresponding to the type of estimates: 1 represents Tangent, and 2 represents Quadratic.
17 | A number corresponding to the Derivatives option in the GRG Nonlinear tab: 1 represents Forward, and 2 represents Central (GRG Nonlinear tab).
18 | A number corresponding to the type of search: 1 represents Newton, and 2 represents Conjugate.
19 | The Convergence tolerance (GRG Nonlinear tab and Evolutionary tab).
21 | The Population Size option (GRG Nonlinear tab and Evolutionary tab).
22 | The Random Seed option(GRG Nonlinear tab and Evolutionary tab).
23 | True if the Use Multistart check box is selected; False if it is cleared (GRG Nonlinear tab).
24 | True if the Require Bounds on Variables check box is selected; False if it is cleared (GRG Nonlinear tab and Evolutionary tab).
25 | The Mutation Rate option (Evolutionary tab).
26 | The Max Subproblems option (All Methods tab).
27 | The Max Feasible Solutions option (All Methods tab).
28 | The Ignore Integer Constraints option (All Methods tab).
29 | The Maximum Time without Improvement option (Evolutionary tab).

SheetName Optional Variant. The name of the sheet that contains the Solver model for which you want information. If SheetName is omitted, this sheet is assumed to be the active sheet.

Example

This example displays a message if you have not used Solver on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
state = SolverGet(TypeNum:=1)
If IsError(State) Then
 MsgBox "You have not used Solver on the active sheet"
End If


SolverLoad Function

 Copy code hover
[image]

SolverLoad Function
Send feedback

Published: July 16, 2012

Loads existing Solver model parameters that have been saved to the worksheet.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverLoad(LoadArea, Merge)

LoadArea Required Variant. A reference on the active worksheet to a range of cells from which you want to load a complete problem specification. The first cell in the LoadArea contains a formula for the Set Target Cell box in the Solver Parameters dialog box; the second cell contains a formula for the By Changing Cells box; subsequent cells contain constraints in the form of logical formulas. The last cell optionally contains an array of Solver option values. For more information, see SolverOptions. The range represented by the argument LoadArea can be on any worksheet, but you must specify the worksheet if it is not the active sheet. For example, SolverLoad("Sheet2!A1:A3") loads a model from Sheet2 even if it is not the active sheet.

Merge Optional Variant. A logical value corresponding to either the Merge button or the Replace button in the dialog box that appears after you select the LoadArea reference and click OK. If True, the variable cell selections and constraints from the LoadArea are merged with the currently defined variables and constraints. If False or omitted, the current model specifications and options are erased (equivalent to a call to the SolverReset function) before the new specifications are loaded.

Example

This example loads the previously calculated Solver model stored on Sheet1, changes one of the constraints, and then solves the model again.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad loadArea:=Range("A33:A38")
SolverChange cellRef:=Range("F4:F6"), _
 relation:=1, _
 formulaText:=200
SolverSolve userFinish:=False


SolverOk Function

 Copy code hover
[image]

SolverOk Function
Send feedback

Published: July 16, 2012

Defines a basic Solver model. Equivalent to clicking Solver in the Data | Analysis group and then specifying options in the Solver Parameters dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverOk(SetCell, MaxMinVal, ValueOf, ByChange,Engine, EngineDesc)

SetCell Optional Variant. Refers to a single cell on the active worksheet. Corresponds to the Set Target Cell box in the Solver Parameters dialog box.

MaxMinVal Optional Variant. Corresponds to the Max, Min, and Value options in the Solver Parameters dialog box.

MaxMinVal | Specifies
1 | Maximize
2 | Minimize
3 | Match a specific value

ValueOf Optional Variant. If MaxMinVal is 3, you must specify the value to which the target cell is matched.

ByChange Optional Variant. The cell or range of cells that will be changed so that you will obtain the desired result in the target cell. Corresponds to the By Changing Cells box in the Solver Parameters dialog box.

Engine Optional Variant. The Solving method that should be used to solve the problem: 1 for the Simplex LP method, 2 for the GRG Nonlinear method, or 3 for the Evolutionary method. Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box.

ByChange Optional Variant. An alternate way to specify the Solving method that should be used to solve the problem as a string: "Simplex LP", "GRG Nonlinear", or "Evolutionary". Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box.

Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverOK function defines a problem by specifying the SetCell, MaxMinVal, and ByChange arguments.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
 MaxMinVal:=1, _
 ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
 Relation:=1, _
 FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=3, _
 FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=4
SolverSolve UserFinish:=False
SolverSave SaveArea:=Range("A33")


SolverOkDialog Function

 Copy code hover
[image]

SolverOkDialog Function
Send feedback

Published: July 16, 2012

Same as the SolverOK function, but also displays the Solver dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverOkDialog(SetCell, MaxMinVal, ValueOf, ByChange, Engine, EngineDesc)

SetCell Optional Variant. Refers to a single cell on the active worksheet. Corresponds to the Set Target Cell box in the Solver Parameters dialog box.

MaxMinVal Optional Variant. Corresponds to the Max, Min, and Value options in the Solver Parameters dialog box.

MaxMinVal | Specifies
1 | Maximize
2 | Minimize
3 | Match a specific value

ValueOf Optional Variant. If MaxMinVal is 3, you must specify the value that the target cell is matched to.

ByChange Optional Variant. The cell or range of cells that will be changed so that you will obtain the desired result in the target cell. Corresponds to the By Changing Cells box in the Solver Parameters dialog box.

Engine Optional Variant. The Solving method that should be used to solve the problem: 1 for the Simplex LP method, 2 for the GRG Nonlinear method, or 3 for the Evolutionary method. Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box.

ByChange Optional Variant. An alternate way to specify the Solving method that should be used to solve the problem as a string: "Simplex LP", "GRG Nonlinear", or "Evolutionary". Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box.

Example

This example loads the previously calculated Solver model stored on Sheet1, resets all Solver options, and then displays the Solver Parameters dialog box. From this point on, you can use Solver manually.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverLoad LoadArea:=Range("A33:A38")
SolverReset
SolverOKDialog SetCell:=Range("TotalProfit")
SolverSolve UserFinish:=False


SolverOptions Function

 Copy code hover
[image]

SolverOptions Function
Send feedback

Published: July 16, 2012

Allows you to specify advanced options for your Solver model. This function and its arguments correspond to the options in the Solver Options dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverOptions)MaxTime, Iterations, Precision, AssumeLinear, StepThru, Estimates, Derivatives, SearchOption, IntTolerance, Scaling, Convergence, AssumeNonNeg, PopulationSize, RandomSeed, MultiStart, RequireBounds, MutationRate, MaxSubproblems, MaxIntegerSols, SolveWithout, MaxTimeNoImp)

MaxTime Optional Variant. The maximum amount of time (in seconds) Solver will spend solving the problem. The value must be a positive integer.

Iterations Optional Variant. The maximum number of iterations Solver will use in solving the problem. The value must be a positive integer.

Precision Optional Variant. A number between 0 (zero) and 1 that specifies the degree of precisionwith which constraints (including integer constraints) must be satisfied. The default precision is 0.000001. A smaller number of decimal places (for example, 0.0001) indicates a lower degree of precision. In general, the higher the degree of precision you specify (the smaller the number), the more time Solver will take to reach solutions.

AssumeLinear Optional Variant. True to have Solver assume that the underlying model is linear. This speeds the solution process, but it should be used only if all the relationships in the model are linear. The default value is False.

StepThru Optional Variant. True to have Solver pause at each trial solution. You can pass Solver a macro to run at each pause by using the ShowRef argument of the SolverSolve function. False to not have Solver pause at each trial solution. The default value is False.

Estimates Optional Variant. Specifies the approach used to obtain initial estimates of the basic variables in each one-dimensional search: 1 represents tangent estimates, and 2 represents quadratic estimates. Tangent estimates use linear extrapolation from a tangent vector. Quadratic estimates use quadratic extrapolation; this may improve the results for highly nonlinear problems. The default value is 1 (tangent estimates).

Derivatives Optional Variant. Specifies forward differencing or central differencing for estimates of partial derivatives of the objective and constraint functions: 1 represents forward differencing, and 2 represents central differencing. Central differencing requires more worksheet recalculations, but it may help with problems that generate a message saying that Solver could not improve the solution. With constraints whose values change rapidly near their limits, you should use central differencing. The default value is 1 (forward differencing).

SearchOption Optional Variant. Use the Search options to specify the search algorithm that will be used at each iteration to decide which direction to search in: 1 represents the Newton search method, and 2 represents the conjugate search method. Newton, which uses a quasi-Newton method, is the default search method.

IntTolerance Optional Variant. A decimal number between 0 (zero) and 100 that specifies the Integer Optimality percentage tolerance. This argument applies only if integer constraints have been defined; it specifies that Solver can stop if it has found a feasible integer solution whose objective is within this percentage of the best known bound on the objective of the true integer optimal solution. A larger percentage tolerance would tend to speed up the solution process.

Scaling Optional Variant. If the objective or constraints differ by several orders of magnitude, for example, maximizing percentage of profit based on million-dollar investments, set this option True to have Solver internally rescale the objective and constraint values to similar orders of magnitude during computation. If this option is False, Solver will perform its computations with the original values of the objective and constraints. The default value is True.

Convergence Optional Variant. A number between 0 (zero) and 1 that specifies the convergence tolerance for the GRG Nonlinear Solving and Evolutionary Solving methods. For the GRG method, when the relative change in the target cell value is less than this tolerance for the last five iterations, Solver stops. For the Evolutionary method, when 99% or more of the members of the population have "fitness" values whose relative, that is percentage, difference is less than this tolerance, Solver stops. In both cases, Solver displays the message "Solver converged to the current solution. All constraints are satisfied."

AssumeNonNeg Optional Variant. True to have Solver assume a lower limit of 0 (zero) for all decision variable cells that do not have explicit lower limits in the Constraint list box (the cells must contain nonnegative values). False to have Solver use only the limits specified in the Constraint list box.

PopulationSize Optional Variant. True to have Solver assume a lower limit of 0 (zero) for all decision variable cells that do not have explicit lower limits in the Constraint list box (the cells must contain nonnegative values). False to have Solver use only the limits specified in the Constraint list box.

RandomSeed Optional Variant. A positive integer specifies a fixed seed for the random number generator used by the Evolutionary Solving method and the multistart method for global optimization. This means that Solver will find the same solution each time it is run on a model that has not changed. A zero value specifies that Solver should use a different seed for the random number generator each time it runs, which may yield different solutions each time it is run on a model that has not changed.

MultiStart Optional Variant. True to have Solver use multistart method for global optimization with the GRG Nonlinear Solving method, when SolverSolve is called. False to have Solver run the GRG Solving method only once, without multistart, when SolverSolve is called.

RequireBounds Optional Variant. True to cause the Evolutionary Solving method and the multistart method to return immediately from a call to SolverSolve with a value of 18 if any of the variables do not have both lower and upper bounds defined. False to have these methods attempt to solve the problem without bounds on all of the variables.

MutationRate Optional Variant. A number between 0 (zero) and 1 that specifies the rate at which the Evolutionary Solving method will make "mutations" to existing population members. A higher Mutation rate tends to increase the diversity of the population, and may yield better solutions.

MaxSubproblems Optional Variant. The maximum number of subproblems Solver will explore in problems with integer constraints, and problems solved via the Evolutionary Solving method. The value must be a positive integer.

MaxIntegerSols Optional Variant. The maximum number of feasible (or integer feasible) solutions Solver will consider in problems with integer constraints, and problems solved via the Evolutionary Solving method. The value must be a positive integer.

SolveWithout Optional Variant. True to have Solver ignore any integer constraints and solve the "relaxation" of the problem. False to have Solver use the integer constraints in solving the problem.

MaxTimeNoImp Optional Variant. When the Evolutionary Solving method is used, the maximum amount of time (in seconds) Solver will continue solving without finding significantly improved solutions to add to the population. The value must be a positive integer.

Example

This example sets the Precision option to .001.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions Precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
    MaxMinVal:=1, _
    ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
    Relation:=1, _
    FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=3, _
    FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=4
SolverSolve UserFinish:=False
SolverSave SaveArea:=Range("A33")


SolverReset Function

 Copy code hover
[image]

SolverReset Function
Send feedback

Published: July 16, 2012

Resets all cell selections and constraints in the Solver Parameters dialog box and restores all the settings in the Solver Options dialog box to their defaults. Equivalent to clicking Reset All in the Solver Parameters dialog box. The SolverReset function is called automatically when you call the SolverLoad function, if the Merge argument is False or omitted.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverReset( )

Example

This example resets the Solver settings to their defaults before defining a new problem.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions Precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
 MaxMinVal:=1, _
 ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
 Relation:=1, _
 FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=3, _
 FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=4
SolverSolve UserFinish:=False
SolverSave SaveArea:=Range("A33")


SolverSave Function

 Copy code hover
[image]

SolverSave Function
Send feedback

Published: July 16, 2012

Saves the Solver problem specifications on the worksheet.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverSave(SaveArea)

SaveArea Required Variant. The range of cells where the Solver model is to be saved. If this is a single-cell range, Solver uses as many cells as it needs to save the model, in a column starting with the specified cell. If this is a multi-cell range, Solver uses only cells within that range, even if the model cannot be entirely saved, The range represented by the SaveArea argument can be on any worksheet, but you must specify the worksheet if it is not the active sheet. For example, SolverSave("Sheet2!A1:A3") saves the model on Sheet2 even if Sheet2 is not the active sheet.

Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverSave function saves the current problem to a range on the active worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions Precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
 MaxMinVal:=1, _
 ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
 Relation:=1, _
 FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=3, _
 FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
 Relation:=4
SolverSolve UserFinish:=False
SolverSave SaveArea:=Range("A33")


SolverSolve Function

 Copy code hover
[image]

SolverSolve Function
Send feedback

Published: July 16, 2012

Begins a Solver solution run. Equivalent to clicking Solve in the Solver Parameters dialog box.

Note Note

The Solver add-in is not enabled by default. Before you can use this function, you must have the Solver add-in enabled and installed. For information about how to do that, see Using the Solver VBA Functions. After the Solver add-in is installed, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

SolverSolve(UserFinish, ShowRef)

UserFinish Optional Variant. True to return the results without displaying the Solver Results dialog box. False or omitted to return the results and display the Solver Results dialog box.

ShowRef Optional Variant. You can pass the name of a macro (as a string) as the ShowRef argument. This macro is then called, in lieu of displaying the Show Trial Solution dialog box, whenever Solver pauses for any of the reasons listed below.The ShowRef macro must have the signature Function name (Reason As Integer). The argument Reason is an integer value from 1 to 5:

  1. Function called (on every iteration) because the Show Iteration Results box in the Solver Options dialog box was checked, or function called because the user pressed ESC to interrupt the Solver.

  2. Function called because the Max Time limit in the Solver Options dialog box was exceeded.

  3. Function called because the Iterations limit in the Solver Options dialog box was exceeded.

  4. Function called because the Maximum Subproblems limit in the Solver Options dialog box was exceeded.

  5. Function called because the Maximum Feasible Solutions limit in the Solver Options dialog box was exceeded.

The macro function must return 1 if Solver should stop (same as the Stop button in the Show Trial Solution dialog box), or 0 if Solver should continue running (same as the Continue button).The ShowRef macro can inspect the current solution values on the worksheet, or take other actions such as saving or charting the intermediate values. However, it should not alter the values in the variable cells, or alter the formulas in the objective and constraint cells, as this could adversely affect the solution process.

SolverSolve Return Value

If a Solver problem has not been completely defined, SolverSolve returns the #N/A error value. Otherwise the Solver runs, and SolverSolve returns an integer value corresponding to the message that appears in the Solver Results dialog box:

0 | Solver found a solution. All constraints and optimality conditions are satisfied.
1 | Solver has converged to the current solution. All constraints are satisfied.
2 | Solver cannot improve the current solution. All constraints are satisfied.
3 | Stop chosen when the maximum iteration limit was reached.
4 | The Objective Cell values do not converge.
5 | Solver could not find a feasible solution.
6 | Solver stopped at user's request.
7 | The linearity conditions required by this LP Solver are not satisfied.
8 | The problem is too large for Solver to handle.
9 | Solver encountered an error value in a target or constraint cell.
10 | Stop chosen when the maximum time limit was reached.
11 | There is not enough memory available to solve the problem.
13 | Error in model. Please verify that all cells and constraints are valid.
14 | Solver found an integer solution within tolerance. All constraints are satisfied.
15 | Stop chosen when the maximum number of feasible [integer] solutions was reached.
16 | Stop chosen when the maximum number of feasible [integer] subproblems was reached.
17 | Solver converged in probability to a global solution.
18 | All variables must have both upper and lower bounds.
19 | Variable bounds conflict in binary or alldifferent constraint.
20 | Lower and upper bounds on variables allow no feasible solution.

Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverSolve function begins the Solver solution run. Solver calls the function ShowTrial when any of the five conditions described above occurs; the function simply displays a message with the integer value 1 through 5.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
SolverReset
SolverOptions Precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
    MaxMinVal:=1, _
    ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
    Relation:=1, _
    FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=3, _
    FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=4
SolverSolve UserFinish:=False, ShowRef:= "ShowTrial"
SolverSave SaveArea:=Range("A33")

Function ShowTrial(Reason As Integer)
  Msgbox Reason
  ShowTrial = 0
End Function


Workbooks and Worksheets

 Copy code hover
[image]

Workbooks and Worksheets
Send feedback

Published: July 16, 2012

In this section

  • Opening a Workbook

  • Saving Documents as Web Pages

  • Formatting and VBA Codes for Headers and Footers

  • Returning an Object from a Collection (Excel)


Opening a Workbook

 Copy code hover
[image]

Opening a Workbook
Send feedback

Published: July 16, 2012

When you open a workbook using the Open method, it becomes a member of the Workbooks collection. The following procedure opens a workbook named MyBook.xls located in the folder named MyFolder on drive C.

Copy code Copy code
Sub OpenUp()
 Workbooks.Open("C:\MyFolder\MyBook.xls")
End Sub


Saving Documents as Web Pages

 Copy code hover
[image]

Saving Documents as Web Pages
Send feedback

Published: July 16, 2012

In Microsoft Excel, you can save a workbook, worksheet, chart, range, query table, PivotTable report, print area, or AutoFilter range to a Web page. You can also edit HTML files directly in Excel.

Saving a Document as a Web Page

Saving a document as a Web page is the process of creating and saving an HTML file and any supporting files. To do this, use the SaveAs method, as shown in the following example, which saves the active workbook as C:\Reports\myfile.htm.

Copy code Copy code
ActiveWorkbook.SaveAs _
 Filename:="C:\Reports\myfile.htm", _
 FileFormat:=xlHTML

Customizing the Web Page

You can customize the appearance, content, browser support, editing support, graphics formats, screen resolution, file organization, and encoding of the HTML document by setting properties of the DefaultWebOptions object and the WebOptions object. The DefaultWebOptions object contains application-level properties. These settings are overridden by any workbook-level property settings that have the same names (these are contained in the WebOptions object).

After setting the attributes, you can use the Publish method to save the workbook, worksheet, chart, range, query table, PivotTable report, print area, or AutoFilter range to a Web page. The following example sets various application-level properties and then sets the AllowPNG property of the active workbook, overriding the application-level default setting. Finally, the example saves the range as "C:\Reports\1998_Q1.htm."

Copy code Copy code
With Application.DefaultWebOptions
 .RelyonVML = True
 .AllowPNG = True
 .PixelsPerInch = 96
End With
With ActiveWorkbook
 .WebOptions.AllowPNG = False
 With .PublishObjects(1)
 .FileName = "C:\Reports\1998_Q1.htm"
 .Publish
 End With
End With

You can also save the files directly to a Web server. The following example saves a range to a Web server, giving the Web page the URL address http://example.homepage.com/annualreport.htm.

Copy code Copy code
With ActiveWorkbook
 With .WebOptions
 .RelyonVML = True
 .PixelsPerInch = 96
 End With
 With .PublishObjects(1)
 .FileName = _
 "http://example.homepage.com/annualreport.htm"
 .Publish
 End With
End With

Opening an HTML Document in Microsoft Excel

To edit an HTML document in Excel, first open the document by using the Open method. The following example opens the file "C:\Reports\1997_Q4.htm" for editing.

Copy code Copy code
Workbooks.Open Filename:="C:\Reports\1997_Q4.htm"

After opening the file, you can customize the appearance, content, browser support, editing support, graphics formats, screen resolution, file organization, and encoding of the HTML document by setting properties of the DefaultWebOptions and WebOptions objects.


Formatting and VBA Codes for Headers and Footers

 Copy code hover
[image]

Formatting and VBA Codes for Headers and Footers
Send feedback

Published: July 16, 2012

The following special formatting and Visual Basic for Applications (VBA) codes can be included as a part of the header and footer properties (LeftHeader, CenterHeader, RightHeader, LeftFooter, CenterFooter, and RightFooter).

Format code | Description
&L | Left aligns the characters that follow.
&C | Centers the characters that follow.
&R | Right aligns the characters that follow.
&E | Turns double-underline printing on or off.
&X | Turns superscript printing on or off.
&Y | Turns subscript printing on or off.
&B | Turns bold printing on or off.
&I | Turns italic printing on or off.
&U | Turns underline printing on or off.
&S | Turns strikethrough printing on or off.
&"fontname" | Prints the characters that follow in the specified font. Be sure to include the double quotation marks.
&nn | Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points.
&color | Prints the characters in the specified color. User supplies a hexidecimal color value.
&"+" | Prints the characters that follow in the Heading font of the current theme. Be sure to include the double quotation marks.
&"-" | Prints the characters that follow in the Body font of the current theme. Be sure to include the double quotation marks.
&Kxx.Syyy | Prints the characters that follow in the specified color from the current theme. xx is a two-digit number from 1 to 12 that specifies the theme color to use. Snnn specifies the shade (tint) of that theme color. Specify S as + to produce a lighter shade; specify S as - to produce a darker shade. nnn is a three-digit whole number that specifies a percentage from 0 to 100. If the values that specify the theme color or shade are not within the described limits, Excel will use the nearest valid value.
VBA code | Description
&D | Prints the current date.
&T | Prints the current time.
&F | Prints the name of the document.
&A | Prints the name of the workbook tab.
&P | Prints the page number.
&P+number | Prints the page number plus the specified number.
&P-number | Prints the page number minus the specified number.
&& | Prints a single ampersand.
&N | Prints the total number of pages in the document.
&Z | Prints the file path.
&G | Inserts an image.

Example

The following code shows how formatting and VBA codes can be used to modify the header information and appearance.

VBA Copy code Copy code
Sub Date_Time()
 ActiveSheet.PageSetup.CenterHeader = "&D &B&ITime:&I&B&T"
End Sub


Returning an Object from a Collection (Excel)

 Copy code hover
[image]

Returning an Object from a Collection (Excel)
Send feedback

Published: July 16, 2012

The Item property of a collection returns a single object from that collection. The following example sets the firstBook variable to a Workbook object that represents the first workbook in the Workbooks collection.

VBA Copy code Copy code
Set FirstBook = Workbooks.Item(1)

The Item property is the default property for most collections, so you can write the same statement more concisely by omitting the Item keyword.

VBA Copy code Copy code
Set FirstBook = Workbooks(1)

For more information about a specific collection, see the Help topic for that collection or the Item property for the collection.

Named Objects

Although you can usually specify an integer value with the Item property, it may be more convenient to return an object by name. Before you can use a name with the Item property, you must name the object. Most often, this is done by setting the object's Name property. The following example creates a named worksheet in the active workbook and then refers to the worksheet by name.

VBA Copy code Copy code
ActiveWorkbook.Worksheets.Add.Name = "A New Sheet"
With Worksheets("A New Sheet")
 .Range("A5:A10").Formula = "=RAND()"
End With

Predefined Index Values

Some collections have predefined index values you can use to return single objects. Each predefined index value is represented by a constant. For example, you specify an XlBordersIndex constant with the Item property of the Borders collection to return a single border.

The following example sets the bottom border of cells A1:G1 on Sheet1 to a double line.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A1"). _
 Borders.Item(xlEdgeBottom).LineStyle = xlDouble


Cells and Ranges

 Copy code hover
[image]

Cells and Ranges
Send feedback

Published: July 16, 2012

In this section

  • Looping Through a Range of Cells

  • Selecting and Activating Cells

  • Working with 3-D Ranges

  • Working with the Active Cell

  • Cell Error Values


Looping Through a Range of Cells

 Copy code hover
[image]

Looping Through a Range of Cells
Send feedback

Published: July 16, 2012

When using Visual Basic, you often need to run the same block of statements on each cell in a range of cells. To do this, you combine a looping statement and one or more methods to identify each cell, one at a time, and run the operation.

One way to loop through a range is to use the For...Next loop with the Cells property. Using the Cells property, you can substitute the loop counter (or other variables or expressions) for the cell index numbers. In the following example, the variable counter is substituted for the row index. The procedure loops through the range C1:C20, setting to 0 (zero) any number whose absolute value is less than 0.01.

Copy code Copy code
Sub RoundToZero1()
 For Counter = 1 To 20
 Set curCell = Worksheets("Sheet1").Cells(Counter, 3)
 If Abs(curCell.Value) < 0.01 Then curCell.Value = 0
 Next Counter
End Sub

Another easy way to loop through a range is to use a For Each...Next loop with the collection of cells specified in the Range property. Visual Basic automatically sets an object variable for the next cell each time the loop runs. The following procedure loops through the range A1:D10, setting to 0 (zero) any number whose absolute value is less than 0.01.

Copy code Copy code
Sub RoundToZero2()
 For Each c In Worksheets("Sheet1").Range("A1:D10").Cells
 If Abs(c.Value) < 0.01 Then c.Value = 0
 Next
End Sub

If you do not know the boundaries of the range you want to loop through, you can use the CurrentRegion property to return the range that surrounds the active cell. For example, the following procedure, when run from a worksheet, loops through the range that surrounds the active cell, setting to 0 (zero) any number whose absolute value is less than 0.01.

Copy code Copy code
Sub RoundToZero3()
 For Each c In ActiveCell.CurrentRegion.Cells
 If Abs(c.Value) < 0.01 Then c.Value = 0
 Next
End Sub


Selecting and Activating Cells

 Copy code hover
[image]

Selecting and Activating Cells
Send feedback

Published: July 16, 2012

In Microsoft Excel, you usually select a cell or cells and then perform an action, such as formatting the cells or entering values in them. In Visual Basic, it is usually not necessary to select cells before modifying them.

For example, to enter a formula in cell D6 using Visual Basic, you do not need to select the range D6. Just return the Range object for that cell, and then set the Formula property to the formula you want, as shown in the following example.

Visual Basic Copy code Copy code
Sub EnterFormula()
    Worksheets("Sheet1").Range("D6").Formula = "=SUM(D2:D5)"
End Sub

For more information and examples of using other methods to control cells without selecting them, see How to: Reference Cells and Ranges.

Using the Select Method and the Selection Property

The Select method activates sheets and objects on sheets; the Selection property returns an object that represents the current selection on the active sheet in the active workbook. Before you can use the Selection property successfully, you must activate a workbook, activate or select a sheet, and then select a range (or other object) using the Select method.

The macro recorder will often create a macro that uses the Select method and the Selection property. The following Sub procedure was created using the macro recorder, and it shows how Select and Selection work together.

Visual Basic Copy code Copy code
Sub Macro1()
    Sheets("Sheet1").Select
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Name"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Address"
    Range("A1:B1").Select
    Selection.Font.Bold = True
End Sub

The following example performs the same task without activating or selecting the worksheet or cells.

Visual Basic Copy code Copy code
Sub Labels()
    With Worksheets("Sheet1")
        .Range("A1") = "Name"
        .Range("B1") = "Address"
        .Range("A1:B1").Font.Bold = True
    End With
End Sub

Selecting Cells on the Active Worksheet

If you use the Select method to select cells, be aware that Select works only on the active worksheet. If you run your Sub procedure from the module, the Select method will fail unless your procedure activates the worksheet before using the Select method on a range of cells. For example, the following procedure copies a row from Sheet1 to Sheet2 in the active workbook.

Visual Basic Copy code Copy code
Sub CopyRow()
    Worksheets("Sheet1").Rows(1).Copy
    Worksheets("Sheet2").Select
    Worksheets("Sheet2").Rows(1).Select
    Worksheets("Sheet2").Paste
End Sub

Activating a Cell Within a Selection

You can use the Activate method to activate a cell within a selection. There can be only one active cell, even when a range of cells is selected. The following procedure selects a range and then activates a cell within the range without changing the selection.

Visual Basic Copy code Copy code
Sub MakeActive()
    Worksheets("Sheet1").Activate
    Range("A1:D4").Select
    Range("B2").Activate
End Sub


Working with 3-D Ranges

 Copy code hover
[image]

Working with 3-D Ranges
Send feedback

Published: July 16, 2012

If you are working with the same range on more than one sheet, use the Array function to specify two or more sheets to select. The following example formats the border of a 3-D range of cells.

VBA Copy code Copy code
Sub FormatSheets()
 Sheets(Array("Sheet2", "Sheet3", "Sheet5")).Select
 Range("A1:H1").Select
 Selection.Borders(xlBottom).LineStyle = xlDouble
End Sub

The following example applies the FillAcrossSheets method to transfer the formats and any data from the range on Sheet2 to the corresponding ranges on all the worksheets in the active workbook.

VBA Copy code Copy code
Sub FillAll()
 Worksheets("Sheet2").Range("A1:H1") _
 .Borders(xlBottom).LineStyle = xlDouble
 Worksheets.FillAcrossSheets (Worksheets("Sheet2") _
 .Range("A1:H1"))
End Sub


Working with the Active Cell

 Copy code hover
[image]

Working with the Active Cell
Send feedback

Published: July 16, 2012

The ActiveCell property returns a Range object that represents the cell that is active. You can apply any of the properties or methods of a Range object to the active cell, as in the following example.

VBA Copy code Copy code
Sub SetValue()
 Worksheets("Sheet1").Activate
 ActiveCell.Value = 35
End Sub
Note Note

You can work with the active cell only when the worksheet that it is on is the active sheet.

Moving the Active Cell

You can use the Activate method to designate which cell is the active cell. For example, the following procedure makes B5 the active cell and then formats it as bold.

VBA Copy code Copy code
Sub SetActive()
 Worksheets("Sheet1").Activate
 Worksheets("Sheet1").Range("B5").Activate
 ActiveCell.Font.Bold = True
End Sub
Note Note

To select a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

You can use the Offset property to move the active cell. The following procedure inserts text into the active cell in the selected range and then moves the active cell one cell to the right without changing the selection.

VBA Copy code Copy code
Sub MoveActive()
 Worksheets("Sheet1").Activate
 Range("A1:D10").Select
 ActiveCell.Value = "Monthly Totals"
 ActiveCell.Offset(0, 1).Activate
End Sub

Selecting the Cells Surrounding the Active Cell

The CurrentRegion property returns a range of cells bounded by blank rows and columns. In the following example, the selection is expanded to include the cells adjoining the active cell that contain data. This range is then formatted with the Currency style.

VBA Copy code Copy code
Sub Region()
 Worksheets("Sheet1").Activate
 ActiveCell.CurrentRegion.Select
 Selection.Style = "Currency"
End Sub


Cell Error Values

 Copy code hover
[image]

Cell Error Values
Send feedback

Published: July 16, 2012

You can insert a cell error value into a cell or test the value of a cell for an error value by using the CVErr function. The cell error values can be one of the following XlCVError constants.

Constant | Error number | Cell error value
xlErrDiv0 | 2007 | #DIV/0!
xlErrNA | 2042 | #N/A
xlErrName | 2029 | #NAME?
xlErrNull | 2000 | #NULL!
xlErrNum | 2036 | #NUM!
xlErrRef | 2023 | #REF!
xlErrValue | 2015 | #VALUE!

Example

This example inserts the seven cell error values into cells A1:A7 on Sheet1.

Copy code Copy code
myArray = Array(xlErrDiv0, xlErrNA, xlErrName, xlErrNull, _
 xlErrNum, xlErrRef, xlErrValue)
For i = 1 To 7
 Worksheets("Sheet1").Cells(i, 1).Value = CVErr(myArray(i - 1))
Next i

This example displays a message if the active cell on Sheet1 contains a cell error value. You can use this example as a framework for a cell-error-value error handler.

Copy code Copy code
Worksheets("Sheet1").Activate
If IsError(ActiveCell.Value) Then
 errval = ActiveCell.Value
 Select Case errval
 Case CVErr(xlErrDiv0)
 MsgBox "#DIV/0! error"
 Case CVErr(xlErrNA)
 MsgBox "#N/A error"
 Case CVErr(xlErrName)
 MsgBox "#NAME? error"
 Case CVErr(xlErrNull)
 MsgBox "#NULL! error"
 Case CVErr(xlErrNum)
 MsgBox "#NUM! error"
 Case CVErr(xlErrRef)
 MsgBox "#REF! error"
 Case CVErr(xlErrValue)
 MsgBox "#VALUE! error"
 Case Else
 MsgBox "This should never happen!!"
 End Select
End If


Controls, Dialog Boxes, and Forms

 Copy code hover
[image]

Controls, Dialog Boxes, and Forms
Send feedback

Published: July 16, 2012

In this section

  • ActiveX Controls

  • Using ActiveX Controls on Sheets

  • Using ActiveX Controls on a Document

  • Built-In Dialog Box Argument Lists

  • Using Control Values While Code Is Running

  • Displaying a Custom Dialog Box

  • Initializing Control Properties

  • Setting Control Properties


ActiveX Controls

 Copy code hover
[image]

ActiveX Controls
Send feedback

Published: July 16, 2012

For more information about a specific control, select an object from the following list.

CheckBox
ComboBox
CommandButton
Image
Label
ListBox

OptionButton
ScrollBar
SpinButton
TextBox
ToggleButton


Using ActiveX Controls on Sheets

 Copy code hover
[image]

Using ActiveX Controls on Sheets
Send feedback

Published: July 16, 2012

This topic covers specific information about using ActiveX controls on worksheets and chart sheets. For general information on adding and working with controls, see Using ActiveX Controls on a Document and Creating a Custom Dialog Box.

Keep the following points in mind when you are working with controls on sheets:

  • In addition to the standard properties available for ActiveX controls, the following properties can be used with ActiveX controls in Microsoft Excel: BottomRightCell, LinkedCell, ListFillRange, Placement, PrintObject, TopLeftCell, and ZOrder.

    These properties can be set and returned using the ActiveX control name. The following example scrolls the workbook window so CommandButton1 is in the upper-left corner.

    Copy code Copy code
    Set t = Sheet1.CommandButton1.TopLeftCell
With ActiveWindow
    .ScrollRow = t.Row
    .ScrollColumn = t.Column
End With

  • Some Microsoft Excel Visual Basic methods and properties are disabled when an ActiveX control is activated. For example, the Sort method cannot be used when a control is active, so the following code fails in a button click event procedure (because the control is still active after the user clicks it).

    Copy code Copy code
    Private Sub CommandButton1.Click
    Range("a1:a10").Sort Key1:=Range("a1")
End Sub

    You can work around this problem by activating some other element on the sheet before you use the property or method that failed. For example, the following code sorts the range:

    Copy code Copy code
    Private Sub CommandButton1.Click
    Range("a1").Activate
    Range("a1:a10").Sort Key1:=Range("a1")
    CommandButton1.Activate
End Sub

  • Controls on a Microsoft Excel workbook embedded in a document in another application will not work if the user double-clicks the workbook to edit it. The controls will work if the user right-clicks the workbook and selects the Open command from the shortcut menu.

  • When a Microsoft Excel workbook is saved using the Microsoft Excel 5.0/95 Workbook file format, ActiveX control information is lost.

  • The Me keyword in an event procedure for an ActiveX control on a sheet refers to the sheet, not to the control.

Adding Controls with Visual Basic

In Microsoft Excel, ActiveX controls are represented by OLEObject objects in the OLEObjects collection (all OLEObject objects are also in the Shapes collection). To programmatically add an ActiveX control to a sheet, use the Add method of the OLEObjects collection. The following example adds a command button to worksheet 1.

VBA Copy code Copy code
Worksheets(1).OLEObjects.Add "Forms.CommandButton.1", _
    Left:=10, Top:=10, Height:=20, Width:=100

Using Control Properties with Visual Basic

Most often, your Visual Basic code will refer to ActiveX controls by name. The following example changes the caption on the control named "CommandButton1."

VBA Copy code Copy code
Sheet1.CommandButton1.Caption = "Run"

Note that when you use a control name outside the class module for the sheet containing the control, you must qualify the control name with the sheet name.

To change the control name you use in Visual Basic code, select the control and set the (Name) property in the Properties window.

Because ActiveX controls are also represented by OLEObject objects in the OLEObjects collection, you can set control properties using the objects in the collection. The following example sets the left position of the control named "CommandButton1."

VBA Copy code Copy code
Worksheets(1).OLEObjects("CommandButton1").Left = 10

Control properties that are not shown as properties of the OLEObject object can be set by returning the actual control object using the Object property. The following example sets the caption for CommandButton1.

VBA Copy code Copy code
Worksheets(1).OLEObjects("CommandButton1"). _
    Object.Caption = "run me"

Because all OLE objects are also members of the Shapes collection, you can use the collection to set properties for several controls. The following example aligns the left edge of all controls on worksheet 1.

VBA Copy code Copy code
For Each s In Worksheets(1).Shapes
    If s.Type = msoOLEControlObject Then s.Left = 10
Next

Using Control Names with the Shapes and OLEObjects Collections

An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the Name box when you view the sheet, and the code name for the control, which you can see in the cell to the right of (Name) in the Properties window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other is not automatically changed to match.

You use the code name of a control in the names of its event procedures. However, when you return a control from the Shapes or OLEObjects collection for a sheet, you must use the shape name, not the code name, to refer to the control by name. For example, assume that you add a check box to a sheet and that both the default shape name and the default code name are CheckBox1. If you then change the control code name by typing chkFinished next to (Name) in the Properties window, you must use chkFinished in event procedure names, but you still have to use CheckBox1 to return the control from the Shapes or OLEObject collection, as shown in the following example.

VBA Copy code Copy code
Private Sub chkFinished_Click()
    ActiveSheet.OLEObjects("CheckBox1").Object.Value = 1
End Sub


Using ActiveX Controls on a Document

 Copy code hover
[image]

Using ActiveX Controls on a Document
Send feedback

Published: July 16, 2012

Just as you can add ActiveX controls to custom dialog boxes, you can add controls directly to a document when you want to provide a sophisticated way for the user to interact directly with your macro without the distraction of dialog boxes. Use the following procedure to add ActiveX controls to your document. For more specific information about using ActiveX controls in Microsoft Excel, see Using ActiveX Controls on Sheets.

  1. Add Controls to a Document

    Display the Control Toolbox, click the control you want to add, and then click the document.

  2. Set control properties

    Right-click a control in design mode and click Properties to display the Properties window.

  3. Initialize the controls

    You can initialize controls in a procedure.

  4. Write event procedures

    All controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button. You can write event procedures that run when the events occur.

  5. Use control values while code is running

    Some properties can be set at run time.


Built-In Dialog Box Argument Lists

 Copy code hover
[image]

Built-In Dialog Box Argument Lists
Send feedback

Published: July 16, 2012

Dialog box constant | Argument list(s)
xlDialogActivate | window_text, pane_num
xlDialogActiveCellFont | font, font_style, size, strikethrough, superscript, subscript, outline, shadow, underline, color, normal, background, start_char, char_count
xlDialogAddChartAutoformat | name_text, desc_text
xlDialogAddinManager | operation_num, addinname_text, copy_logical
xlDialogAlignment | horiz_align, wrap, vert_align, orientation, add_indent
xlDialogApplyNames | name_array, ignore, use_rowcol, omit_col, omit_row, order_num, append_last
xlDialogApplyStyle | style_text
xlDialogAppMove | x_num, y_num
xlDialogAppSize | x_num, y_num
xlDialogArrangeAll | arrange_num, active_doc, sync_horiz, sync_vert
xlDialogAssignToObject | macro_ref
xlDialogAssignToTool | bar_id, position, macro_ref
xlDialogAttachText | attach_to_num, series_num, point_num
xlDialogAttachToolbars |
xlDialogAutoCorrect | correct_initial_caps, capitalize_days
xlDialogAxes | x_primary, y_primary, x_secondary, y_secondary
xlDialogAxes | x_primary, y_primary, z_primary
xlDialogBorder | outline, left, right, top, bottom, shade, outline_color, left_color, right_color, top_color, bottom_color
xlDialogCalculation | type_num, iter, max_num, max_change, update, precision, date_1904, calc_save, save_values, alt_exp, alt_form
xlDialogCellProtection | locked, hidden
xlDialogChangeLink | old_text, new_text, type_of_link
xlDialogChartAddData | ref, rowcol, titles, categories, replace, series
xlDialogChartLocation |
xlDialogChartOptionsDataLabels |
xlDialogChartOptionsDataTable |
xlDialogChartSourceData |
xlDialogChartTrend | type, ord_per, forecast, backcast, intercept, equation, r_squared, name
xlDialogChartType |
xlDialogChartWizard | long, ref, gallery_num, type_num, plot_by, categories, ser_titles, legend, title, x_title, y_title, z_title, number_cats, number_titles
xlDialogCheckboxProperties | value, link, accel_text, accel2_text, 3d_shading
xlDialogClear | type_num
xlDialogColorPalette | file_text
xlDialogColumnWidth | width_num, reference, standard, type_num, standard_num
xlDialogCombination | type_num
xlDialogConditionalFormatting |
xlDialogConsolidate | source_refs, function_num, top_row, left_col, create_links
xlDialogCopyChart | size_num
xlDialogCopyPicture | appearance_num, size_num, type_num
xlDialogCreateNames | top, left, bottom, right
xlDialogCreatePublisher | file_text, appearance, size, formats
xlDialogCustomizeToolbar | category
xlDialogCustomViews |
xlDialogDataDelete |
xlDialogDataLabel | show_option, auto_text, show_key
xlDialogDataSeries | rowcol, type_num, date_num, step_value, stop_value, trend
xlDialogDataValidation |
xlDialogDefineName | name_text, refers_to, macro_type, shortcut_text, hidden, category, local
xlDialogDefineStyle | style_text, number, font, alignment, border, pattern, protection
xlDialogDefineStyle | style_text, attribute_num, additional_def_args, ...
xlDialogDeleteFormat | format_text
xlDialogDeleteName | name_text
xlDialogDemote | row_col
xlDialogDisplay | formulas, gridlines, headings, zeros, color_num, reserved, outline, page_breaks, object_num
xlDialogDisplay | cell, formula, value, format, protection, names, precedents, dependents, note
xlDialogEditboxProperties | validation_num, multiline_logical, vscroll_logical, password_logical
xlDialogEditColor | color_num, red_value, green_value, blue_value
xlDialogEditDelete | shift_num
xlDialogEditionOptions | edition_type, edition_name, reference, option, appearance, size, formats
xlDialogEditSeries | series_num, name_ref, x_ref, y_ref, z_ref, plot_order
xlDialogErrorbarX | include, type, amount, minus
xlDialogErrorbarY | include, type, amount, minus
xlDialogExternalDataProperties |
xlDialogExtract | unique
xlDialogFileDelete | file_text
xlDialogFileSharing |
xlDialogFillGroup | type_num
xlDialogFillWorkgroup | type_num
xlDialogFilter |
xlDialogFilterAdvanced | operation, list_ref, criteria_ref, copy_ref, unique
xlDialogFindFile |
xlDialogFont | name_text, size_num
xlDialogFontProperties | font, font_style, size, strikethrough, superscript, subscript, outline, shadow, underline, color, normal, background, start_char, char_count
xlDialogFormatAuto | format_num, number, font, alignment, border, pattern, width
xlDialogFormatChart | layer_num, view, overlap, angle, gap_width, gap_depth, chart_depth, doughnut_size, axis_num, drop, hilo, up_down, series_line, labels, vary
xlDialogFormatCharttype | apply_to, group_num, dimension, type_num
xlDialogFormatFont | color, backgd, apply, name_text, size_num, bold, italic, underline, strike, outline, shadow, object_id, start_num, char_num
xlDialogFormatFont | name_text, size_num, bold, italic, underline, strike, color, outline, shadow
xlDialogFormatFont | name_text, size_num, bold, italic, underline, strike, color, outline, shadow, object_id_text, start_num, char_num
xlDialogFormatLegend | position_num
xlDialogFormatMain | type_num, view, overlap, gap_width, vary, drop, hilo, angle, gap_depth, chart_depth, up_down, series_line, labels, doughnut_size
xlDialogFormatMove | x_offset, y_offset, reference
xlDialogFormatMove | x_pos, y_pos
xlDialogFormatMove | explosion_num
xlDialogFormatNumber | format_text
xlDialogFormatOverlay | type_num, view, overlap, gap_width, vary, drop, hilo, angle, series_dist, series_num, up_down, series_line, labels, doughnut_size
xlDialogFormatSize | width, height
xlDialogFormatSize | x_off, y_off, reference
xlDialogFormatText | x_align, y_align, orient_num, auto_text, auto_size, show_key, show_value, add_indent
xlDialogFormulaFind | text, in_num, at_num, by_num, dir_num, match_case, match_byte
xlDialogFormulaGoto | reference, corner
xlDialogFormulaReplace | find_text, replace_text, look_at, look_by, active_cell, match_case, match_byte
xlDialogFunctionWizard |
xlDialogGallery3dArea | type_num
xlDialogGallery3dBar | type_num
xlDialogGallery3dColumn | type_num
xlDialogGallery3dLine | type_num
xlDialogGallery3dPie | type_num
xlDialogGallery3dSurface | type_num
xlDialogGalleryArea | type_num, delete_overlay
xlDialogGalleryBar | type_num, delete_overlay
xlDialogGalleryColumn | type_num, delete_overlay
xlDialogGalleryCustom | name_text
xlDialogGalleryDoughnut | type_num, delete_overlay
xlDialogGalleryLine | type_num, delete_overlay
xlDialogGalleryPie | type_num, delete_overlay
xlDialogGalleryRadar | type_num, delete_overlay
xlDialogGalleryScatter | type_num, delete_overlay
xlDialogGoalSeek | target_cell, target_value, variable_cell
xlDialogGridlines | x_major, x_minor, y_major, y_minor, z_major, z_minor, 2D_effect
xlDialogImportTextFile |
xlDialogInsert | shift_num
xlDialogInsertHyperlink |
xlDialogInsertNameLabel |
xlDialogInsertObject | object_class, file_name, link_logical, display_icon_logical, icon_file, icon_number, icon_label
xlDialogInsertPicture | file_name, filter_number
xlDialogInsertTitle | chart, y_primary, x_primary, y_secondary, x_secondary
xlDialogLabelProperties | accel_text, accel2_text, 3d_shading
xlDialogListboxProperties | range, link, drop_size, multi_select, 3d_shading
xlDialogMacroOptions | macro_name, description, menu_on, menu_text, shortcut_on, shortcut_key, function_category, status_bar_text, help_id, help_file
xlDialogMailEditMailer | to_recipients, cc_recipients, bcc_recipients, subject, enclosures, which_address
xlDialogMailLogon | name_text, password_text, download_logical
xlDialogMailNextLetter |
xlDialogMainChart | type_num, stack, 100, vary, overlap, drop, hilo, overlap%, cluster, angle
xlDialogMainChartType | type_num
xlDialogMenuEditor |
xlDialogMove | x_pos, y_pos, window_text
xlDialogNew | type_num, xy_series, add_logical
xlDialogNewWebQuery |
xlDialogNote | add_text, cell_ref, start_char, num_chars
xlDialogObjectProperties | placement_type, print_object
xlDialogObjectProtection | locked, lock_text
xlDialogOpen | file_text, update_links, read_only, format, prot_pwd, write_res_pwd, ignore_rorec, file_origin, custom_delimit, add_logical, editable, file_access, notify_logical, converter
xlDialogOpenLinks | document_text1, document_text2, ..., read_only, type_of_link
xlDialogOpenMail | subject, comments
xlDialogOpenText | file_name, file_origin, start_row, file_type, text_qualifier, consecutive_delim, tab, semicolon, comma, space, other, other_char, field_info
xlDialogOptionsCalculation | type_num, iter, max_num, max_change, update, precision, date_1904, calc_save, save_values
xlDialogOptionsChart | display_blanks, plot_visible, size_with_window
xlDialogOptionsEdit | incell_edit, drag_drop, alert, entermove, fixed, decimals, copy_objects, update_links, move_direction, autocomplete, animations
xlDialogOptionsGeneral | R1C1_mode, dde_on, sum_info, tips, recent_files, old_menus, user_info, font_name, font_size, default_location, alternate_location, sheet_num, enable_under
xlDialogOptionsListsAdd | string_array
xlDialogOptionsListsAdd | import_ref, by_row
xlDialogOptionsME | def_rtl_sheet, crsr_mvmt, show_ctrl_char, gui_lang
xlDialogOptionsTransition | menu_key, menu_key_action, nav_keys, trans_eval, trans_entry
xlDialogOptionsView | formula, status, notes, show_info, object_num, page_breaks, formulas, gridlines, color_num, headers, outline, zeros, hor_scroll, vert_scroll, sheet_tabs
xlDialogOutline | auto_styles, row_dir, col_dir, create_apply
xlDialogOverlay | type_num, stack, 100, vary, overlap, drop, hilo, overlap%, cluster, angle, series_num, auto
xlDialogOverlayChartType | type_num
xlDialogPageSetup | head, foot, left, right, top, bot, hdng, grid, h_cntr, v_cntr, orient, paper_size, scale, pg_num, pg_order, bw_cells, quality, head_margin, foot_margin, notes, draft
xlDialogPageSetup | head, foot, left, right, top, bot, size, h_cntr, v_cntr, orient, paper_size, scale, pg_num, bw_chart, quality, head_margin, foot_margin, draft
xlDialogPageSetup | head, foot, left, right, top, bot, orient, paper_size, scale, quality, head_margin, foot_margin, pg_num
xlDialogParse | parse_text, destination_ref
xlDialogPasteNames |
xlDialogPasteSpecial | paste_num, operation_num, skip_blanks, transpose
xlDialogPasteSpecial | rowcol, titles, categories, replace, series
xlDialogPasteSpecial | paste_num
xlDialogPasteSpecial | format_text, pastelink_logical, display_icon_logical, icon_file, icon_number, icon_label
xlDialogPatterns | apattern, afore, aback, newui
xlDialogPatterns | lauto, lstyle, lcolor, lwt, hwidth, hlength, htype
xlDialogPatterns | bauto, bstyle, bcolor, bwt, shadow, aauto, apattern, afore, aback, rounded, newui
xlDialogPatterns | bauto, bstyle, bcolor, bwt, shadow, aauto, apattern, afore, aback, invert, apply, newfill
xlDialogPatterns | lauto, lstyle, lcolor, lwt, tmajor, tminor, tlabel
xlDialogPatterns | lauto, lstyle, lcolor, lwt, apply, smooth
xlDialogPatterns | lauto, lstyle, lcolor, lwt, mauto, mstyle, mfore, mback, apply, smooth
xlDialogPatterns | type, picture_units, apply
xlDialogPhonetic |
xlDialogPivotCalculatedField |
xlDialogPivotCalculatedItem |
xlDialogPivotClientServerSet |
xlDialogPivotFieldGroup | start, end, by, periods
xlDialogPivotFieldProperties | name, pivot_field_name, new_name, orientation, function, formats
xlDialogPivotFieldUngroup |
xlDialogPivotShowPages | name, page_field
xlDialogPivotSolveOrder |
xlDialogPivotTableOptions |
xlDialogPivotTableWizard | type, source, destination, name, row_grand, col_grand, save_data, apply_auto_format, auto_page, reserved
xlDialogPlacement | placement_type
xlDialogPrint | range_num, from, to, copies, draft, preview, print_what, color, feed, quality, y_resolution, selection, printer_text, print_to_file, collate
xlDialogPrinterSetup | printer_text
xlDialogPrintPreview |
xlDialogPromote | rowcol
xlDialogProperties | title, subject, author, keywords, comments
xlDialogProtectDocument | contents, windows, password, objects, scenarios
xlDialogProtectSharing |
xlDialogPublishAsWebPage |
xlDialogPushbuttonProperties | default_logical, cancel_logical, dismiss_logical, help_logical, accel_text, accel_text2
xlDialogReplaceFont | font_num, name_text, size_num, bold, italic, underline, strike, color, outline, shadow
xlDialogRoutingSlip | recipients, subject, message, route_num, return_logical, status_logical
xlDialogRowHeight | height_num, reference, standard_height, type_num
xlDialogRun | reference, step
xlDialogSaveAs | document_text, type_num, prot_pwd, backup, write_res_pwd, read_only_rec
xlDialogSaveCopyAs | document_text
xlDialogSaveNewObject |
xlDialogSaveWorkbook | document_text, type_num, prot_pwd, backup, write_res_pwd, read_only_rec
xlDialogSaveWorkspace | name_text
xlDialogScale | cross, cat_labels, cat_marks, between, max, reverse
xlDialogScale | min_num, max_num, major, minor, cross, logarithmic, reverse, max
xlDialogScale | cat_labels, cat_marks, reverse, between
xlDialogScale | series_labels, series_marks, reverse
xlDialogScale | min_num, max_num, major, minor, cross, logarithmic, reverse, min
xlDialogScenarioAdd | scen_name, value_array, changing_ref, scen_comment, locked, hidden
xlDialogScenarioCells | changing_ref
xlDialogScenarioEdit | scen_name, new_scenname, value_array, changing_ref, scen_comment, locked, hidden
xlDialogScenarioMerge | source_file
xlDialogScenarioSummary | result_ref, report_type
xlDialogScrollbarProperties | value, min, max, inc, page, link, 3d_shading
xlDialogSelectSpecial | type_num, value_type, levels
xlDialogSendMail | recipients, subject, return_receipt
xlDialogSeriesAxes | axis_num
xlDialogSeriesOptions |
xlDialogSeriesOrder | chart_num, old_series_num, new_series_num
xlDialogSeriesShape |
xlDialogSeriesX | x_ref
xlDialogSeriesY | name_ref, y_ref
xlDialogSetBackgroundPicture |
xlDialogSetPrintTitles | titles_for_cols_ref, titles_for_rows_ref
xlDialogSetUpdateStatus | link_text, status, type_of_link
xlDialogShowDetail | rowcol, rowcol_num, expand, show_field
xlDialogShowToolbar | bar_id, visible, dock, x_pos, y_pos, width, protect, tool_tips, large_buttons, color_buttons
xlDialogSize | width, height, window_text
xlDialogSort | orientation, key1, order1, key2, order2, key3, order3, header, custom, case
xlDialogSort | orientation, key1, order1, type, custom
xlDialogSortSpecial | sort_by, method, key1, order1, key2, order2, key3, order3, header, order, case
xlDialogSplit | col_split, row_split
xlDialogStandardFont | name_text, size_num, bold, italic, underline, strike, color, outline, shadow
xlDialogStandardWidth | standard_num
xlDialogStyle | bold, italic
xlDialogSubscribeTo | file_text, format_num
xlDialogSubtotalCreate | at_change_in, function_num, total, replace, pagebreaks, summary_below
xlDialogSummaryInfo | title, subject, author, keywords, comments
xlDialogTable | row_ref, column_ref
xlDialogTabOrder |
xlDialogTextToColumns | destination_ref, data_type, text_delim, consecutive_delim, tab, semicolon, comma, space, other, other_char, field_info
xlDialogUnhide | window_text
xlDialogUpdateLink | link_text, type_of_link
xlDialogVbaInsertFile | filename_text
xlDialogVbaMakeAddIn |
xlDialogVbaProcedureDefinition |
xlDialogView3d | elevation, perspective, rotation, axes, height%, autoscale
xlDialogWebOptionsEncoding |
xlDialogWebOptionsFiles |
xlDialogWebOptionsFonts |
xlDialogWebOptionsGeneral |
xlDialogWebOptionsPictures |
xlDialogWindowMove | x_pos, y_pos, window_text
xlDialogWindowSize | width, height, window_text
xlDialogWorkbookAdd | name_array, dest_book, position_num
xlDialogWorkbookCopy | name_array, dest_book, position_num
xlDialogWorkbookInsert | type_num
xlDialogWorkbookMove | name_array, dest_book, position_num
xlDialogWorkbookName | oldname_text, newname_text
xlDialogWorkbookNew |
xlDialogWorkbookOptions | sheet_name, bound_logical, new_name
xlDialogWorkbookProtect | structure, windows, password
xlDialogWorkbookTabSplit | ratio_num
xlDialogWorkbookUnhide | sheet_text
xlDialogWorkgroup | name_array
xlDialogWorkspace | fixed, decimals, r1c1, scroll, status, formula, menu_key, remote, entermove, underlines, tools, notes, nav_keys, menu_key_action, drag_drop, show_info
xlDialogZoom | magnification


Using Control Values While Code Is Running

 Copy code hover
[image]

Using Control Values While Code Is Running
Send feedback

Published: July 16, 2012

Some controls properties can be set and returned while Visual Basic code is running. The following example sets the Text property of a text box to "Hello."

VBA Copy code Copy code
TextBox1.Text = "Hello"

The data entered on a form by a user is lost when the form is closed. If you return the values of controls on a form after the form has been unloaded, you get the initial values for the controls rather than the values the user entered.

If you want to save the data entered on a form, you can save the information to module-level variables while the form is still running. The following example displays a form and saves the form data.

VBA Copy code Copy code
' Code in module to declare public variables.
Public strRegion As String
Public intSalesPersonID As Integer
Public blnCancelled As Boolean

' Code in form.
Private Sub cmdCancel_Click()
 Module1.blnCancelled = True
 Unload Me
End Sub

Private Sub cmdOK_Click()
 ' Save data.
 intSalesPersonID = txtSalesPersonID.Text
 strRegion = lstRegions.List(lstRegions.ListIndex)
 Module1.blnCancelled = False
 Unload Me
End Sub

Private Sub UserForm_Initialize()
 Module1.blnCancelled = True
End Sub

' Code in module to display form.
Sub LaunchSalesPersonForm()
 frmSalesPeople.Show
 If blnCancelled = True Then
 MsgBox "Operation Cancelled!", vbExclamation
 Else
 MsgBox "The Salesperson's ID is: " &
 intSalesPersonID & _
 "The Region is: " & strRegion
 End If
End Sub


Displaying a Custom Dialog Box

 Copy code hover
[image]

Displaying a Custom Dialog Box
Send feedback

Published: July 16, 2012

To test your dialog box in the Visual Basic Editor, click Run Sub/UserForm on the Run menu in the Visual Basic Editor.

To display a dialog box from Visual Basic, use the Show method. The following example displays the dialog box named UserForm1.

Copy code Copy code
Private Sub GetUserName()
 UserForm1.Show
End Sub


Initializing Control Properties

 Copy code hover
[image]

Initializing Control Properties
Send feedback

Published: July 16, 2012

You can initialize controls at run time by using Visual Basic code in a macro. For example, you could fill a list box, set text values, or set option buttons.

The following example uses the AddItem method to add data to a list box. Then it sets the value of a text box and displays the form.

Copy code Copy code
Private Sub GetUserName()
 With UserForm1
 .lstRegions.AddItem "North"
 .lstRegions.AddItem "South"
 .lstRegions.AddItem "East"
 .lstRegions.AddItem "West"
 .txtSalesPersonID.Text = "00000"
 .Show
 ' ...
 End With
End Sub

You can also use code in the Initialize event of a form to set initial values for controls on the form. An advantage to setting initial control values in the Initialize event is that the initialization code stays with the form. You can copy the form to another project, and when you run the Show method to display the dialog box, the controls will be initialized.

Copy code Copy code
Private Sub UserForm_Initialize()
 UserForm1.lstNames.AddItem "Test One"
 UserForm1.lstNames.AddItem "Test Two"
 UserForm1.txtUserName.Text = "Default Name"
End Sub


Setting Control Properties

 Copy code hover
[image]

Setting Control Properties
Send feedback

Published: July 16, 2012

You can set some controls properties at design time (before any macro is running). In design mode, right-click a control and click Properties to display the Properties window. Property names are shown in the left column in the window, and property values are shown in the right column. You set a property value by entering the new value to the right of the property name.


Events, Worksheet Functions, and Shapes

 Copy code hover
[image]

Events, Worksheet Functions, and Shapes
Send feedback

Published: July 16, 2012

In this section

  • Chart Object Events

  • Control and Dialog Box Events

  • QueryTable Object Events

  • Worksheet Object Events

  • Using Events with Excel Objects

  • Using Excel Worksheet Functions in Visual Basic

  • Working with Shapes (Drawing Objects)

  • List of Worksheet Functions Available to Visual Basic

  • List of Worksheet Functions that Support Long Strings

  • Using Events with Embedded Charts

  • Using Events with the Application Object

  • Using Events with the QueryTable Object

  • Invalid Procedure Name Error


Chart Object Events

 Copy code hover
[image]

Chart Object Events
Send feedback

Published: July 16, 2012

Chart events occur when the user activates or changes a chart. Events on chart sheets are enabled by default. To view the event procedures for a sheet, right-click the sheet tab and select View Code from the shortcut menu. Select the event name from the Procedure drop-down list box.

Activate
BeforeDoubleClick
BeforeRightClick
Calculate
Deactivate

MouseDown
MouseMove
MouseUp
Resize
Select
SeriesChange

Note Note

To write event procedures for an embedded chart, you must create a new object using the WithEvents keyword in a class module. For more information, see Using Events with Embedded Charts.

This example changes a point's border color when the user changes the point value.

Copy code Copy code
Private Sub Chart_SeriesChange(ByVal SeriesIndex As Long, _
        ByVal PointIndex As Long)
    Set p = ActiveChart.SeriesCollection(SeriesIndex). _
        Points(PointIndex)
    p.Border.ColorIndex = 3
End Sub


Control and Dialog Box Events

 Copy code hover
[image]

Control and Dialog Box Events
Send feedback

Published: July 16, 2012

After you have added controls to your dialog box or document, you add event procedures to determine how the controls respond to user actions.

User forms and controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button, and UserForms have an Initialize event that runs when the form is loaded.

To write a control or form event procedure, open a module by double-clicking the form or control, and select the event from the Procedure drop-down list box.

Event procedures include the name of the control. For example, the name of the Click event procedure for a command button named Command1 is Command1_Click.

If you add code to an event procedure and then change the name of the control, your code remains in procedures with the previous name.

For example, assume you add code to the Click event for Commmand1 and then rename the control to Command2. When you double-click Command2, you will not see any code in the Click event procedure. You will need to move code from Command1_Click to Command2_Click.

To simplify development, it is a good practice to name your controls before writing code.


QueryTable Object Events

 Copy code hover
[image]

QueryTable Object Events
Send feedback

Published: July 16, 2012

QueryTable object events occur when a QueryTable object is refreshed. These events are enabled by default. To view the event procedures available for a particular sheet, right-click the sheet tab and then click View Code on the shortcut menu. In the Procedure drop-down list box in the Code window, click the name of the event you want to use.

  • AfterRefresh

  • BeforeRefresh

Note Note

To write event procedures for a QueryTable object, you must first create a new object by using the WithEvents keyword in a class module. For more information, see Using Events with the QueryTable Object.


Worksheet Object Events

 Copy code hover
[image]

Worksheet Object Events
Send feedback

Published: July 16, 2012

Events on sheets are enabled by default. To view the event procedures for a sheet, right-click the sheet tab and click View Code on the shortcut menu. Select one of the following events from the Procedure drop-down list box.

Activate
BeforeDoubleClick
BeforeRightClick
Calculate
Change

Deactivate
FollowHyperlink
PivotTableUpdate
SelectionChange

Worksheet-level events occur when a worksheet is activated, when the user changes a worksheet cell, or when the PivotTable changes. The following example adjusts the size of columns A through F whenever the worksheet is recalculated.

VBA Copy code Copy code
Private Sub Worksheet_Calculate()
    Columns("A:F").AutoFit
End Sub

Some events can be used to substitute an action for the default application behavior, or to make a small change to the default behavior. The following example traps the right-click event and adds a new menu item to the shortcut menu for cells B1:B10.

VBA Copy code Copy code
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
        Cancel As Boolean)
    For Each icbc In Application.CommandBars("cell").Controls
        If icbc.Tag = "brccm" Then icbc.Delete
    Next icbc
    If Not Application.Intersect(Target, Range("b1:b10")) _
            Is Nothing Then
        With Application.CommandBars("cell").Controls _
            .Add(Type:=msoControlButton, before:=6, _
                temporary:=True)
           .Caption = "New Context Menu Item"
           .OnAction = "MyMacro"
           .Tag = "brccm"
        End With
    End If
End Sub


Using Events with Excel Objects

 Copy code hover
[image]

Using Events with Excel Objects
Send feedback

Published: July 16, 2012

You can write event procedures in Microsoft Excel at the worksheet, chart, query table, workbook, or application level. For example, the Activate event occurs at the sheet level, and the SheetActivate event is available at both the workbook and application levels. The SheetActivate event for a workbook occurs when any sheet in the workbook is activated. At the application level, the SheetActivate event occurs when any sheet in any open workbook is activated.

Worksheet, Chart, and Workbook event procedures are available for any open sheet or workbook. To write event procedures for an embedded chart, a QueryTable object, or an Application object, you must create a new object by using the WithEvents keyword in a class module.

Use the EnableEvents property to enable or disable events. For example, using the Save method to save a workbook causes the BeforeSave event to occur. You can prevent this by setting the EnableEvents property to False before you call the Save method.

Example

VBA Copy code Copy code
Application.EnableEvents = False
ActiveWorkbook.Save
Application.EnableEvents = True


Using Excel Worksheet Functions in Visual Basic

 Copy code hover
[image]

Using Excel Worksheet Functions in Visual Basic
Send feedback

Published: July 16, 2012

You can use most Microsoft Excel worksheet functions in your Visual Basic statements. For a list of the worksheet functions you can use, see List of Worksheet Functions Available to Visual Basic.

Note Note

Some worksheet functions are not useful in Visual Basic. For example, the Concatenate function is not needed because in Visual Basic you can use the & operator to join multiple text values.

Calling a Worksheet Function from Visual Basic

In Visual Basic, the Excel worksheet functions are available through the WorksheetFunction object.

The following Sub procedure uses the Min worksheet function to determine the smallest value in a range of cells. First, the variable myRange is declared as a Range object, and then it is set to range A1:C10 on Sheet1. Another variable, answer, is assigned the result of applying the Min function to myRange. Finally, the value of answer is displayed in a message box.

VBA Copy code Copy code
Sub UseFunction()
 Dim myRange As Range
 Set myRange = Worksheets("Sheet1").Range("A1:C10")
 answer = Application.WorksheetFunction.Min(myRange)
 MsgBox answer
End Sub

If you use a worksheet function that requires a range reference as an argument, you must specify a Range object. For example, you can use the Match worksheet function to search a range of cells. In a worksheet cell, you would enter a formula such as =MATCH(9,A1:A10,0). However, in a Visual Basic procedure, you would specify a Range object to get the same result.

VBA Copy code Copy code
Sub FindFirst()
 myVar = Application.WorksheetFunction _
 .Match(9, Worksheets(1).Range("A1:A10"), 0)
 MsgBox myVar
End Sub
Note Note

Visual Basic functions do not use the WorksheetFunction qualifier. A function may have the same name as a Microsoft Excel function and yet work differently. For example, Application.WorksheetFunction.Log and Log will return different values.

Inserting a Worksheet Function into a Cell

To insert a worksheet function into a cell, you specify the function as the value of the Formula property of the corresponding Range object. In the following example, the RAND worksheet function (which generates a random number) is assigned to the Formula property of range A1:B3 on Sheet1 in the active workbook.

VBA Copy code Copy code
Sub InsertFormula()
 Worksheets("Sheet1").Range("A1:B3").Formula = "=RAND()"
End Sub

Example

This example uses the worksheet function Pmt to calculate a home mortgage loan payment. Notice that this example uses the InputBox method instead of the InputBox function so that the method can perform type checking. The Static statements cause Visual Basic to retain the values of the three variables; these are displayed as default values the next time you run the program.

VBA Copy code Copy code
Static loanAmt
Static loanInt
Static loanTerm
loanAmt = Application.InputBox _
 (Prompt:="Loan amount (100,000 for example)", _
 Default:=loanAmt, Type:=1)
loanInt = Application.InputBox _
 (Prompt:="Annual interest rate (8.75 for example)", _
 Default:=loanInt, Type:=1)
loanTerm = Application.InputBox _
 (Prompt:="Term in years (30 for example)", _
 Default:=loanTerm, Type:=1)
payment = Application.WorksheetFunction _
 .Pmt(loanInt / 1200, loanTerm * 12, loanAmt)
MsgBox "Monthly payment is " & Format(payment, "Currency")


Working with Shapes (Drawing Objects)

 Copy code hover
[image]

Working with Shapes (Drawing Objects)
Send feedback

Published: July 16, 2012

Shapes, or drawing objects, are represented by three different objects: the Shapes collection, the ShapeRange collection, and the Shape object. In general, you use the Shapes collection to create shapes and to iterate through all the shapes on a given worksheet; you use the Shape object to format or modify a single shape; and you use the ShapeRange collection to modify multiple shapes the same way you work with multiple shapes in the user interface.

Setting Properties for a Shape

Many formatting properties of shapes are not set by properties that apply directly to the Shape or ShapeRange object. Instead, related shape attributes are grouped under secondary objects, such as the FillFormat object, which contains all the properties that relate to the shape's fill, or the LinkFormat object, which contains all the properties that are unique to linked OLE objects. To set properties for a shape, you must first return the object that represents the set of related shape attributes and then set properties of that returned object. For example, you use the Fill property to return the FillFormat object, and then you set the ForeColor property of the FillFormat object to set the fill foreground color for the specified shape, as shown in the following example.

VBA Copy code Copy code
Worksheets(1).Shapes(1).Fill.ForeColor.RGB = RGB(255, 0, 0)

Applying a Property or Method to Several Shapes at the Same Time

In the user interface, you can perform some operations with several shapes selected; for example, you can select several shapes and set all their individual fills at once. You can perform other operations with only a single shape selected; for example, you can edit the text in a shape only if a single shape is selected.

In Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any operation that you can perform on a single shape on a range of shapes, whether or not you can perform the same operation in the user interface.

  • If the operation works on multiple selected shapes in the user interface, you can perform the same operation in Visual Basic by constructing a ShapeRange collection that contains the shapes you want to work with, and applying the appropriate properties and methods directly to the ShapeRange collection.

  • If the operation does not work on multiple selected shapes in the user interface, you can still perform the operation in Visual Basic by looping through the Shapes collection or through a ShapeRange collection that contains the shapes you want to work with, and applying the appropriate properties and methods to the individual Shape objects in the collection.

Many properties and methods that apply to the Shape object and ShapeRange collection fail if applied to certain kinds of shapes. For example, the TextFrame property fails if applied to a shape that cannot contain text. If you are not positive that each of the shapes in a ShapeRange collection can have a certain property or method applied to it, do not apply the property or method to the ShapeRange collection. If you want to apply one of these properties or methods to a collection of shapes, you must loop through the collection and test each individual shape to make sure it is an appropriate type of shape before applying the property or method to it.

Creating a ShapeRange Collection that Contains All Shapes on a Sheet

You can create a ShapeRange object that contains all the Shape objects on a sheet by selecting the shapes and then using the ShapeRange property to return a ShapeRange object containing the selected shapes.

VBA Copy code Copy code
Worksheets(1).Shapes.Select
Set sr = Selection.ShapeRange

In Microsoft Excel, the Index argument is not optional for the Range property of the Shapes collection, so you cannot use this property without an argument to create a ShapeRange object containing all shapes in a Shapes collection.

Applying a Property or Method to a ShapeRange Collection

If you can perform an operation on multiple selected shapes in the user interface at the same time, you can do the programmatic equivalent by constructing a ShapeRange collection and then applying the appropriate properties or methods to it. The following example constructs a shape range that contains the shapes named "Big Star" and "Little Star" on myDocument and applies a gradient fill to them.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myRange = myDocument.Shapes.Range(Array("Big Star", _
 "Little Star"))
myRange.Fill.PresetGradient _
 msoGradientHorizontal, 1, msoGradientBrass

The following are general guidelines for how properties and methods behave when they are applied to a ShapeRange collection.

  • Applying a method to the collection is equivalent to applying the method to each individual Shape object in that collection.

  • Setting the value of a property of the collection is equivalent to setting the value of the property of each individual shape in that range.

  • A property of the collection that returns a constant returns the value of the property for an individual shape in the collection if all shapes in the collection have the same value for that property. If not all shapes in the collection have the same value for the property, it returns the "mixed" constant.

  • A property of the collection that returns a simple data type (such as Long, Single, or String) returns the value of the property for an individual shape if all shapes in the collection have the same value for that property.

  • The value of some properties can be returned or set only if there is exactly one shape in the collection. If the collection contains more than one shape, a run-time error occurs. This is generally the case for returning or setting properties when the equivalent action in the user interface is possible only with a single shape (actions such as editing text in a shape or editing the points of a freeform).

The preceding guidelines also apply when you are setting properties of shapes that are grouped under secondary objects of the ShapeRange collection, such as the FillFormat object. If the secondary object represents operations that can be performed on multiple selected objects in the user interface, you will be able to return the object from a ShapeRange collection and set its properties. For example, you can use the Fill property to return the FillFormat object that represents the fills of all the shapes in the ShapeRange collection. Setting the properties of this FillFormat object will set the same properties for all the individual shapes in the ShapeRange collection.

Looping Through a Shapes or ShapeRange Collection

Even if you cannot perform an operation on several shapes in the user interface at the same time by selecting them and then using a command, you can perform the equivalent action programmatically by looping through a Shapes or ShapeRange collection that contains the shapes you want to work with, applying the appropriate properties and methods to the individual Shape objects in the collection. The following example loops through all the shapes on myDocument and changes the foreground color for each AutoShape shape.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each sh In myDocument.Shapes
 If sh.Type = msoAutoShape Then
 sh.Fill.ForeColor.RGB = RGB(255, 0, 0)
 End If
Next

The following example constructs a ShapeRange collection that contains all the currently selected shapes in the active window and sets the foreground color for each selected shape.

VBA Copy code Copy code
For Each sh in ActiveWindow.Selection.ShapeRange
 sh.Fill.ForeColor.RGB = RGB(255, 0, 0)
Next

Aligning, Distributing, and Grouping Shapes in a Shape Range

Use the Align and Distribute methods to position a set of shapes relative to one another or relative to the document that contains them. Use the Group method or the Regroup method to form a single grouped shape from a set of shapes.


List of Worksheet Functions Available to Visual Basic

 Copy code hover
[image]

List of Worksheet Functions Available to Visual Basic
Send feedback

Published: July 16, 2012

The following list represents all of the worksheet functions that can be called using the WorkSheetFunction object. For more information about a particular function, see the Function Reference topic on the Office Web site.

AccrInt

AccrIntM

Acos

Acosh

Aggregate

AmorDegrc

AmorLinc

And

Application

Asc

Asin

Asinh

Atan2

Atanh

AveDev

Average

AverageIf

AverageIfs

BahtText

BesselI

BesselJ

BesselK

BesselY

BetaDist

BetaInv

Bin2Dec

Bin2Hex

Bin2Oct

Binom_Dist

Binom_Inv

BinomDist

Ceiling

Ceiling_Precise

ChiDist

ChiInv

ChiSq_Dist

ChiSq_Dist_RT

ChiSq_Inv

ChiSq_Inv_RT

ChiSq_Test

ChiTest

Choose

Clean

Combin

Complex

Confidence

Confidence_Norm

Confidence_T

Convert

Correl

Cosh

Count

CountA

CountBlank

CountIf

CountIfs

CoupDayBs

CoupDays

CoupDaysNc

CoupNcd

CoupNum

CoupPcd

Covar

Covariance_P

Covariance_S

CritBinom

CumIPmt

CumPrinc

DAverage

Days360

Db

Dbcs

DCount

DCountA

Ddb

Dec2Bin

Dec2Hex

Dec2Oct

Degrees

Delta

DevSq

DGet

Disc

DMax

DMin

Dollar

DollarDe

DollarFr

DProduct

DStDev

DStDevP

DSum

Duration

DVar

DVarP

EDate

Effect

EoMonth

Erf

Erf_Precise

ErfC

Even

Expon_Dist

ExponDist

F_Dist

F_Dist_RT

F_Inv

F_Inv_RT

F_Test

Fact

FactDouble

FDist

Find

FindB

FInv

Fisher

FisherInv

Fixed

Floor

Forecast

Frequency

FTest

Fv

FVSchedule

Gamma_Dist

Gamma_Inv

GammaDist

GammaInv

GammaLn

GammaLn_Precise

Gcd

GeoMean

GeStep

Growth

HarMean

Hex2Bin

Hex2Dec

Hex2Oct

HLookup

HypGeom_Dist

HypGeomDist

IfError

ImAbs

Imaginary

ImArgument

ImConjugate

ImCos

ImDiv

ImExp

ImLn

ImLog10

ImLog2

ImPower

ImProduct

ImReal

ImSin

ImSqrt

ImSub

ImSum

Index

Intercept

IntRate

Ipmt

Irr

IsErr

IsError

IsEven

IsLogical

IsNA

IsNonText

IsNumber

IsOdd

Ispmt

IsText

Kurt

Large

Lcm

LinEst

Ln

Log

Log10

LogEst

LogInv

LogNorm_Dist

LogNorm_Inv

LogNormDist

Lookup

Match

Max

MDeterm

MDuration

Median

Min

MInverse

MIrr

MMult

Mode

Mode_Mult

Mode_Sngl

MRound

MultiNomial

NegBinom_Dist

NegBinomDist

NetworkDays

Nominal

Norm_Dist

Norm_Inv

Norm_S_Dist

Norm_S_Inv

NormDist

NormInv

NormSDist

NormSInv

NPer

Npv

Oct2Bin

Oct2Dec

Oct2Hex

Odd

OddFPrice

OddFYield

OddLPrice

OddLYield

Or

Pearson

Percentile

Percentile_Exc

Percentile_Inc

PercentRank

PercentRank_Exc

PercentRank_Inc

Permut

Phonetic

Pi

Pmt

Poisson

Poisson_Dist

Power

Ppmt

Price

PriceDisc

PriceMat

Prob

Product

Proper

Pv

Quartile

Quartile_Exc

Quartile_Inc

Quotient

Radians

RandBetween

Rank

Rank_Avg

Rank_Eq

Rate

Received

Replace

ReplaceB

Rept

Roman

Round

RoundDown

RoundUp

RSq

RTD

Search

SearchB

SeriesSum

Sinh

Skew

Sln

Slope

Small

SqrtPi

Standardize

StDev

StDev_P

StDev_S

StDevP

StEyx

Substitute

Subtotal

Sum

SumIf

SumIfs

SumProduct

SumSq

SumX2MY2

SumX2PY2

SumXMY2

Syd

T_Dist

T_Dist_2t

T_Dist_RT

T_Inv

T_Inv_2T

T_Test

Tanh

TBillEq

TBillPrice

TBillYield

TDist

Text

TInv

Transpose

Trend

Trim

TrimMean

TTest

USDollar

Var

Var_P

Var_S

VarP

Vdb

VLookup

Weekday

WeekNum

Weibull

Weibull_Dist

WorkDay

WorkDay_Intl

Xirr

Xnpv

YearFrac

YieldDisc

YieldMat

Z_Test

ZTest


List of Worksheet Functions that Support Long Strings

 Copy code hover
[image]

List of Worksheet Functions that Support Long Strings
Send feedback

Published: July 16, 2012

The following list represents all the worksheet functions that support strings larger than 255 characters long. The maximum string length for these functions is 32767. For more information about a particular function, see the Function Reference topic on the Office Web site.

ASC

CHAR

CLEAN

DATEVALUE

DBCS

DOLLAR

EXACT

FIND

FINDB

FIXED

ISBLANK

ISERR

ISERROR

ISLOGICAL

ISNA

ISNONTEXT

ISNUMBER

ISREF

ISTEXT

LEFT

LEFTB

LEN

LENB

LOWER

MID

MIDB

PROPER

REPLACE

REPLACEB

REPT

RIGHT

RIGHTB

SEARCH

SEARCHB

SUBSTITUTE

TEXT

TIMEVALUE

TRIM

UPPER

USDOLLAR

VALUE


Using Events with Embedded Charts

 Copy code hover
[image]

Using Events with Embedded Charts
Send feedback

Published: July 16, 2012

Events are enabled for chart sheets by default. Before you can use events with a Chart object that represents an embedded chart, you must create a new class module and declare an object of type Chart with events. For example, assume that a new class module is created and named EventClassModule. The new class module contains the following code.

VBA Copy code Copy code
Public WithEvents myChartClass As Chart

After the new object has been declared with events, it appears in the Object drop-down list box in the class module, and you can write event procedures for this object. (When you select the new object in the Object box, the valid events for that object are listed in the Procedure drop-down list box.)

Before your procedures will run, however, you must connect the declared object in the class module with the embedded chart. You can do this by using the following code from any module.

VBA Copy code Copy code
Dim myClassModule As New EventClassModule

Sub InitializeChart()
 Set myClassModule.myChartClass = _
 Charts(1).ChartObjects(1).Chart
End Sub

After you run the InitializeChart procedure, the myChartClass object in the class module points to embedded chart 1 on worksheet 1, and the event procedures in the class module will run when the events occur.


Using Events with the Application Object

 Copy code hover
[image]

Using Events with the Application Object
Send feedback

Published: July 16, 2012

Before you can use events with the Application object, you must create a class module and declare an object of type Application with events. For example, assume that a new class module is created and called EventClassModule. The new class module contains the following code:

VBA Copy code Copy code
Public WithEvents App As Application

After the new object has been declared with events, it appears in the Object drop-down list box in the class module, and you can write event procedures for the new object. (When you select the new object in the Object box, the valid events for that object are listed in the Procedure drop-down list box.)

Before the procedures will run, however, you must connect the declared object in the class module with the Application object. You can do this with the following code from any module.

Example

VBA Copy code Copy code
Dim X As New EventClassModule

Sub InitializeApp()
 Set X.App = Application
End Sub

After you run the InitializeApp procedure, the App object in the class module points to the Microsoft Excel Application object, and the event procedures in the class module will run when the events occur.


Using Events with the QueryTable Object

 Copy code hover
[image]

Using Events with the QueryTable Object
Send feedback

Published: July 16, 2012

Before you can use events with the QueryTable object, you must first create a class module and declare a QueryTable object with events. For example, assume that you have created a class module and named it ClsModQT. This module contains the following code:

VBA Copy code Copy code
Public WithEvents qtQueryTable As QueryTable

After you have declared the new object by using events, it appears in the Object drop-down list box in the class module.

Before the procedures will run, however, you must connect the declared object in the class module to the specified QueryTable object. You can do this by entering the following code in the class module:

VBA Copy code Copy code
Sub InitQueryEvent(QT as Object)
 Set qtQueryTable = QT
End Sub

After you run this initialization procedure, the object you declared in the class module points to the specified QueryTable object. You can initialize the event in a module by calling the event. In this example, the first query table on the active worksheet is connected to the qtQueryTable object.

VBA Copy code Copy code
Dim clsQueryTable as New ClsModQT

Sub RunInitQTEvent
 clsQueryTable.InitQueryEvent _
 QT:=ActiveSheet.QueryTables(1)
End Sub

You can write other event procedures in the object's class. When you click the new object in the Object box, the valid events for that object are displayed in the Procedure drop-down list box.


Invalid Procedure Name Error
Send feedback

Invalid Procedure Name error

You have either specified an invalid procedure name or did not include a procedure name when you attempted to create the procedure.

Valid macro names:

  • Must begin with a letter.

  • Cannot contain spaces or non-alphanumeric characters (ampersand (&), asterisk (*), slash (/), and so on).

  • Cannot contain periods. You may use a period (.) in a macro name only to explicitly define a procedure within a module. For example, if you type in the new macro name "my.test", you have created a new Module called "my" containing a Procedure named "test".

  • Cannot exceed 80 characters.

  • Cannot conflict with the reserved identifiers or keywords for a program, such as the word "print".


Working with Other Applications

 Copy code hover
[image]

Working with Other Applications
Send feedback

Published: July 16, 2012

In this section

  • Controlling One Microsoft Office Application from Another

  • Exporting a Chart to a Word Document

  • Exporting a Range to a Table in a Word Document

  • Exporting a Table to a Word Document

  • Import Outlook Contacts to a Worksheet

  • Sending Email to a List of Recipients Using Excel and Outlook


Controlling One Microsoft Office Application from Another

 Copy code hover
[image]

Controlling One Microsoft Office Application from Another
Send feedback

Published: July 16, 2012

If you want to run code in one Microsoft Office application that works with the objects in another application, follow these steps.

To run the code

  1. Set a reference to the other application's type library in the References dialog box (Tools menu). Then, the objects, properties, and methods will appear in the Object Browser and the syntax will be checked at compile time. You can also get context-sensitive Help on them.

  2. Declare object variables that will refer to the objects in the other application as specific types. Qualify each type with the name of the application that is supplying the object. For example, the following statement declares a variable that points to a Microsoft Word document and another that refers to a Microsoft Excel workbook.

    SCR Copy code Copy code
    Dim appWD As Word.Application, wbXL As Excel.Workbook
    Note Note

    You must follow the preceding steps if you want your code to be early bound.

  3. Use the CreateObject function with the OLE Programmatic Identifiers of the object you want to work with in the other application, as shown in the following example. To see the session of the other application, set the Visible property to True.

    VBA Copy code Copy code
    Dim appWD As Word.Application

Set appWD = CreateObject("Word.Application")
appWd.Visible = True

  4. Apply properties and methods to the object contained in the variable. For example, the following instruction creates a new Word document.

    VBA Copy code Copy code
    Dim appWD As Word.Application

Set appWD = CreateObject("Word.Application")
appWD.Documents.Add

  5. When finished working with the other application, use the Quit method to close it, and then set its object variable to Nothing to free any memory it is using, as shown in the following example.

    VBA Copy code Copy code
    appWd.Quit
Set appWd = Nothing

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributors

The following code example creates a new Microsoft Office Word file for each row of data in a spreadsheet.

VBA Copy code Copy code
' You must pick Microsoft Word Object Library from Tools>References
' in the VB editor to execute Word commands.
Sub ControlWord()
    Dim appWD As Word.Application
    ' Create a new instance of Word and make it visible
    Set appWD = CreateObject("Word.Application.12")
    appWD.Visible = True

    ' Find the last row with data in the spreadsheet
    FinalRow = Range("A9999").End(xlUp).Row
    For i = 1 To FinalRow
        ' Copy the current row
        Worksheets("Sheet1").Rows(i).Copy
        ' Tell Word to create a new document
        appWD.Documents.Add
        ' Tell Word to paste the contents of the clipboard into the new document.
        appWD.Selection.Paste
        ' Save the new document with a sequential file name.
        appWD.ActiveDocument.SaveAs Filename:="File" & i
        ' Close the new Word document.
        appWD.ActiveDocument.Close
    Next i
    ' Close the Word application.
    appWD.Quit
End Sub

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributors

This example takes the cells values from a named range, W_Data, that contains three values and inserts those values into a Word document. The values are inserted at bookmarked locations named td1, td2, and td3.

For this example to run, you must have a range named W_Data that contains three values on Sheet1 in the workbook. You must have a Word document named Test.docx saved in the same location as the Excel workbook, and the Word document must have three bookmarks named td1, td2, and td3.

VBA Copy code Copy code
' You must pick Microsoft Word Object Library from Tools>References
' in the Visual Basic editor to execute Word commands.

Option Explicit

Sub Add_Single_Values_Word()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdRange1 As Word.Range
Dim wdRange2 As Word.Range
Dim wdRange3 As Word.Range

Dim wbBook As Workbook
Dim wsSheet As Worksheet

Dim vaData As Variant

Set wbBook = ThisWorkbook
Set wsSheet = wbBook.Worksheets("Sheet1")

vaData = wsSheet.Range("W_Data").Value

' Instatiate the Word Objects.
Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Open(wbBook.Path & "\Test.docx")

With wdDoc
    Set wdRange1 = .Bookmarks("td1").Range
    Set wdRange2 = .Bookmarks("td2").Range
    Set wdRange3 = .Bookmarks("td3").Range
End With

' Write values to the bookmarks.
wdRange1.Text = vaData(1, 1)
wdRange2.Text = vaData(2, 1)
wdRange3.Text = vaData(3, 1)

With wdDoc
    .Save
    .Close
End With

wdApp.Quit

' Release the objects from memory.
Set wdRange1 = Nothing
Set wdRange2 = Nothing
Set wdRange3 = Nothing
Set wdDoc = Nothing
Set wdApp = Nothing

End Sub

About the Contributors

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Exporting a Chart to a Word Document

 Copy code hover
[image]

Exporting a Chart to a Word Document
Send feedback

Published: July 16, 2012

This example takes a chart named "Chart 1" from Sheet 1 and exports it as a .gif file. Then it inserts the .gif file into an existing Word document named "Chart Report" at the bookmarked location named "ChartReport".

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Export_Chart_Word()

    'Name of an existing Word document, and the name the chart will have when exported.
    Const stWordDocument As String = "Chart Report.docx"
    Const stChartName As String = "ChartReport.gif"

    'Word objects.
    Dim wdApp As Word.Application
    Dim wdDoc As Word.Document
    Dim wdbmRange As Word.Range

    'Excel objects.
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim ChartObj As ChartObject

    'Initialize the Excel objets.
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets("Sheet1")
    Set ChartObj = wsSheet.ChartObjects("Chart 1")

    'Turn off screen updating.
    Application.ScreenUpdating = False

    'Export the chart to the current directory, using the specified name, and save the chart as a .gif
    ChartObj.Chart.Export _
                   Filename:=wbBook.Path & "\" & stChartName, _
                   FilterName:="GIF"

    'Initialize the Word objets to the existing Word document and bookmark.
    Set wdApp = New Word.Application
    Set wdDoc = wdApp.Documents.Open(wbBook.Path & "\" & stWordDocument)
    Set wdbmRange = wdDoc.Bookmarks("ChartReport").Range

    'If there is already an inline shape, that means the macro has been run before - clean up any artifacts.
    On Error Resume Next
    With wdDoc.InlineShapes(1)
        .Select
        .Delete
    End With
    On Error GoTo 0

    'Add the .gif file to the document at the bookmarked location,
    'and ensure that it is saved inside the Word doc.
    With wdbmRange
        .Select
        .InlineShapes.AddPicture _
        Filename:=wbBook.Path & "\" & stChartName, _
        LinkToFile:=False, _
        savewithdocument:=True
    End With

    'Save and close the Word document.
    With wdDoc
        .Save
        .Close
    End With

    'Quit Word.
    wdApp.Quit

    'Clear the variables.
    Set wdbmRange = Nothing
    Set wdDoc = Nothing
    Set wdApp = Nothing

    'Delete the temporary .gif file.
    On Error Resume Next
    Kill wbBook.Path & "\" & stChartName
    On Error GoTo 0

    MsgBox "Chart exported successfully to " & stWordDocument

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Exporting a Range to a Table in a Word Document

 Copy code hover
[image]

Exporting a Range to a Table in a Word Document
Send feedback

Published: July 16, 2012

This example takes the range A1:A10 on Sheet 1 and exports it to the first table in an existing Word document named "Table Report".

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Export_Table_Data_Word()

    'Name of the existing Word document
    Const stWordDocument As String = "Table Report.docx"

    'Word objects.
    Dim wdApp As Word.Application
    Dim wdDoc As Word.Document
    Dim wdCell As Word.Cell

    'Excel objects
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet

    'Count used in a FOR loop to fill the Word table.
    Dim lnCountItems As Long

    'Variant to hold the data to be exported.
    Dim vaData As Variant

    'Initialize the Excel objects
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets("Sheet1")
    vaData = wsSheet.Range("A1:A10").Value

    'Instantiate Word and open the "Table Reports" document.
    Set wdApp = New Word.Application
    Set wdDoc = wdApp.Documents.Open(wbBook.Path & "\" & stWordDocument)

    lnCountItems = 1

    'Place the data from the variant into the table in the Word doc.
    For Each wdCell In wdDoc.Tables(1).Columns(1).Cells
        wdCell.Range.Text = vaData(lnCountItems, 1)
        lnCountItems = lnCountItems + 1
    Next wdCell

    'Save and close the Word doc.
    With wdDoc
        .Save
        .Close
    End With

    wdApp.Quit

    'Null out the variables.
    Set wdCell = Nothing
    Set wdDoc = Nothing
    Set wdApp = Nothing

    MsgBox "The " & stWordDocument & "'s table has succcessfully " & vbNewLine & _
           "been updated!", vbInformation

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Exporting a Table to a Word Document

 Copy code hover
[image]

Exporting a Table to a Word Document
Send feedback

Published: July 16, 2012

This example takes the table named "Table1" on Sheet 1 and copies it into an existing Word document named "Quarter Report" at the bookmarked location named "Report".

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Export_Table_Word()

    'Name of the existing Word doc.
    Const stWordReport As String = "Quarter Report.docx"

    'Word objects.
    Dim wdApp As Word.Application
    Dim wdDoc As Word.Document
    Dim wdbmRange As Word.Range

    'Excel objects.
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim rnReport As Range

    'Initialize the Excel objects.
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets("Sheet1")
    Set rnReport = wsSheet.Range("Table1")

    'Initialize the Word objets.
    Set wdApp = New Word.Application
    Set wdDoc = wdApp.Documents.Open(wbBook.Path & "\" & stWordReport)
    Set wdbmRange = wdDoc.Bookmarks("Report").Range

    'If the macro has been run before, clean up any artifacts before trying to paste the table in again.
    On Error Resume Next
    With wdDoc.InlineShapes(1)
        .Select
        .Delete
    End With
    On Error GoTo 0

    'Turn off screen updating.
    Application.ScreenUpdating = False

    'Copy the report to the clipboard.
    rnReport.Copy

    'Select the range defined by the "Report" bookmark and paste in the report from clipboard.
    With wdbmRange
        .Select
        .PasteSpecial Link:=False, _
                      DataType:=wdPasteMetafilePicture, _
                      Placement:=wdInLine, _
                      DisplayAsIcon:=False
    End With

    'Save and close the Word doc.
    With wdDoc
        .Save
        .Close
    End With

    'Quit Word.
    wdApp.Quit

    'Null out your variables.
    Set wdbmRange = Nothing
    Set wdDoc = Nothing
    Set wdApp = Nothing

    'Clear out the clipboard, and turn screen updating back on.
    With Application
        .CutCopyMode = False
        .ScreenUpdating = True
    End With

    MsgBox "The report has successfully been " & vbNewLine & _
           "transferred to " & stWordReport, vbInformation

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Import Outlook Contacts to a Worksheet

 Copy code hover
[image]

Import Outlook Contacts to a Worksheet
Send feedback

Published: July 16, 2012

This example imports the contacts from the default Outlook contacts folder to Sheet 1 of the active workbook.

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Import_Contacts()

    'Outlook objects.
    Dim olApp As Outlook.Application
    Dim olNamespace As Outlook.Namespace
    Dim olFolder As Outlook.MAPIFolder
    Dim olConItems As Outlook.Items
    Dim olItem As Object

    'Excel objects.
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet

    'Location in the imported contact list.
    Dim lnContactCount As Long

    Dim strDummy As String

    'Turn off screen updating.
    Application.ScreenUpdating = False

    'Initialize the Excel objects.
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets(1)

    'Format the target worksheet.
    With wsSheet
        .Range("A1").CurrentRegion.Clear
        .Cells(1, 1).Value = "Company / Private Person"
        .Cells(1, 2).Value = "Street Address"
        .Cells(1, 3).Value = "Postal Code"
        .Cells(1, 4).Value = "City"
        .Cells(1, 5).Value = "Contact Person"
        .Cells(1, 6).Value = "E-mail"
        With .Range("A1:F1")
            .Font.Bold = True
            .Font.ColorIndex = 10
            .Font.Size = 11
        End With
    End With

    wsSheet.Activate

    'Initalize the Outlook variables with the MAPI namespace and the default Outlook folder of the current user.
    Set olApp = New Outlook.Application
    Set olNamespace = olApp.GetNamespace("MAPI")
    Set olFolder = olNamespace.GetDefaultFolder(10)
    Set olConItems = olFolder.Items

    'Row number to place the new information on; starts at 2 to avoid overwriting the header
    lnContactCount = 2

    'For each contact: if it is a business contact, write out the business info in the Excel worksheet;
    'otherwise, write out the personal info.
    For Each olItem In olConItems
        If TypeName(olItem) = "ContactItem" Then
            With olItem
                If InStr(olItem.CompanyName, strDummy) > 0 Then
                    Cells(lnContactCount, 1).Value = .CompanyName
                    Cells(lnContactCount, 2).Value = .BusinessAddressStreet
                    Cells(lnContactCount, 3).Value = .BusinessAddressPostalCode
                    Cells(lnContactCount, 4).Value = .BusinessAddressCity
                    Cells(lnContactCount, 5).Value = .FullName
                    Cells(lnContactCount, 6).Value = .Email1Address
                Else
                    Cells(lnContactCount, 1) = .FullName
                    Cells(lnContactCount, 2) = .HomeAddressStreet
                    Cells(lnContactCount, 3) = .HomeAddressPostalCode
                    Cells(lnContactCount, 4) = .HomeAddressCity
                    Cells(lnContactCount, 5) = .FullName
                    Cells(lnContactCount, 6) = .Email1Address
                End If
                wsSheet.Hyperlinks.Add Anchor:=Cells(lnContactCount, 6), _
                                       Address:="mailto:" & Cells(lnContactCount, 6).Value, _
                                       TextToDisplay:=Cells(lnContactCount, 6).Value
            End With
            lnContactCount = lnContactCount + 1
        End If
    Next olItem

    'Null out the variables.
    Set olItem = Nothing
    Set olConItems = Nothing
    Set olFolder = Nothing
    Set olNamespace = Nothing
    Set olApp = Nothing

    'Sort the rows alphabetically using the CompanyName or FullName as appropriate, and then autofit.
    With wsSheet
        .Range("A2", Cells(2, 6).End(xlDown)).Sort key1:=Range("A2"), order1:=xlAscending
        .Range("A:F").EntireColumn.AutoFit
    End With

    'Turn screen updating back on.
    Application.ScreenUpdating = True

    MsgBox "The list has successfully been created!", vbInformation

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Sending Email to a List of Recipients Using Excel and Outlook

 Copy code hover
[image]

Sending Email to a List of Recipients Using Excel and Outlook
Send feedback

Published: July 16, 2012

The following code example shows how to send an email to a list of recipients based on data stored in a workbook. The recipient email addresses must be in column A, and the body text of the email must be in the first text box on the active sheet.

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

VBA Copy code Copy code
Sub Sample()
   'Setting up the Excel variables.
   Dim olApp As Object
   Dim olMailItm As Object
   Dim iCounter As Integer
   Dim Dest As Variant
   Dim SDest As String

   'Create the Outlook application and the empty email.
   Set olApp = CreateObject("Outlook.Application")
   Set olMailItm = olApp.CreateItem(0)

   'Using the email, add multiple recipients, using a list of addresses in column A.
   With olMailItm
       SDest = ""
       For iCounter = 1 To WorksheetFunction.CountA(Columns(1))
           If SDest = "" Then
               SDest = Cells(iCounter, 1).Value
           Else
               SDest = SDest & ";" & Cells(iCounter, 1).Value
           End If
       Next iCounter

    'Do additional formatting on the BCC and Subject lines, add the body text from the spreadsheet, and send.
       .BCC = SDest
       .Subject = "FYI"
       .Body = ActiveSheet.TextBoxes(1).Text
       .Send
   End With

   'Clean up the Outlook application.
   Set olMailItm = Nothing
   Set olApp = Nothing
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.


How do I... (Excel 2013 developer reference)

 Copy code hover
[image]

How do I... (Excel 2013 developer reference)
Send feedback

Published: July 16, 2012

This topic links to programming tasks (how-to and walkthrough topics) for common Excel scenarios.

"How Do I ..." is your gateway to key task-based topics about programming and application development using Excel. The essential categories for what you can do with Excel are listed in this topic. The links provide pointers to important, procedure-based Help topics.

Workbooks and Worksheets

  • How to: Add a Table of Contents to a Workbook

    • Describes how to add a table of contents worksheet to a workbook.

  • How to: Create Address Labels from a Spreadsheet

    • Describes how to take a list of addresses arranged as one address per row, and arrange them to fit on printable address labels.

  • How to: Create a Scheduling Calendar Workbook

    • Describes how to use information in one workbook to create a scheduling calendar workbook that contains one month per worksheet and can optionally include holidays and weekends.

  • How to: Create a Workbook

    • Describes how to create a workbook using Excel.

  • How to: Create or Replace a Worksheet

    • Describes how to create or replace a worksheet in an existing workbook.

  • How to: Name a Worksheet By Using a Cell Value

    • Describes how to name a worksheet based on a value in a cell.

  • How to: Refer to More Than One Sheet

    • Describes how to refer to more than one worksheet in Excel.

  • How to: Refer to Sheets by Index Number

    • Describes how to refer to worksheets by index number.

  • How to: Refer to Sheets by Name

    • Describes how to refer to worksheets by name.

  • How to: Sort Worksheets Alphanumerically by Name

    • Describes how to sort worksheets in a workbook alphanumerically by name.

Cells and Ranges

  • How to: Create an HTML File with a Table of Contents based on Cell Data

    • Describes how to take data from a worksheet and create a table of contents in an HTML file.

  • How to: Delete Duplicate Entries in a Range

    • Describes how to delete duplicate entries in a range.

  • How to: Fill a Value Down into Blank Cells in a Column

    • Describes how to fill a value down into blank cells.

  • How to: Hide and Unhide Columns

    • Describes how to find all the cells that contain a certain value and hide or unhide the columns that contain that value.

  • How to: Highlight the Active Cell, Row, or Column

    • Describes how to highlight the active cell, or column with a color.

  • How to: Make a Cell Blink

    • Describes how to make a cell blink by changing the color of the cell.

  • How to: Prevent Duplicate Entries in a Range

    • Describes how to prevent duplicate entries of a value in a given range.

  • How to: Reference Cells and Ranges

    • Describes how to reference cells and ranges in order to do enter formulas or change formats.

  • How to: Refer to All the Cells on the Worksheet

    • Describes how to refer to all cells on a worksheet.

  • How to: Refer to Cells and Ranges by Using A1 Notation

    • Describes how to refer to cells and ranges by using A1 notation.

  • How to: Refer to Cells by Using a Range Object

    • Describes how to refer to cells by using a Range object.

  • How to: Refer to Cells by Using Index Numbers

    • Describes how to refer to cells by using index numbers.

  • How to: Refer to Cells by Using Shortcut Notation

    • Describes how to refer to cells by using shortcut notation.

  • How to: Refer to Cells Relative to Other Cells

    • Describes how to refer to cells relative to other cells.

  • How to: Refer to Multiple Ranges

    • Describes how to refer to multiple ranges.

  • How to: Refer to Named Ranges

    • Describes how to refer to named ranges.

  • How to: Refer to Rows and Columns

    • Describes how to refer to rows and columns in Excel.

  • How to: Select a Range

    • Describes how to select the used range and the data range on a worksheet.

Controls, Dialog Boxes, and Forms

  • How to: Add a Unique List of Values to a Combo Box

    • Describes how to take a list from a spreadsheet and use it to populate a combo box control using only the unique values.

  • How to: Add Controls to a Document

    • Describes how to add controls to a document.

  • How to: Add Controls to a User Form

    • Describes how to add controls to a user form.

  • How to: Automatically Dismiss a Message Box

    • Describes how to automatically dismiss a message box.

  • How to: Create a Custom Dialog Box

    • Describes how to create a custom dialog box.

  • How to: Create a Custom Menu That Calls a Macro

    • Describes how to create a custom menu with four menu options, each of which calls a macro.

  • How to: Create a User Form

    • Describes how to create a user form.

Sparklines

  • How to: Animate a Sparkline

    • Describes how to animate a sparkline.

  • How to: Change the Color of the Horizontal Axis of a Sparkline

    • Describes how to change the color of the horizontal axis of a sparkline.

  • How to: Find All the Sparklines on a Sheet

    • Describes how to find all the sparklines on a worksheet.


How Do I... with Workbooks and Worksheets

 Copy code hover
[image]

How Do I... with Workbooks and Worksheets
Send feedback

Published: July 16, 2012

This topic links to programming tasks (how-to and walkthrough topics) for common workbook and worksheet scenarios.

"How Do I ..." is your gateway to key task-based topics about programming and application development using Excel. The links provide pointers to important, procedure-based Help topics.

Workbooks and Worksheets

  • How to: Add a Table of Contents to a Workbook

    • Describes how to add a table of contents worksheet to a workbook.

  • How to: Create Address Labels from a Spreadsheet

    • Describes how to take a list of addresses arranged as one address per row, and arrange them to fit on printable address labels.

  • How to: Create a Scheduling Calendar Workbook

    • Describes how to use information in one workbook to create a scheduling calendar workbook that contains one month per worksheet and can optionally include holidays and weekends.

  • How to: Create a Workbook

    • Describes how to create a workbook using Excel.

  • How to: Create or Replace a Worksheet

    • Describes how to create or replace a worksheet in an existing workbook.

  • How to: Name a Worksheet By Using a Cell Value

    • Describes how to name a worksheet based on a value in a cell.

  • How to: Refer to More Than One Sheet

    • Describes how to refer to more than one worksheet in Excel.

  • How to: Refer to Sheets by Index Number

    • Describes how to refer to worksheets by index number.

  • How to: Refer to Sheets by Name

    • Describes how to refer to worksheets by name.

  • How to: Sort Worksheets Alphanumerically by Name

    • Describes how to sort worksheets in a workbook alphanumerically by name.


How to: Add a Table of Contents to a Workbook

 Copy code hover
[image]

How to: Add a Table of Contents to a Workbook
Send feedback

Published: July 16, 2012

The following examples show different approaches for adding a table of contents to an Excel workbook.

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributors

This example uses the Pages.Count Property (Excel) property to calculate the number of pages on each sheet. In addition, the entries in the TOC link to their respective sheets to improve on-screen workbook navigation.

VBA Copy code Copy code
Option Explicit
Sub Create_TOC()
Dim wbBook As Workbook
Dim wsActive As Worksheet
Dim wsSheet As Worksheet
Dim lnRow As Long
Dim lnPages As Long
Dim lnCount As Long
Set wbBook = ActiveWorkbook
With Application
    .DisplayAlerts = False
    .ScreenUpdating = False
End With
'If the TOC sheet already exist delete it and add a new
'worksheet.
On Error Resume Next
With wbBook
    .Worksheets("TOC").Delete
    .Worksheets.Add Before:=.Worksheets(1)
End With
On Error GoTo 0
Set wsActive = wbBook.ActiveSheet
With wsActive
    .Name = "TOC"
    With .Range("A1:B1")
        .Value = VBA.Array("Table of Contents", "Sheet # - # of Pages")
        .Font.Bold = True
    End With
End With
lnRow = 2
lnCount = 1
'Iterate through the worksheets in the workbook and create
'sheetnames, add hyperlink and count & write the running number
'of pages to be printed for each sheet on the TOC sheet.
For Each wsSheet In wbBook.Worksheets
    If wsSheet.Name <> wsActive.Name Then
        wsSheet.Activate
        With wsActive
            .Hyperlinks.Add .Cells(lnRow, 1), "", _
            SubAddress:="'" & wsSheet.Name & "'!A1", _
            TextToDisplay:=wsSheet.Name
            lnPages = wsSheet.PageSetup.Pages().Count
            .Cells(lnRow, 2).Value = "'" & lnCount & "-" & lnPages
        End With
        lnRow = lnRow + 1
        lnCount = lnCount + 1
    End If
Next wsSheet
wsActive.Activate
wsActive.Columns("A:B").EntireColumn.AutoFit
With Application
    .DisplayAlerts = True
    .ScreenUpdating = True
End With
End Sub

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributors

This example verifies that a sheet named "TOC" already exists. If it exists, the example updates the table of contents. Otherwise, the example creates a new TOC sheet at the beginning of the workbook. The name of each worksheet, along with the corresponding printed page numbers, is listed in the table of contents. To retrieve the page numbers the example opens the Print Preview dialog box. You must close the dialog box and then the table of contents is created.

VBA Copy code Copy code
Sub CreateTableOfContents()
    ' Determine if there is already a Table of Contents
    ' Assume it is there, and if it is not, it will raise an error
    ' if the Err system variable is > 0, you know the sheet is not there
    Dim WST As Worksheet
    On Error Resume Next
    Set WST = Worksheets("TOC")
    If Not Err = 0 Then
        ' The Table of contents doesn't exist. Add it
        Set WST = Worksheets.Add(Before:=Worksheets(1))
        WST.Name = "TOC"
    End If
    On Error GoTo 0

    ' Set up the table of contents page
    WST.[A2] = "Table of Contents"
    With WST.[A6]
        .CurrentRegion.Clear
        .Value = "Subject"
    End With
    WST.[B6] = "Page(s)"
    WST.Range("A1:B1").ColumnWidth = Array(36, 12)
    TOCRow = 7
    PageCount = 0

    ' Do a print preview on all sheets so Excel calcs page breaks
    ' The user must manually close the PrintPreview window
    Msg = "Excel needs to do a print preview to calculate the number of pages. "
    Msg = Msg & "Please dismiss the print preview by clicking close."
    MsgBox Msg
    ActiveWindow.SelectedSheets.PrintPreview

    ' Loop through each sheet, collecting TOC information
    For Each S In Worksheets
        If S.Visible = -1 Then
            S.Select
            ThisName = ActiveSheet.Name
            HPages = ActiveSheet.HPageBreaks.Count + 1
            VPages = ActiveSheet.VPageBreaks.Count + 1
            ThisPages = HPages * VPages

            ' Enter info about this sheet on TOC
            Sheets("TOC").Select
            Range("A" & TOCRow).Value = ThisName
            Range("B" & TOCRow).NumberFormat = "@"
            If ThisPages = 1 Then
                Range("B" & TOCRow).Value = PageCount + 1 & " "
            Else
                Range("B" & TOCRow).Value = PageCount + 1 & " - " & PageCount + ThisPages
            End If
        PageCount = PageCount + ThisPages
        TOCRow = TOCRow + 1
        End If
    Next S
End Sub

About the Contributors

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.


How to: Create Address Labels from a Spreadsheet

 Copy code hover
[image]

How to: Create Address Labels from a Spreadsheet
Send feedback

Published: July 16, 2012

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example takes a list of addresses arranged as one address per row, and copies them onto another sheet, arranging them to fit on printable address labels. The workbook must contain two sheets, one named "Addresses" and one named "Labels". The addresses on the Addresses sheet must be arranged as one address per row, with the Name in Column A, Address Line 1 in Column B, Address Line 2 in Column C, and the City, State, Country/Region and Postal code in Column D. The addresses are rearranged and copied onto the Labels sheet.

VBA Copy code Copy code
Sub CreateLabels()
    ' Clear out all records on Labels
    Dim LabelSheet As Worksheet
    Set LabelSheet = Worksheets("Labels")
    LabelSheet.Cells.ClearContents

    ' Set column width for labels
    LabelSheet.Cells(1, 1).ColumnWidth = 35
    LabelSheet.Cells(1, 2).ColumnWidth = 36
    LabelSheet.Cells(1, 3).ColumnWidth = 30

    ' Loop through all records
    Dim AddressSheet As Worksheet
    Set AddressSheet = Worksheets("Addresses")
    FinalRow = AddressSheet.Cells(65536, 1).End(xlUp).Row

    If FinalRow > 1 Then
        NextRow = 1
        NextCol = 1
        For i = 2 To FinalRow
            ' Set up row heights
            If NextCol = 1 Then
                LabelSheet.Cells(NextRow, 1).Resize(4, 1).RowHeight = 15.25
                LabelSheet.Cells(NextRow + 4, 1).RowHeight = 13.25
            End If

            ' Put the Name in row 1
            ThisRow = NextRow
            LabelSheet.Cells(ThisRow, NextCol).Value = AddressSheet.Cells(i, 1) & "   " & AddressSheet.Cells(i, 7)

            ' Put the Address Line 1 in row 2
            If AddressSheet.Cells(i, 2).Value > "" Then
                ThisRow = ThisRow + 1
                LabelSheet.Cells(ThisRow, NextCol).Value = AddressSheet.Cells(i, 2)
            End If

            ' Put the Address Line 2 in row 3
            If AddressSheet.Cells(i, 3).Value > "" Then
                ThisRow = ThisRow + 1
                LabelSheet.Cells(ThisRow, NextCol).Value = AddressSheet.Cells(i, 3)
            End If

            ' Put the City, State, Country/Region and Postal code in row 4
            If AddressSheet.Cells(i, 4).Value > "" Then
                CitySt = AddressSheet.Cells(i, 4)
            End If
            ThisRow = ThisRow + 1
            LabelSheet.Cells(ThisRow, NextCol).Value = CitySt

            ' Update the row and column for the next label
            If NextCol = 1 Then
                NextCol = 2
            ElseIf NextCol = 2 Then
                NextCol = 3
            Else
                NextCol = 1
                NextRow = NextRow + 5
            End If

        Next i

        LabelSheet.Activate
    Else
        MsgBox "No records match the criteria"
    End If
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.


How to: Create a Scheduling Calendar Workbook

 Copy code hover
[image]

How to: Create a Scheduling Calendar Workbook
Send feedback

Published: July 16, 2012

The following code example shows how to use information in one workbook to create a scheduling calendar workbook that contains one month per worksheet and can optionally include holidays and weekends.

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

To run this code, your workbook must have a worksheet named "Cover" that contains the following:

  • A spin control that contains a list of years name "SpinControl1"

  • An option button for the "with weekends" option named "OptionButton1"

  • An option button for the "without weekends" option named "OptionButton2"

  • An option button for the "with holidays" option named "OptionButton3"

  • An option button for the "without holidays" option named "OptionButton4"

Your workbook must also contain a worksheet named "Employee" that lists the names of the employees you want on your calendar in column A starting in cell A3, and a worksheet named "Holidays" that lists the dates of the holidays in column A starting in cell A2 and the name of the holidays in column B starting in cell B2.

VBA Copy code Copy code
Sub CreateCalendar()
   'Define your variables
   Dim wks As Worksheet
   Dim var As Variant
   Dim datDay As Date
   Dim iMonth As Integer, iCol As Integer, iCounter As Integer, iYear As Integer
   Dim sMonth As String
   Dim bln As Boolean

   'In the current application, turn off screen updating, save the current state of the status bar,
   'and then turn on the status bar.
   With Application
      .ScreenUpdating = False
      bln = .DisplayStatusBar
      .DisplayStatusBar = True
   End With

   'Initialize iYear with the value entered in the first spin button on the worksheet.
   iYear = Cover.SpinButton1.Value

   'Create a new workbook to hold your new calendar.
   Workbooks.Add

   'In this new workbook, clear out all the worksheets except for one.
   Application.DisplayAlerts = False
   For iCounter = 1 To Worksheets.Count - 1
      Worksheets(2).Delete
   Next iCounter
   Application.DisplayAlerts = True

   Set wks = ThisWorkbook.Worksheets("Employee")

   'For each month of the year
   For iMonth = 1 To 12
      'Create a new worksheet and label the worksheet tab with the name of the new month
      sMonth = Format(DateSerial(1, iMonth, 1), "mmmm")
      Application.StatusBar = "Place month " & sMonth & " on..."
      Worksheets.Add after:=Worksheets(Worksheets.Count)
      ActiveSheet.Name = sMonth

      'Copy the employee names to the first column, and add the dates across the remaining columns.
      wks.Range(wks.Cells(3, 1), wks.Cells( _
         WorksheetFunction.CountA(wks.Columns(1)) + 1, 1)).Copy Range("A2")
      Range("A1").Value = "'" & ActiveSheet.Name & " " & iYear

      'Call the private subs, depending on what options are chosen for the calendar.

      'With weekends and holidays
      If Cover.OptionButton1.Value And Cover.OptionButton3.Value Then
         Call WithHW(iMonth)
      'With weekends, but without holidays
      ElseIf Cover.OptionButton1.Value And Cover.OptionButton3.Value = False Then
         Call WithWsansH(iMonth)
      'With holidays, but without weekends
      ElseIf Cover.OptionButton1.Value = False And Cover.OptionButton3.Value Then
         Call WithHsansW(iMonth)
      'Without weekends or holidays.
      Else
         Call SansWH(iMonth)
      End If

      'Apply some formatting.
      Rows(2).Value = Rows(1).Value
      Rows(2).NumberFormat = "ddd"
      Range("A2").Value = "Weekdays"
      Rows("1:2").Font.Bold = True
      Columns.AutoFit
   Next iMonth

   'Delete the first worksheet, because there was not anything in it.
   Application.DisplayAlerts = False
   Worksheets(1).Delete
   Application.DisplayAlerts = True

   'Label the window.
   Worksheets(1).Select
   ActiveWindow.Caption = "Yearly calendar " & iYear

   'Do some final cleanup, and then close out the sub.
   With Application
      .ScreenUpdating = True
      .DisplayStatusBar = bln
      .StatusBar = False
   End With
End Sub

'Name: WithWH (with weekends and holidays)
'Description: Creates a calendar for the specified month, including both weekends and holidays.
Private Sub WithHW(ByVal iMonth As Integer)
   'Define your variables.
   Dim cmt As Comment
   Dim rng As Range
   Dim var As Variant
   Dim datDay As Date
   Dim iYear As Integer, iCol As Integer
   iCol = 1
   iYear = Cover.SpinButton1.Value

   'Go through every day of the month and put the date on the calendar in the first row.
   For datDay = DateSerial(iYear, iMonth, 1) To DateSerial(iYear, iMonth + 1, 0)
      iCol = iCol + 1
      Set rng = Range(Cells(1, iCol), Cells(WorksheetFunction.CountA(Columns(1)), iCol))

      'Determine if the day is a holiday.
      var = Application.Match(CDbl(datDay), ThisWorkbook.Worksheets("Holidays").Columns(1), 0)
      Cells(1, iCol).Value = datDay

      'Add the appropriate formatting that indicates a holiday or weekend.
      With rng.Interior
         Select Case Weekday(datDay)
            Case 1
               .ColorIndex = 35
            Case 7
               .ColorIndex = 36
         End Select
         If Not IsError(var) Then
            .ColorIndex = 34
            Set cmt = Cells(1, iCol).AddComment( _
               ThisWorkbook.Worksheets("Holidays").Cells(var, 2).Value)
            cmt.Shape.TextFrame.AutoSize = True
         End If
      End With
   Next datDay
End Sub

'Name: WithHsansW (with holidays, without weekends)
'Description: Creates a calendar for the specified month, including holidays, but not weekends.
Private Sub WithHsansW(ByVal iMonth As Integer)
   'Declare your variables.
   Dim datDay As Date
   Dim iYear As Integer, iCol As Integer
   iCol = 1
   iYear = Cover.SpinButton1.Value

   'For every day in the month, determine if the day is a weekend.
   For datDay = DateSerial(iYear, iMonth, 1) To DateSerial(iYear, iMonth + 1, 0)

      'If the day is not a weekend, put it on the calendar.
      If WorksheetFunction.Weekday(datDay, 2) < 6 Then
         iCol = iCol + 1
         Cells(1, iCol).Value = datDay
      End If
   Next datDay
End Sub

'Name: WithWsansH (with weekends, without holidays)
'Description: Creates a calendar for the specified month, including weekends, but not holidays.
Private Sub WithWsansH(ByVal iMonth As Integer)
   'Declare your variables.
   Dim var As Variant
   Dim datDay As Date
   Dim iYear As Integer, iCol As Integer
   iCol = 1
   iYear = Cover.SpinButton1.Value

   'For every day in the month, determine if the day is a holiday.
   For datDay = DateSerial(iYear, iMonth, 1) To DateSerial(iYear, iMonth + 1, 0)
      var = Application.Match(CDbl(datDay), ThisWorkbook.Worksheets("Holidays").Columns(1), 0)

      'If the day is not a holiday, put it on the calendar.
      If IsError(var) Then
         iCol = iCol + 1
         Cells(1, iCol).Value = datDay
      End If
   Next datDay
End Sub

'Name: SansWH (without weekends or holidays)
'Description: Creates a calendar for the specified month, not including weekends or holidays.
Private Sub SansWH(ByVal iMonth As Integer)
   'Set up your variables
   Dim var As Variant
   Dim datDay As Date
   Dim iYear As Integer, iCol As Integer
   iCol = 1
   iYear = Cover.SpinButton1.Value

   'For every day in the month, determine if the day is a weekend or a holiday.
   For datDay = DateSerial(iYear, iMonth, 1) To DateSerial(iYear, iMonth + 1, 0)
      If WorksheetFunction.Weekday(datDay, 2) < 6 Then
         var = Application.Match(CDbl(datDay), ThisWorkbook.Worksheets("Holidays").Columns(1), 0)

         'If the day is not a weekend or a holiday, put it on the calender.
         If IsError(var) Then
            iCol = iCol + 1
            Cells(1, iCol).Value = datDay
         End If
      End If
   Next datDay
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.


How to: Create a Workbook

 Copy code hover
[image]

How to: Create a Workbook
Send feedback

Published: July 16, 2012

To create a workbook in Visual Basic, use the Add method. The following procedure creates a workbook. Microsoft Excel automatically names the workbook BookN, where N is the next available number. The new workbook becomes the active workbook.

Copy code Copy code
Sub AddOne()
 Workbooks.Add
End Sub

A better way to create a workbook is to assign it to an object variable. In the following example, the Workbook object returned by the Add method is assigned to an object variable, newBook. Next, several properties of newBook are set. You can easily control the new workbook by using the object variable.

Copy code Copy code
Sub AddNew()
Set NewBook = Workbooks.Add
 With NewBook
 .Title = "All Sales"
 .Subject = "Sales"
 .SaveAs Filename:="Allsales.xls"
 End With
End Sub


How to: Create or Replace a Worksheet

 Copy code hover
[image]

How to: Create or Replace a Worksheet
Send feedback

Published: July 16, 2012

The following examples show how to determine if a worksheet exists, and then how to create or replace the worksheet.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

Determining if a Worksheet Exists

This example shows how to determine if a worksheet named "Sheet4" exists by using the Name property of the Worksheet object. The name of the worksheet is specified by the mySheetName variable.

VBA Copy code Copy code
Sub TestSheetYesNo()
    Dim mySheetName As String, mySheetNameTest As String
    mySheetName = "Sheet4"

    On Error Resume Next
    mySheetNameTest = Worksheets(mySheetName).Name
    If Err.Number = 0 Then
        MsgBox "The sheet named ''" & mySheetName & "'' DOES exist in this workbook."
    Else
        Err.Clear
        MsgBox "The sheet named ''" & mySheetName & "'' does NOT exist in this workbook."
    End If
End Sub

Creating the Worksheet

This example shows how to determine if a worksheet named "Sheet4" exists. The name of the worksheet is specified by the mySheetName variable. If the worksheet does not exist, this example shows how to create a worksheet named "Sheet4" by using the Add method of the Worksheets object.

VBA Copy code Copy code
Sub TestSheetCreate()
    Dim mySheetName As String, mySheetNameTest As String
    mySheetName = "Sheet4"

    On Error Resume Next
    mySheetNameTest = Worksheets(mySheetName).Name
    If Err.Number = 0 Then
        MsgBox "The sheet named ''" & mySheetName & "'' DOES exist in this workbook."
    Else
        Err.Clear
        Worksheets.Add.Name = mySheetName
        MsgBox "The sheet named ''" & mySheetName & "'' did not exist in this workbook but it has been created now."
    End If
End Sub

Replacing the Worksheet

This example shows how to determine if a worksheet named "Sheet4" exists. The name of the worksheet is specified by the mySheetName variable. If the worksheet does exist, this example shows how to delete the existing worksheet by using the Delete method of the Worksheet object, and then creates a new worksheet named "Sheet4".

Important note Important

All the data on the original worksheet named "Sheet4" is deleted when the worksheet is deleted.

VBA Copy code Copy code
Sub TestSheetReplace()
    Dim mySheetName As String
    mySheetName = "Sheet4"

    Application.DisplayAlerts = False
    On Error Resume Next
    Worksheets(mySheetName).Delete
    Err.Clear
    Application.DisplayAlerts = True
    Worksheets.Add.Name = mySheetName
    MsgBox "The sheet named ''" & mySheetName & "'' has been replaced."
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Name a Worksheet By Using a Cell Value

 Copy code hover
[image]

How to: Name a Worksheet By Using a Cell Value
Send feedback

Published: July 16, 2012

This example shows how to name a worksheet by using the value in cell A1 on that sheet. This example verifies that the value in cell A1 is a valid worksheet name, and if it is a valid name, renames the active worksheet to equal the value of cell A1 by using the Name property of the Worksheet object.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Private Sub Worksheet_Change(ByVal Target As Range)
    'Specify the target cell whose entry shall be the sheet tab name.
    If Target.Address <> "$A$1" Then Exit Sub
        'If the target cell is empty (contents cleared) then do not change the shet name
    If IsEmpty(Target) Then Exit Sub

    'If the length of the target cell's entry is greater than 31 characters, disallow the entry.
    If Len(Target.Value) > 31 Then
        MsgBox "Worksheet tab names cannot be greater than 31 characters in length." & vbCrLf & _
        "You entered " & Target.Value & ", which has " & Len(Target.Value) & " characters.", , "Keep it under 31 characters"
        Application.EnableEvents = False
        Target.ClearContents
        Application.EnableEvents = True
        Exit Sub
    End If

    'Sheet tab names cannot contain the characters /, \, [, ], *, ?, or :.
    'Verify that none of these characters are present in the cell's entry.
    Dim IllegalCharacter(1 To 7) As String, i As Integer
    IllegalCharacter(1) = "/"
    IllegalCharacter(2) = "\"
    IllegalCharacter(3) = "["
    IllegalCharacter(4) = "]"
    IllegalCharacter(5) = "*"
    IllegalCharacter(6) = "?"
    IllegalCharacter(7) = ":"
    For i = 1 To 7
        If InStr(Target.Value, (IllegalCharacter(i))) > 0 Then
            MsgBox "You used a character that violates sheet naming rules." & vbCrLf & vbCrLf & _
            "Please re-enter a sheet name without the ''" & IllegalCharacter(i) & "'' character.", 48, "Not a possible sheet name !!"
            Application.EnableEvents = False
            Target.ClearContents
            Application.EnableEvents = True
            Exit Sub
        End If
    Next i

    'Verify that the proposed sheet name does not already exist in the workbook.
    Dim strSheetName As String, wks As Worksheet, bln As Boolean
    strSheetName = Trim(Target.Value)
    On Error Resume Next
    Set wks = ActiveWorkbook.Worksheets(strSheetName)
    On Error Resume Next
    If Not wks Is Nothing Then
        bln = True
    Else
        bln = False
        Err.Clear
    End If

    'If the worksheet name does not already exist, name the active sheet as the target cell value.
    'Otherwise, advise the user that duplicate sheet names are not allowed.
    If bln = False Then
        ActiveSheet.Name = strSheetName
    Else
        MsgBox "There is already a sheet named " & strSheetName & "." & vbCrLf & _
        "Please enter a unique name for this sheet."
        Application.EnableEvents = False
        Target.ClearContents
        Application.EnableEvents = True
    End If

End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Refer to More Than One Sheet

 Copy code hover
[image]

How to: Refer to More Than One Sheet
Send feedback

Published: July 16, 2012

Use the Array function to identify a group of sheets. The following example selects three sheets in the active workbook.

Copy code Copy code
Sub Several()
 Worksheets(Array("Sheet1", "Sheet2", "Sheet4")).Select
End Sub


How to: Refer to Sheets by Index Number

 Copy code hover
[image]

How to: Refer to Sheets by Index Number
Send feedback

Published: July 16, 2012

An index number is a sequential number assigned to a sheet, based on the position of its sheet tab (counting from the left) among sheets of the same type. The following procedure uses the Worksheets property to activate the first worksheet in the active workbook.

Copy code Copy code
Sub FirstOne()
 Worksheets(1).Activate
End Sub

If you want to work with all types of sheets (worksheets, charts, modules, and dialog sheets), use the Sheets property. The following procedure activates sheet four in the workbook.

Copy code Copy code
Sub FourthOne()
 Sheets(4).Activate
End Sub
Note Note

The index order can change if you move, add, or delete sheets.


How to: Refer to Sheets by Name

 Copy code hover
[image]

How to: Refer to Sheets by Name
Send feedback

Published: July 16, 2012

You can identify sheets by name using the Worksheets and Charts properties. The following statements activate various sheets in the active workbook.

Copy code Copy code
Worksheets("Sheet1").Activate
Charts("Chart1").Activate
Copy code Copy code
DialogSheets("Dialog1").Activate

You can use the Sheets property to return a worksheet, chart, module, or dialog sheet. The Sheets collection contains all of these kinds of sheets. The following example activates the sheet named "Chart1" in the active workbook.

Copy code Copy code
Sub ActivateChart()
 Sheets("Chart1").Activate
End Sub
Note Note

Charts embedded in a worksheet are members of the ChartObjects collection, whereas charts that exist on their own sheets belong to the Charts collection.


How to: Sort Worksheets Alphanumerically by Name

 Copy code hover
[image]

How to: Sort Worksheets Alphanumerically by Name
Send feedback

Published: July 16, 2012

The following example shows how to sort the worksheets in a workbook alphanumerically based on the name of the sheet by using the Name property of the Worksheet object.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Sub SortSheetsTabName()
    Application.ScreenUpdating = False
    Dim iSheets%, i%, j%
    iSheets = Sheets.Count
    For i = 1 To iSheets - 1
        For j = i + 1 To iSheets
            If Sheets(j).Name < Sheets(i).Name Then
                Sheets(j).Move before:=Sheets(i)
            End If
        Next j
    Next i
    Application.ScreenUpdating = True
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How Do I... with Cells and Ranges

 Copy code hover
[image]

How Do I... with Cells and Ranges
Send feedback

Published: July 16, 2012

This topic links to programming tasks (how-to and walkthrough topics) for common cells and ranges scenarios.

"How Do I ..." is your gateway to key task-based topics about programming and application development using Excel. The links provide pointers to important, procedure-based Help topics.

Cells and Ranges

  • How to: Create an HTML File with a Table of Contents based on Cell Data

    • Describes how to take data from a worksheet and create a table of contents in an HTML file.

  • How to: Delete Duplicate Entries in a Range

    • Describes how to delete duplicate entries in a range.

  • How to: Fill a Value Down into Blank Cells in a Column

    • Describes how to fill a value down into blank cells.

  • How to: Hide and Unhide Columns

    • Describes how to find all the cells that contain a certain value and hide or unhide the columns that contain that value.

  • How to: Highlight the Active Cell, Row, or Column

    • Describes how to highlight the active cell, or column with a color.

  • How to: Make a Cell Blink

    • Describes how to make a cell blink by changing the color of the cell.

  • How to: Prevent Duplicate Entries in a Range

    • Describes how to prevent duplicate entries of a value in a given range.

  • How to: Reference Cells and Ranges

    • Describes how to reference cells and ranges in order to do enter formulas or change formats.

  • How to: Refer to All the Cells on the Worksheet

    • Describes how to refer to all cells on a worksheet.

  • How to: Refer to Cells and Ranges by Using A1 Notation

    • Describes how to refer to cells and ranges by using A1 notation.

  • How to: Refer to Cells by Using a Range Object

    • Describes how to refer to cells by using a Range object.

  • How to: Refer to Cells by Using Index Numbers

    • Describes how to refer to cells by using index numbers.

  • How to: Refer to Cells by Using Shortcut Notation

    • Describes how to refer to cells by using shortcut notation.

  • How to: Refer to Cells Relative to Other Cells

    • Describes how to refer to cells relative to other cells.

  • How to: Refer to Multiple Ranges

    • Describes how to refer to multiple ranges.

  • How to: Refer to Named Ranges

    • Describes how to refer to named ranges.

  • How to: Refer to Rows and Columns

    • Describes how to refer to rows and columns in Excel.

  • How to: Select a Range

    • Describes how to select the used range and the data range on a worksheet.


How to: Create an HTML File with a Table of Contents based on Cell Data

 Copy code hover
[image]

How to: Create an HTML File with a Table of Contents based on Cell Data
Send feedback

Published: July 16, 2012

This code example shows how to take data from a worksheet and create a table of contents in an HTML file. The worksheet should have data in columns A, B, and C that correspond to the first, second, and third levels of the table of contents hierarchy. The HTML file is stored in the same working folder as the active workbook.

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

VBA Copy code Copy code
Sub CreateHTML()
   'Define your variables.
   Dim iRow As Long
   Dim iStage As Integer
   Dim iCounter As Integer
   Dim iPage As Integer

   'Create an .htm file in the same directory as your active workbook.
   Dim sFile As String
   sFile = ActiveWorkbook.Path & "\test.htm"
   Close

   'Open up the temp HTML file and format the header.
   Open sFile For Output As #1
   Print #1, "<html>"
   Print #1, "<head>"
   Print #1, "<style type=""text/css"">"
   Print #1, "  body { font-size:12px;font-family:tahoma } "
   Print #1, "</style>"
   Print #1, "</head>"
   Print #1, "<body>"

   'Start on the 2nd row to avoid the header.
   iRow = 2

   'Translate the first column of the table into the first level of the hierarchy.
   Do While WorksheetFunction.CountA(Rows(iRow)) > 0
      If Not IsEmpty(Cells(iRow, 1)) Then
         For iCounter = 1 To iStage
            Print #1, "</ul>"
            iStage = iStage - 1
         Next iCounter
         Print #1, "<ul>"
         Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 1).Value & "</a>"
         iPage = iPage + 1
         If iStage < 1 Then
            iStage = iStage + 1
         End If
      End If

    'Translate the second column of the table into the second level of the hierarchy.
      If Not IsEmpty(Cells(iRow, 2)) Then
         For iCounter = 2 To iStage
            Print #1, "</ul>"
            iStage = iStage - 1
         Next iCounter
         Print #1, "<ul>"
         Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 2).Value & "</a>"
         iPage = iPage + 1
         If iStage < 2 Then
            iStage = iStage + 1
         End If
      End If

      'Translate the third column of the table into the third level of the hierarchy.
      If Not IsEmpty(Cells(iRow, 3)) Then
         If iStage < 3 Then
            Print #1, "<ul>"
         End If
         Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 3).Value & "</a>"
         iPage = iPage + 1
         If iStage < 3 Then
            iStage = iStage + 1
         End If
      End If
      iRow = iRow + 1
   Loop

   'Add ending HTML tags
   For iCounter = 2 To iStage
      Print #1, "    </ul>"
      iStage = iStage - 1
   Next iCounter
   Print #1, "</body>"
   Print #1, "</html>"
   Close
   Shell "hh " & vbLf & sFile, vbMaximizedFocus
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.


How to: Delete Duplicate Entries in a Range

 Copy code hover
[image]

How to: Delete Duplicate Entries in a Range
Send feedback

Published: July 16, 2012

The following example shows how to take a range of data in column A and delete duplicate entries. This example uses the AdvancedFilter method of the Range object with the Unique parameter equal to True to get the unique list of data. The Action parameter equals xlFilterInPlace, specifying that the data is filtered in place. If you want to retain your original data, set the Action parameter equal to xlFilterCopy and specify the location where you want the filtered data copied in the CopyToRange parameter. Once the unique values are filtered, this example uses the SpecialCells method of the Range object to find any remaining blank rows and deletes them.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Sub DeleteDuplicates()
    With Application
        ' Turn off screen updating to increase performance
        .ScreenUpdating = False
        Dim LastColumn As Integer
        LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1
        With Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
            ' Use AdvanceFilter to filter unique values
            .AdvancedFilter Action:=xlFilterInPlace, Unique:=True
            .SpecialCells(xlCellTypeVisible).Offset(0, LastColumn - 1).Value = 1
            On Error Resume Next
            ActiveSheet.ShowAllData
            'Delete the blank rows
            Columns(LastColumn).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
            Err.Clear
        End With
        Columns(LastColumn).Clear
        .ScreenUpdating = True
    End With
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Fill a Value Down into Blank Cells in a Column

 Copy code hover
[image]

How to: Fill a Value Down into Blank Cells in a Column
Send feedback

Published: July 16, 2012

The following example looks at column A, and if there is a blank cell, sets the value of the blank cell to equal the value of the cell above it. This continues down the entire column, filling a value down into each blank cell.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Sub FillCellsFromAbove()
    ' Turn off screen updating to improve performance
    Application.ScreenUpdating = False
    On Error Resume Next
    ' Look in column A
    With Columns(1)
        ' For blank cells, set them to equal the cell above
        .SpecialCells(xlCellTypeBlanks).Formula = "=R[-1]C"
        'Convert the formula to a value
        .Value = .Value
    End With
    Err.Clear
    Application.ScreenUpdating = True
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Hide and Unhide Columns

 Copy code hover
[image]

How to: Hide and Unhide Columns
Send feedback

Published: July 16, 2012

This example finds all the cells in the first four columns that have a constant "X" in them and hides the column that contains the X.

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Hide_Columns()

    'Excel objects.
    Dim m_wbBook As Workbook
    Dim m_wsSheet As Worksheet
    Dim m_rnCheck As Range
    Dim m_rnFind As Range
    Dim m_stAddress As String

    'Initialize the Excel objects.
    Set m_wbBook = ThisWorkbook
    Set m_wsSheet = m_wbBook.Worksheets("Sheet1")

    'Search the four columns for any constants.
    Set m_rnCheck = m_wsSheet.Range("A1:D1").SpecialCells(xlCellTypeConstants)

    'Retrieve all columns that contain an X. If there is at least one, begin the DO/WHILE loop.
    With m_rnCheck
        Set m_rnFind = .Find(What:="X")
        If Not m_rnFind Is Nothing Then
            m_stAddress = m_rnFind.Address

            'Hide the column, and then find the next X.
            Do
                m_rnFind.EntireColumn.Hidden = True
                Set m_rnFind = .FindNext(m_rnFind)
            Loop While Not m_rnFind Is Nothing And m_rnFind.Address <> m_stAddress
        End If
    End With

End Sub

This example finds all the cells in the first four columns that have a constant "X" in them and unhides the column that contains the X.

VBA Copy code Copy code
Sub Unhide_Columns()
    'Excel objects.
    Dim m_wbBook As Workbook
    Dim m_wsSheet As Worksheet
    Dim m_rnCheck As Range
    Dim m_rnFind As Range
    Dim m_stAddress As String

    'Initialize the Excel objects.
    Set m_wbBook = ThisWorkbook
    Set m_wsSheet = m_wbBook.Worksheets("Sheet1")

    'Search the four columns for any constants.
    Set m_rnCheck = m_wsSheet.Range("A1:D1").SpecialCells(xlCellTypeConstants)

    'Retrieve all columns that contain X. If there is at least one, begin the DO/WHILE loop.
    With m_rnCheck
        Set m_rnFind = .Find(What:="X", LookIn:=xlFormulas)
        If Not m_rnFind Is Nothing Then
            m_stAddress = m_rnFind.Address

            'Unhide the column, and then find the next X.
            Do
                m_rnFind.EntireColumn.Hidden = False
                Set m_rnFind = .FindNext(m_rnFind)
            Loop While Not m_rnFind Is Nothing And m_rnFind.Address <> m_stAddress
        End If
    End With

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


How to: Highlight the Active Cell, Row, or Column

 Copy code hover
[image]

How to: Highlight the Active Cell, Row, or Column
Send feedback

Published: July 16, 2012

The following code examples show ways to highlight the active cell or the rows and columns that contain the active cell. These examples use the SelectionChange event of the Worksheet object.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

Highlighting the Active Cell

The following code example clears the color in all the cells on the worksheet by setting the ColorIndex property equal to 0, and then highlights the active cell by setting the ColorIndex property equal to 8 (Turquoise).

VBA Copy code Copy code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    ' Clear the color of all the cells
    Cells.Interior.ColorIndex = 0
    ' Highlight the active cell
    Target.Interior.ColorIndex = 8
    Application.ScreenUpdating = True
End Sub

Highlighting the Entire Row and Column that Contain the Active Cell

The following code example clears the color in all the cells on the worksheet by setting the ColorIndex property equal to 0, and then highlights the entire row and column that contain the active cell by using the EntireRow and EntireColumn properties.

VBA Copy code Copy code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    Application.ScreenUpdating = False
    ' Clear the color of all the cells
    Cells.Interior.ColorIndex = 0
    With Target
        ' Highlight the entire row and column that contain the active cell
        .EntireRow.Interior.ColorIndex = 8
        .EntireColumn.Interior.ColorIndex = 8
    End With
    Application.ScreenUpdating = True
End Sub

Highlighting the Row and Column that Contain the Active Cell, Within the Current Region

The following code example clears the color in all the cells on the worksheet by setting the ColorIndex property equal to 0, and then highlights the row and column that contain the active cell, within the current region by using the CurrentRegion property of the Range object.

VBA Copy code Copy code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ' Clear the color of all the cells
    Cells.Interior.ColorIndex = 0
    If IsEmpty(Target) Or Target.Cells.Count > 1 Then Exit Sub
    Application.ScreenUpdating = False
    With ActiveCell
        ' Highlight the row and column that contain the active cell, within the current region
        Range(Cells(.Row, .CurrentRegion.Column), Cells(.Row, .CurrentRegion.Columns.Count + .CurrentRegion.Column - 1)).Interior.ColorIndex = 8
        Range(Cells(.CurrentRegion.Row, .Column), Cells(.CurrentRegion.Rows.Count + .CurrentRegion.Row - 1, .Column)).Interior.ColorIndex = 8
    End With
    Application.ScreenUpdating = True
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Make a Cell Blink

 Copy code hover
[image]

How to: Make a Cell Blink
Send feedback

Published: July 16, 2012

This example shows how to make cell B2 on sheet 1 blink by changing the color and the text back and forth from red to white in the StartBlinking procedure. The StopBlinking procedure shows how to stop the blinking by clearing the value of the cell and setting the ColorIndex property to white.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Option Explicit

Public NextBlink As Double
'The cell that you want to blink
Public Const BlinkCell As String = "Sheet1!B2"

'Start blinking
Private Sub StartBlinking()
    Application.Goto Range("A1"), 1
    'If the color is red, change the color and text to white
    If Range(BlinkCell).Interior.ColorIndex = 3 Then
        Range(BlinkCell).Interior.ColorIndex = 0
        Range(BlinkCell).Value = "White"
    'If the color is white, change the color and text to red
    Else
        Range(BlinkCell).Interior.ColorIndex = 3
        Range(BlinkCell).Value = "Red"
    End If
    'Wait one second before changing the color again
    NextBlink = Now + TimeSerial(0, 0, 1)
    Application.OnTime NextBlink, "StartBlinking", , True
End Sub

'Stop blkinking
Private Sub StopBlinking()
    'Set color to white
    Range(BlinkCell).Interior.ColorIndex = 0
    'Clear the value in the cell
    Range(BlinkCell).ClearContents
    On Error Resume Next
    Application.OnTime NextBlink, "StartBlinking", , False
    Err.Clear
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Prevent Duplicate Entries in a Range

 Copy code hover
[image]

How to: Prevent Duplicate Entries in a Range
Send feedback

Published: July 16, 2012

The following code example verifies that a value entered in the range A1:B20 exists within that range on any of the worksheets in the current workbook and prevents duplicate entries if the value exists.

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

VBA Copy code Copy code
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

    'Define your variables.
    Dim ws As Worksheet, EvalRange As Range

    'Set the range where you want to prevent duplicate entries.
    Set EvalRange = Range("A1:B20")

    'If the cell where value was entered is not in the defined range, if the value pasted is larger than a single cell,
    'or if no value was entered in the cell, then exit the macro.
    If Intersect(Target, EvalRange) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
    If IsEmpty(Target) Then Exit Sub

    'If the value entered already exists in the defined range on the current worksheet, throw an
    'error message and undo the entry.
    If WorksheetFunction.CountIf(EvalRange, Target.Value) > 1 Then
        MsgBox Target.Value & " already exists on this sheet."
        Application.EnableEvents = False
        Application.Undo
        Application.EnableEvents = True
    End If

    'Check the other worksheets in the workbook.
    For Each ws In Worksheets
        With ws
            If .Name <> Target.Parent.Name Then
                'If the value entered already exists in the defined range on the current worksheet, throw an
                'error message and undo the entry.
                If WorksheetFunction.CountIf(Sheets(.Name).Range("A1:B20"), Target.Value) > 0 Then
                    MsgBox Target.Value & " already exists on the sheet named " & .Name & ".", _
                    16, "No duplicates allowed in " & EvalRange.Address(0, 0) & "."
                    Application.EnableEvents = False
                    Application.Undo
                    Application.EnableEvents = True
                    Exit For
                End If
            End If
        End With
    Next ws

End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.


How to: Reference Cells and Ranges

 Copy code hover
[image]

How to: Reference Cells and Ranges
Send feedback

Published: July 16, 2012

A common task when using Visual Basic is to specify a cell or range of cells and then do something with it, such as enter a formula or change the format. You can usually do this in one statement that identifies the range and also changes a property or applies a method.

A Range object in Visual Basic can be either a single cell or a range of cells. The following topics show the most common ways to identify and work with Range objects.

Some ways to reference cells

  • How to: Refer to All the Cells on the Worksheet

  • How to: Refer to Cells and Ranges by Using A1 Notation

  • How to: Refer to Rows and Columns

  • How to: Refer to Cells by Using Index Numbers

  • How to: Refer to Cells by Using Shortcut Notation

  • How to: Refer to Cells Relative to Other Cells

  • How to: Refer to Cells by Using a Range Object

  • How to: Refer to Named Ranges

  • How to: Refer to Multiple Ranges


How to: Refer to All the Cells on the Worksheet

 Copy code hover
[image]

How to: Refer to All the Cells on the Worksheet
Send feedback

Published: July 16, 2012

When you apply the Cells property to a worksheet without specifying an index number, the method returns a Range object that represents all the cells on the worksheet. The following Sub procedure clears the contents from all the cells on Sheet1 in the active workbook.

Copy code Copy code
Sub ClearSheet()
 Worksheets("Sheet1").Cells.ClearContents
End Sub


How to: Refer to Cells and Ranges by Using A1 Notation

 Copy code hover
[image]

How to: Refer to Cells and Ranges by Using A1 Notation
Send feedback

Published: July 16, 2012

You can refer to a cell or range of cells in the A1 reference style by using the Range property. The following subroutine changes the format of cells A1:D5 to bold.

Copy code Copy code
Sub FormatRange()
 Workbooks("Book1").Sheets("Sheet1").Range("A1:D5") _
 .Font.Bold = True
End Sub

The following table illustrates some A1-style references using the Range property.

Reference | Meaning
Range("A1") | Cell A1
Range("A1:B5") | Cells A1 through B5
Range("C5:D9,G9:H16") | A multiple-area selection
Range("A:A") | Column A
Range("1:1") | Row 1
Range("A:C") | Columns A through C
Range("1:5") | Rows 1 through 5
Range("1:1,3:3,8:8") | Rows 1, 3, and 8
Range("A:A,C:C,F:F") | Columns A, C, and F


How to: Refer to Cells by Using a Range Object

 Copy code hover
[image]

How to: Refer to Cells by Using a Range Object
Send feedback

Published: July 16, 2012

If you set an object variable to a Range object, you can easily manipulate the range by using the variable name.

The following procedure creates the object variable myRange and then assigns the variable to range A1:D5 on Sheet1 in the active workbook. Subsequent statements modify properties of the range by substituting the variable name for the Range object.

VBA Copy code Copy code
Sub Random()
 Dim myRange As Range
 Set myRange = Worksheets("Sheet1").Range("A1:D5")
 myRange.Formula = "=RAND()"
 myRange.Font.Bold = True
End Sub


How to: Refer to Cells by Using Index Numbers

 Copy code hover
[image]

How to: Refer to Cells by Using Index Numbers
Send feedback

Published: July 16, 2012

You can use the Cells property to refer to a single cell by using row and column index numbers. This property returns a Range object that represents a single cell. In the following example, Cells(6,1) returns cell A6 on Sheet1. The Value property is then set to 10.

VBA Copy code Copy code
Sub EnterValue()
 Worksheets("Sheet1").Cells(6, 1).Value = 10
End Sub

The Cells property works well for looping through a range of cells, because you can substitute variables for the index numbers, as shown in the following example.

VBA Copy code Copy code
Sub CycleThrough()
 Dim Counter As Integer
 For Counter = 1 To 20
 Worksheets("Sheet1").Cells(Counter, 3).Value = Counter
 Next Counter
End Sub
Note Note

If you want to change the properties of (or apply a method to) a range of cells all at once, use the Range property. For more information, see Refer to Cells and Ranges by Using A1 Notation.


How to: Refer to Cells by Using Shortcut Notation

 Copy code hover
[image]

How to: Refer to Cells by Using Shortcut Notation
Send feedback

Published: July 16, 2012

You can use either the A1 reference style or a named range within brackets as a shortcut for the Range property. You do not have to type the word "Range" or use quotation marks, as shown in the following examples.

Copy code Copy code
Sub ClearRange()
 Worksheets("Sheet1").[A1:B5].ClearContents
End Sub

Sub SetValue()
 [MyRange].Value = 30
End Sub


How to: Refer to Cells Relative to Other Cells

 Copy code hover
[image]

How to: Refer to Cells Relative to Other Cells
Send feedback

Published: July 16, 2012

A common way to work with a cell relative to another cell is to use the Offset property. In the following example, the contents of the cell that is one row down and three columns over from the active cell on the active worksheet are formatted as double-underlined.

Copy code Copy code
Sub Underline()
 ActiveCell.Offset(1, 3).Font.Underline = xlDouble
End Sub
Note Note

You can record macros that use the Offset property to specify relative references instead of absolute references. To do that, on the Developer tab, click Use Relative References, and then click Record Macro.

To loop through a range of cells, use a variable with the Cells property in a loop. The following example fills the first 20 cells in the third column with values between 5 and 100, incremented by 5. The variable counter is used as the row index for the Cells property.

Copy code Copy code
Sub CycleThrough()
 Dim counter As Integer
 For counter = 1 To 20
 Worksheets("Sheet1").Cells(counter, 3).Value = counter * 5
 Next counter
End Sub


Submit time and task status in Project Server 2013

 Copy code hover
[image]

Submit time and task status in Project Server 2013
Send feedback

Published: July 16, 2012

By using the appropriate method, you can easily refer to multiple ranges. Use the Range and Union methods to refer to any group of ranges. Use the Areas property to refer to the group of ranges selected on a worksheet.

Using the Range Property

You can refer to multiple ranges with the Range property by inserting commas between two or more references. The following example clears the contents of three ranges on Sheet1.

Copy code Copy code
Sub ClearRanges()
 Worksheets("Sheet1").Range("C5:D9,G9:H16,B14:D18"). _
 ClearContents
End Sub

Named ranges make it easier to use the Range property to work with multiple ranges. The following example works when all three named ranges are on the same sheet.

Copy code Copy code
Sub ClearNamed()
 Range("MyRange, YourRange, HisRange").ClearContents
End Sub

Using the Union Method

You can combine multiple ranges into one Range object by using the Union method. The following example creates a Range object called myMultipleRange, defines it as the ranges A1:B2 and C3:D4, and then formats the combined ranges as bold.

Copy code Copy code
Sub MultipleRange()
 Dim r1, r2, myMultipleRange As Range
 Set r1 = Sheets("Sheet1").Range("A1:B2")
 Set r2 = Sheets("Sheet1").Range("C3:D4")
 Set myMultipleRange = Union(r1, r2)
 myMultipleRange.Font.Bold = True
End Sub

Using the Areas Property

You can use the Areas property to refer to the selected range or to the collection of ranges in a multiple-area selection. The following procedure counts the areas in the selection. If there is more than one area, a warning message is displayed.

Copy code Copy code
Sub FindMultiple()
 If Selection.Areas.Count > 1 Then
 MsgBox "Cannot do this to a multiple selection."
 End If
End Sub


How to: Refer to Named Ranges

 Copy code hover
[image]

How to: Refer to Named Ranges
Send feedback

Published: July 16, 2012

Ranges are easier to identify by name than by A1 notation. To name a selected range, click the name box at the left end of the formula bar, type a name, and then press ENTER.

Referring to a Named Range

The following example refers to the range named "MyRange" in the workbook named "MyBook.xls."

Copy code Copy code
Sub FormatRange()
    Range("MyBook.xls!MyRange").Font.Italic = True
End Sub

The following example refers to the worksheet-specific range named "Sheet1!Sales" in the workbook named "Report.xls."

Copy code Copy code
Sub FormatSales()
    Range("[Report.xls]Sheet1!Sales").BorderAround Weight:=xlthin
End Sub

To select a named range, use the GoTo method, which activates the workbook and the worksheet and then selects the range.

Copy code Copy code
Sub ClearRange()
    Application.Goto Reference:="MyBook.xls!MyRange"
    Selection.ClearContents
End Sub

The following example shows how the same procedure would be written for the active workbook.

Copy code Copy code
Sub ClearRange()
    Application.Goto Reference:="MyRange"
    Selection.ClearContents
End Sub

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example uses a named range as the formula for data validation. This example requires the validation data to be on Sheet 2 in the range A2:A100. This validation data is used to validate data entered on Sheet 1 in the range D2:D10.

VBA Copy code Copy code
Sub Add_Data_Validation_From_Other_Worksheet()
'The current Excel workbook and worksheet, a range to define the data to be validated, and the target range
'to place the data in.
Dim wbBook As Workbook
Dim wsTarget As Worksheet
Dim wsSource As Worksheet
Dim rnTarget As Range
Dim rnSource As Range

'Initialize the Excel objects and delete any artifacts from the last time the macro was run.
Set wbBook = ThisWorkbook
With wbBook
    Set wsSource = .Worksheets("Sheet2")
    Set wsTarget = .Worksheets("Sheet1")
    On Error Resume Next
    .Names("Source").Delete
    On Error GoTo 0
End With

'On the source worksheet, create a range in column A of up to 98 cells long, and name it "Source".
With wsSource
    .Range(.Range("A2"), .Range("A100").End(xlUp)).Name = "Source"
End With

'On the target worksheet, create a range 8 cells long in column D.
Set rnTarget = wsTarget.Range("D2:D10")

'Clear out any artifacts from previous macro runs, then set up the target range with the validation data.
With rnTarget
    .ClearContents
    With .Validation
        .Delete
        .Add Type:=xlValidateList, _
             AlertStyle:=xlValidAlertStop, _
             Formula1:="=Source"

'Set up the Error dialog with the appropriate title and message
        .ErrorTitle = "Value Error"
        .ErrorMessage = "You can only choose from the list."
    End With
End With

End Sub

Looping Through Cells in a Named Range

The following example loops through each cell in a named range by using a For Each...Next loop. If the value of any cell in the range exceeds the value of Limit, the cell color is changed to yellow.

Copy code Copy code
Sub ApplyColor()
    Const Limit As Integer = 25
    For Each c In Range("MyRange")
        If c.Value > Limit Then
            c.Interior.ColorIndex = 27
        End If
    Next c
End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


How to: Refer to Rows and Columns

 Copy code hover
[image]

How to: Refer to Rows and Columns
Send feedback

Published: July 16, 2012

Use the Rows property or the Columns property to work with entire rows or columns. These properties return a Range object that represents a range of cells. In the following example, Rows(1) returns row one on Sheet1. The Bold property of the Font object for the range is then set to True.

Copy code Copy code
Sub RowBold()
    Worksheets("Sheet1").Rows(1).Font.Bold = True
End Sub

The following table illustrates some row and column references using the Rows and Columns properties.

Reference | Meaning
Rows(1) | Row one
Rows | All the rows on the worksheet
Columns(1) | Column one
Columns("A") | Column one
Columns | All the columns on the worksheet

To work with several rows or columns at the same time, create an object variable and use the Union method, combining multiple calls to the Rows or Columns property. The following example changes the format of rows one, three, and five on worksheet one in the active workbook to bold.

Copy code Copy code
Sub SeveralRows()
    Worksheets("Sheet1").Activate
    Dim myUnion As Range
    Set myUnion = Union(Rows(1), Rows(3), Rows(5))
    myUnion.Font.Bold = True
End Sub

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example deletes the empty rows from a selected range.

VBA Copy code Copy code
Sub Delete_Empty_Rows()
    'The range from which to delete the rows.
    Dim rnSelection As Range

    'Row and count variables used in the deletion process.
    Dim lnLastRow As Long
    Dim lnRowCount As Long
    Dim lnDeletedRows As Long

    'Initialize the number of deleted rows.
    lnDeletedRows = 0

    'Confirm that a range is selected, and that the range is contiguous.
    If TypeName(Selection) = "Range" Then
        If Selection.Areas.Count = 1 Then

            'Initialize the range to what the user has selected, and initialize the count for the upcoming FOR loop.
            Set rnSelection = Application.Selection
            lnLastRow = rnSelection.Rows.Count

            'Start at the bottom row and work up: if the row is empty then
            'delete the row and increment the deleted row count.
            For lnRowCount = lnLastRow To 1 Step -1
                If Application.CountA(rnSelection.Rows(lnRowCount)) = 0 Then
                    rnSelection.Rows(lnRowCount).Delete
                    lnDeletedRows = lnDeletedRows + 1
                End If
            Next lnRowCount

            rnSelection.Resize(lnLastRow - lnDeletedRows).Select
         Else
            MsgBox "Please select only one area.", vbInformation
         End If
    Else
        MsgBox "Please select a range.", vbInformation
    End If

    'Turn screen updating back on.
    Application.ScreenUpdating = True

End Sub

This example deletes the empty columns from a selected range.

VBA Copy code Copy code
Sub Delete_Empty_Columns()
    'The range from which to delete the columns.
    Dim rnSelection As Range

    'Column and count variables used in the deletion process.
    Dim lnLastColumn As Long
    Dim lnColumnCount As Long
    Dim lnDeletedColumns As Long

    lnDeletedColumns = 0

    'Confirm that a range is selected, and that the range is contiguous.
    If TypeName(Selection) = "Range" Then
        If Selection.Areas.Count = 1 Then

            'Initialize the range to what the user has selected, and initialize the count for the upcoming FOR loop.
            Set rnSelection = Application.Selection
            lnLastColumn = rnSelection.Columns.Count

            'Start at the far-right column and work left: if the column is empty then
            'delete the column and increment the deleted column count.
            For lnColumnCount = lnLastColumn To 1 Step -1
                If Application.CountA(rnSelection.Columns(lnColumnCount)) = 0 Then
                    rnSelection.Columns(lnColumnCount).Delete
                    lnDeletedColumns = lnDeletedColumns + 1
                End If
            Next lnColumnCount

            rnSelection.Resize(lnLastColumn - lnDeletedColumns).Select
        Else
            MsgBox "Please select only one area.", vbInformation
        End If
    Else
        MsgBox "Please select a range.", vbInformation
    End If

    'Turn screen updating back on.
    Application.ScreenUpdating = True

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


How to: Select a Range

 Copy code hover
[image]

How to: Select a Range
Send feedback

Published: July 16, 2012

These examples show how to select the used range, which includes formatted cells that do not contain data, and how to select a data range, which includes cells that contains actual data.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

Selecting the Used Range

This example shows how to select the used range on the current sheet, which includes formatted cells that do not contain data, by using the UsedRange property of the Worksheet object and the Select method of the Range object. Then it displays the address of the range to the user.

VBA Copy code Copy code
Sub SelectUsedRange()
    ActiveSheet.UsedRange.Select
    MsgBox "The used range address is " & ActiveSheet.UsedRange.Address(0, 0) & ".", 64, "Used range address:"
End Sub

Selecting a Data Range Starting at Cell A1

This example shows how to select a data range on the current sheet, starting at cell A1, and display the address of the range to the user. The data range does not include cells that are formatted that do not contain data. To get the data range, this example finds the last row and the last column that contain actual data by using the Find method of the Range object.

VBA Copy code Copy code
Sub SelectDataRange()
    Dim LastRow As Long, LastColumn As Long
    LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
    Range("A1").Resize(LastRow, LastColumn).Select
    MsgBox "The data range address is " & Selection.Address(0, 0) & ".", 64, "Data-containing range address:"
End Sub

Selecting a Data Range of Unknown Starting Location

This example shows how to select a data range on the current sheet when you do not know the starting location, and display the address of the range to the user. The data range does not include cells that are formatted that do not contain data. To get the data range, this example finds the first and last row and column that contain actual data by using the Find method of the Range object.

VBA Copy code Copy code
Sub UnknownRange()
    If WorksheetFunction.CountA(Cells) = 0 Then
        MsgBox "There is no range to be selected.", , "No cells contain any values."
        Exit Sub
    Else
        Dim FirstRow&, FirstCol&, LastRow&, LastCol&
        Dim myUsedRange As Range
        FirstRow = Cells.Find(What:="*", SearchDirection:=xlNext, SearchOrder:=xlByRows).Row

        On Error Resume Next
        FirstCol = Cells.Find(What:="*", SearchDirection:=xlNext, SearchOrder:=xlByColumns).Column
        If Err.Number <> 0 Then
            Err.Clear
            MsgBox _
            "There are horizontally merged cells on the sheet" & vbCrLf & _
            "that should be removed in order to locate the range.", 64, "Please unmerge all cells."
            Exit Sub
        End If

        LastRow = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
        LastCol = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
        Set myUsedRange = Range(Cells(FirstRow, FirstCol), Cells(LastRow, LastCol))
        myUsedRange.Select
        MsgBox "The data range on this worksheet is " & myUsedRange.Address(0, 0) & ".", 64, "Range address:"
    End If
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How Do I... with Controls, Dialog Boxes, and Forms

 Copy code hover
[image]

How Do I... with Controls, Dialog Boxes, and Forms
Send feedback

Published: July 16, 2012

This topic links to programming tasks (how-to and walkthrough topics) for common controls, dialog boxes, and forms scenarios.

"How Do I ..." is your gateway to key task-based topics about programming and application development using Excel. The links provide pointers to important, procedure-based Help topics.

Controls, Dialog Boxes, and Forms

  • How to: Add a Unique List of Values to a Combo Box

    • Describes how to take a list from a spreadsheet and use it to populate a combo box control using only the unique values.

  • How to: Add Controls to a Document

    • Describes how to add controls to a document.

  • How to: Add Controls to a User Form

    • Describes how to add controls to a user form.

  • How to: Automatically Dismiss a Message Box

    • Describes how to automatically dismiss a message box.

  • How to: Create a Custom Dialog Box

    • Describes how to create a custom dialog box.

  • How to: Create a Custom Menu That Calls a Macro

    • Describes how to create a custom menu with four menu options, each of which calls a macro.

  • How to: Create a User Form

    • Describes how to create a user form.


How to: Add a Unique List of Values to a Combo Box

 Copy code hover
[image]

How to: Add a Unique List of Values to a Combo Box
Send feedback

Published: July 16, 2012

These examples show different approaches for taking a list from a spreadsheet and using it to populate a combo box control using only the unique values. The first example uses the AdvancedFilter method of the Range object and the second uses the Collection object.

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

VBA Copy code Copy code
Sub Populate_Combobox_Worksheet()
    'The Excel workbook and worksheets that contain the data, as well as the range placed on that data
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim rnData As Range

    'Variant to contain the data to be placed in the combo box.
    Dim vaData As Variant

    'Initialize the Excel objects
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets("Sheet1")

    'Set the range equal to the data, and then (temporarily) copy the unique values of that data to the L column.
    With wsSheet
        Set rnData = .Range(.Range("A1"), .Range("A100").End(xlUp))
        rnData.AdvancedFilter Action:=xlFilterCopy, _
                          CopyToRange:=.Range("L1"), _
                          Unique:=True
        'store the unique values in vaData
        vaData = .Range(.Range("L2"), .Range("L100").End(xlUp)).Value
        'clean up the contents of the temporary data storage
        .Range(.Range("L1"), .Range("L100").End(xlUp)).ClearContents
    End With

    'display the unique values in vaData in the combo box already in existence on the worksheet.
    With wsSheet.OLEObjects("ComboBox1").Object
        .Clear
        .List = vaData
        .ListIndex = -1
    End With

End Sub
VBA Copy code Copy code
Sub Populate_Combobox_Worksheet_Collection()
    'The Excel workbook and worksheets that contain the data, as well as the range placed on that data
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim rnData As Range

    Dim vaData As Variant               'the list, stored in a variant

    Dim ncData As New VBA.Collection    'the list, stored in a collection

    Dim lnCount As Long                 'the count used in the On Error Resume Next loop.

    Dim vaItem As Variant               'a variant representing the type of items in ncData

    'Instantiate the Excel objects.
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets("Sheet2")

    'Using Sheet2,retrieve the range of the list in Column A.
    With wsSheet
        Set rnData = .Range(.Range("A2"), .Range("A100").End(xlUp))
    End With

    'Place the list values into vaData.
    vaData = rnData.Value

    'Place the list values from vaData into the VBA.Collection.
    On Error Resume Next
        For lnCount = 1 To UBound(vaData)
        ncData.Add vaData(lnCount, 1), CStr(vaData(lnCount, 1))
    Next lnCount
    On Error GoTo 0

    'Clear the combo box (in case you ran the macro before),
    'and then add each unique variant item from ncData to the combo box.
    With wsSheet.OLEObjects("ComboBox1").Object
        .Clear
        For Each vaItem In ncData
            .AddItem ncData(vaItem)
        Next vaItem
    End With

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


How to: Add Controls to a Document

 Copy code hover
[image]

How to: Add Controls to a Document
Send feedback

Published: July 16, 2012

To add controls to a document, display the Control Toolbox, click the control you want to add, and then click on the document. Drag an adjustment handle of the control until the control's outline is the size and shape you want.

Note Note

Dragging a control or a number of "grouped" controls from the form back to the Control Toolbox creates a template of the controls, which you can reuse. This is a useful feature for implementing a standard interface for your applications.


How to: Add Controls to a User Form

 Copy code hover
[image]

How to: Add Controls to a User Form
Send feedback

Published: July 16, 2012

To add controls to a user form, find the control you want to add in the Toolbox, drag the control onto the form, and then drag an adjustment handle on the control until the control's outline is the size and shape you want.

Note Note

Dragging a control, or a number of "grouped" controls from the form back to the Toolbox creates a template of the controls, which can be reused. This is a useful feature for implementing a standard interface for your applications.

After you have added controls to the form, use the commands on the Format menu in the Visual Basic Editor to adjust the control alignment and spacing.


How to: Automatically Dismiss a Message Box

 Copy code hover
[image]

How to: Automatically Dismiss a Message Box
Send feedback

Published: July 16, 2012

This example shows how to automatically dismiss a message box after a specified period of time. This example displays a message box and then automatically dismisses it after 10 seconds.

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

VBA Copy code Copy code
Sub MessageBoxTimer()
    Dim AckTime As Integer, InfoBox As Object
    Set InfoBox = CreateObject("WScript.Shell")
    'Set the message box to close after 10 seconds
    AckTime = 10
    Select Case InfoBox.Popup("Click OK (this window closes automatically after 10 seconds).", _
    AckTime, "This is your Message Box", 0)
        Case 1, -1
            Exit Sub
    End Select
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."


How to: Create a Custom Dialog Box

 Copy code hover
[image]

How to: Create a Custom Dialog Box
Send feedback

Published: July 16, 2012

Use the following procedure to create a custom dialog box:

  1. Create a User Form

    On the Insert menu in the Visual Basic Editor, click UserForm.

  2. Add Controls to a User Form

    Find the control you want to add in the Toolbox and drag the control onto the form.

  3. Setting Control Properties

    Right-click a control in design mode and click Properties to display the Properties window.

  4. Initializing Control Properties

    You can initialize controls in a procedure before you show a form, or you can add code to the Initialize event of the form.

  5. Control and Dialog Box Events

    All controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button. You can write event procedures that run when the events occur.

  6. Displaying a Custom Dialog Box

    Use the Show method to display a UserForm.

  7. Using Control Values While Code Is Running

    Some properties can be set at run time. Changes made to the dialog box by the user are lost when the dialog box is closed.


How to: Create a Custom Menu That Calls a Macro

 Copy code hover
[image]

How to: Create a Custom Menu That Calls a Macro
Send feedback

Published: July 16, 2012

The following code example shows how to create a custom menu with four menu options, each of which calls a macro.

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

The following code example sets up the custom menu when the workbook is opened, and deletes it when the workbook is closed.

VBA Copy code Copy code
Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
   With Application.CommandBars("Worksheet Menu Bar")
      On Error Resume Next
      .Controls("&MyFunction").Delete
      On Error GoTo 0
   End With
End Sub

Private Sub Workbook_Open()
   Dim objPopUp As CommandBarPopup
   Dim objBtn As CommandBarButton
   With Application.CommandBars("Worksheet Menu Bar")
      On Error Resume Next
      .Controls("MyFunction").Delete
      On Error GoTo 0
      Set objPopUp = .Controls.Add( _
         Type:=msoControlPopup, _
         before:=.Controls.Count, _
         temporary:=True)
   End With
   objPopUp.Caption = "&MyFunction"
   Set objBtn = objPopUp.Controls.Add
   With objBtn
      .Caption = "Formula Entry"
      .OnAction = "Cbm_Active_Formula"
      .Style = msoButtonCaption
   End With
   Set objBtn = objPopUp.Controls.Add
   With objBtn
      .Caption = "Value Entry"
      .OnAction = "Cbm_Active_Value"
      .Style = msoButtonCaption
   End With
   Set objBtn = objPopUp.Controls.Add
   With objBtn
      .Caption = "Formula Selection"
      .OnAction = "Cbm_Formula_Select"
      .Style = msoButtonCaption
   End With
   Set objBtn = objPopUp.Controls.Add
   With objBtn
      .Caption = "Value Selection"
      .OnAction = "Cbm_Value_Select"
      .Style = msoButtonCaption
   End With
End Sub

The menu "MyFunction" is added when the workbook opens, and is deleted when the workbook closes. It provides four menu options, with a macro assigned to each option. The user-defined function (UDF) "MyFunction" multiplies three values in a range together and returns the result.

VBA Copy code Copy code
Function MyFunction(rng As Range) As Double
   MyFunction = rng(1) * rng(2) * rng(3)
End Function

Formula Entry: This menu option is assigned the macro "Cbm_Active_Formula", which calls the UDF named "MyFunction" that multiplies the numbers in the preceding 3 cells, and stores value of the UDF in the active cell. You must have values in the range B6:D6 and select cell E6 before clicking this menu option.

VBA Copy code Copy code
Sub Cbm_Active_Formula()
   'setting up the variables.
   Dim intLen As Integer, strRng As String

   'Using the active cell, E6.
   With ActiveCell
      'Check to see if the preceding offset has valid data, and if there are three values
      If IsEmpty(.Offset(0, -1)) Or .Column < 4 Then

          'If the data is not valid, call MyFunction directly as a formula, but with no parameters.
         .Formula = "=MyFunction()"
          Application.SendKeys "{ENTER}"
      Else

         'If the data is valid, create a range of the preceding 3 cells
         strRng = Range(Cells(.Row, .Column - 3), _
            Cells(.Row, .Column - 1)).Address
         intLen = Len(strRng)

         'Call MyFunction as a formula, with the range as the parameter.
         .Formula = "=MyFunction(" & strRng & ")"
            Application.SendKeys "{ENTER}"
      End If
   End With
End Sub

Value Entry: This menu option is assigned the macro "Cbm_Active_Value", which enters the value produced by the UDF named "MyFunction" into the active cell. You must have values in the range B6:D6 and select cell E6 before clicking this menu option.

VBA Copy code Copy code
Sub Cbm_Active_Value()
   'Set up the variables.
   Dim intLen As Integer, strRng As String

   'Using the active cell, E6.
   With ActiveCell
      'If there isn't enough room in the column, then send a warning.
      If .Column < 4 Then
         Beep
         MsgBox "The function can be used only starting from column D!"

      'Otherwise, call MyFunction, using the range of the previous 3 cells.
      Else
         ActiveCell.Value = MyFunction(Range(ActiveCell.Offset(0, -3), _
            ActiveCell.Offset(0, -1)))
      End If
   End With
End Sub

Formula Selection: This menu option is assigned the macro "Cbm_Formula_Select", which uses an InputBox for the user to select the range which the UDF "MyFunction" should calculate. The return value of the UDF is stored in the active cell.

VBA Copy code Copy code
Sub Cbm_Formula_Select()
   'Set up the variables.
   Dim rng As Range

   'Use the InputBox dialog to set the range for MyFunction, with some simple error handling.
   Set rng = Application.InputBox("Range:", Type:=8)
   If rng.Cells.Count <> 3 Then
      MsgBox "Length, width and height are needed -" & _
         vbLf & "please select three cells!"
      Exit Sub
   End If
   'Call MyFunction in the active cell, E6.
   ActiveCell.Formula = "=MyFunction(" & rng.Address & ")"
End Sub

Value Selection: This menu option is assigned the macro "Cbm_Value_Select", which uses an InputBox for the user select the range which the UDF "MyFunction" should calculate. The value is stored in the active cell directly, instead of being returned by the UDF.

VBA Copy code Copy code
Sub Cbm_Value_Select()
   'Set up the variables.
   Dim rng As Range

   'Use the InputBox dialog to set the range for MyFunction, with some simple error handling.
   Set rng = Application.InputBox("Range:", Type:=8)
   If rng.Cells.Count <> 3 Then
     MsgBox "Length, width and height are needed -" & _
         vbLf & "please select three cells!"
      Exit Sub
   End If

   'Call MyFunction by value using the active cell, E6.
   ActiveCell.Value = MyFunction(rng)
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.


How to: Create a User Form

 Copy code hover
[image]

How to: Create a User Form
Send feedback

Published: July 16, 2012

To create a custom dialog box, you must create a UserForm. To create a UserForm, click UserForm on the Insert menu in the Visual Basic Editor.

Use the Properties window to change the name, behavior, and appearance of the form. For example, to change the caption on a form, set the Caption property.


How Do I... with Sparklines

 Copy code hover
[image]

How Do I... with Sparklines
Send feedback

Published: July 16, 2012

This topic links to programming tasks (how-to and walkthrough topics) for common sparklines scenarios.

"How Do I ..." is your gateway to key task-based topics about programming and application development using Excel. The links provide pointers to important, procedure-based Help topics.

Sparklines

  • How to: Animate a Sparkline

    • Describes how to animate a sparkline.

  • How to: Change the Color of the Horizontal Axis of a Sparkline

    • Describes how to change the color of the horizontal axis of a sparkline.

  • How to: Find All the Sparklines on a Sheet

    • Describes how to find all the sparklines on a worksheet.


How to: Animate a Sparkline

 Copy code hover
[image]

How to: Animate a Sparkline
See also Send feedback

Published: July 16, 2012

You can animate a sparkline by using the ModifySourceData method of the SparklineGroup object to iterate over a range of data. This example takes 36 months of data and animates it by displaying the first year of data, then iterates through each subsequent month until it reaches the last month of data. A counter is used to slow the animation so it can be viewed more easily. This example requires a sparkline group that contains three sparklines in the range A2:A4 that represent data in the range B2:AK4.

VBA Copy code Copy code
Sub SparkAnimation()

    ' The group of sparklines to animate
    Dim oSparkGroup As SparklineGroup
    'variables for the loop
    Dim i As Integer, j As Integer

    ' Set up the sparkline group variable
    Set oSparkGroup = Sheet1.Range("A2").SparklineGroups(1)

    ' Set the data source to the first year of data
    oSparkGroup.ModifySourceData "B2:M4"

    ' Loop through the data points for the subsequent two years
    For i = 1 To 24
        ' Move the reference for the sparkline group over one cell
        oSparkGroup.ModifySourceData Range(oSparkGroup.SourceData).Offset(, 1).Address

        ' Slow the animation
        j = 1
        Do
            j = j + 1: DoEvents
        Loop Until j = 4000
    Next i

End Sub

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Members
Programming With Sparklines In Excel 2010


How to: Change the Color of the Horizontal Axis of a Sparkline

 Copy code hover
[image]

How to: Change the Color of the Horizontal Axis of a Sparkline
See also Send feedback

Published: July 16, 2012

You can change the color of the horizontal axis of a sparkline by using the Color property of the SparkColor object. The following code example iterates through three sparkline groups and sets the color of the horizontal axis equal to the fill color in cell A8. This example requires three sparkline groups starting in cells A2, B2, and C2. Cell A8 must be filled with the color that you want to use for the color of the horizontal axis. This example uses Color property of the Interior object to get the color of cell A8.

VBA Copy code Copy code
Sub AxisColor()
    'The sparkline group
    Dim oSparkGroup As SparklineGroup
    'Loop through the sparkline groups on the sheet
    For Each oSparkGroup In Range("A2:C2").SparklineGroups
        'Show the axis
        oSparkGroup.Axes.Horizontal.Axis.Visible = True
        'Set the color of the axis to the color of cell A8
        oSparkGroup.Axes.Horizontal.Axis.Color.Color = Range("A8").Interior.Color
    Next oSparkGroup
End Sub

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Members
Programming With Sparklines In Excel 2010


How to: Find All the Sparklines on a Sheet

 Copy code hover
[image]

How to: Find All the Sparklines on a Sheet
See also Send feedback

Published: July 16, 2012

The following code example uses a list box on a user form to display all of the sparkline groups on the active sheet. When you click one of the sparkline groups in the list box, the sparkline group is selected on the sheet.

This example requires a user form named SparklineForm, a list box on the user form named SparklineListBox, and a button on the user form named CloseBtn.

In the Visual Basic Editor, insert a Module and copy and paste the following code. This code shows the user form.

VBA Copy code Copy code
Sub ShowUserForm()
    SparklineForm.Show
End Sub

In the Visual Basic Editor, right-click the SparklineForm form, select View Code, and copy and paste the following code.

The UserForm_Activate procedure iterates through all the sparkline groups on the active sheet and gets the addresses of the sparkline groups by using the Address property of the Range object. The address is then added to the list box.

The SparklineListBox_Click procedure is called when you click the address of a sparkline group in the list box. This procedure activates the selected sparkline group on the sheet by using the Activate method of the Range object.

The CloseBtn_Click procedure is called when you click the button on the user form, and it closes the user form.

VBA Copy code Copy code
Private Sub UserForm_Activate()
    'The sparkline group
    Dim oSparkGroup As SparklineGroup

    'Loop through all the sparkline groups on the sheet
    For Each oSparkGroup In ActiveSheet.Range("A:XFD").SparklineGroups
        'For each sparkline group found, add the address to the listbox
        SparklineListBox.AddItem oSparkGroup.Location.Address(, , , True)
    Next oSparkGroup
End Sub

Private Sub SparklineListBox_Click()
    'Activate the selected range that has the sparklines
    Range(SparklineListBox.Value).Activate
End Sub

Private Sub CloseBtn_Click()
    'Close the userform
    Unload Me
End Sub

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Members
Programming With Sparklines In Excel 2010


Object model reference (Excel 2013 developer reference)

 Copy code hover
[image]

Object model reference (Excel 2013 developer reference)
Send feedback

Published: July 16, 2012

This section of the Microsoft Excel 2013 Developer Reference contains documentation for all the objects, properties, methods, and events contained in the Excel object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar button [image] in the Help window. Click a topic in the table of contents to view it.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents located to the left of the topic to navigate through the documentation.


AboveAverage Object (Excel)

 Copy code hover
[image]

AboveAverage Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an above average visual of a conditional formatting rule. Applying a color or fill to a range or selection to help you see the value of a cells relative to other cells.

Version Information

Version Added: Excel 2007

Remarks

All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create an above average formatting rule by using either the Add or AddAboveAverage method of the FormatConditions collection.

Example

The following example builds a dynamic data set and applies color to the above average values through conditional formatting rules.

VBA Copy code Copy code
Sub AboveAverageCF()

' Building data for Melanie
 Range("A1").Value = "Name"
 Range("B1").Value = "Number"
 Range("A2").Value = "Melanie-1"
 Range("A2").AutoFill Destination:=Range("A2:A26"), Type:=xlFillDefault
 Range("B2:B26").FormulaArray = "=INT(RAND()*101)"
 Range("B2:B26").Select

' Applying Conditional Formatting to items above the average. Should appear green fill and dark green font.
 Selection.FormatConditions.AddAboveAverage
 Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
 Selection.FormatConditions(1).AboveBelow = xlAboveAverage
 With Selection.FormatConditions(1).Font
 .Color = -16752384
 .TintAndShade = 0
 End With
 With Selection.FormatConditions(1).Interior
 .PatternColorIndex = xlAutomatic
 .Color = 13561798
 .TintAndShade = 0
 End With
MsgBox "Added an Above Average Conditional Format to Melanie's data. Press F9 to update values.", vbInformation

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

AboveAverage Object Members


AboveAverage Members (Excel)

 Copy code hover
[image]

AboveAverage Members (Excel)
Send feedback

Published: July 16, 2012

Represents an above average visual of a conditional formatting rule. Applying a color or fill to a range or selection to help you see the value of a cells relative to other cells.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
AboveBelow | Returns or sets one of the constants of the XlAboveBelow enumeration, specifying if the conditional formatting rule looks for cell values above or below the range average or standard deviation.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
CalcFor | Returns or sets one of the constants of the XlCalcFor enumeration, which specifies the scope of data to be evaluated for the conditional format in a PivotTable report.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
NumStdDev | Returns or sets the numeric standard deviation for an AboveAverage object. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


AboveAverage Properties (Excel)

 Copy code hover
[image]

AboveAverage Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AboveBelow | Returns or sets one of the constants of the XlAboveBelow enumeration, specifying if the conditional formatting rule looks for cell values above or below the range average or standard deviation.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
CalcFor | Returns or sets one of the constants of the XlCalcFor enumeration, which specifies the scope of data to be evaluated for the conditional format in a PivotTable report.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
NumStdDev | Returns or sets the numeric standard deviation for an AboveAverage object. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


AboveAverage.AboveBelow Property (Excel)

 Copy code hover
[image]

AboveAverage.AboveBelow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlAboveBelow enumeration, specifying if the conditional formatting rule looks for cell values above or below the range average or standard deviation.

Version Information

Version Added: Excel 2007

Syntax

expression .AboveBelow

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Application Property (Excel)

 Copy code hover
[image]

AboveAverage.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an AboveAverage object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.AppliesTo Property (Excel)

 Copy code hover
[image]

AboveAverage.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Borders Property (Excel)

 Copy code hover
[image]

AboveAverage.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Borders

expression A variable that represents an AboveAverage object.

Remarks

For a conditional formatting object, you can only set the properties for the top, bottom, and side borders of the cell.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.CalcFor Property (Excel)

 Copy code hover
[image]

AboveAverage.CalcFor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlCalcFor enumeration, which specifies the scope of data to be evaluated for the conditional format in a PivotTable report.

Version Information

Version Added: Excel 2007

Syntax

expression .CalcFor

expression A variable that represents an AboveAverage object.

Remarks

This property is applicable only when the conditional format is being applied to data in a PivotTable report.

This property can be set to xlAllValues, xlColGroups, or xlRowGroups only if the AboveAverage.ScopeType property is set to xlFieldsScope.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Creator Property (Excel)

 Copy code hover
[image]

AboveAverage.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AboveAverage object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

Example

This example displays a message about the creator of an Excel workbook.

VBA Copy code Copy code
Sub FindCreator()

 Dim myObject As Excel.Workbook
 Set myObject = ActiveWorkbook
 If myObject.Creator = &h5843454c Then
 MsgBox "This is a Microsoft Excel object."
 Else
 MsgBox "This is not a Microsoft Excel object."
 End If

End Sub

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Font Property (Excel)

 Copy code hover
[image]

AboveAverage.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Font

expression A variable that represents an AboveAverage object.

Remarks

Not all properties of the Font object are supported for a conditional formatting object. You can set the font style, underline, color, and strikethrough attributes.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Interior Property (Excel)

 Copy code hover
[image]

AboveAverage.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Interior

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.NumberFormat Property (Excel)

 Copy code hover
[image]

AboveAverage.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .NumberFormat

expression A variable that represents an AboveAverage object.

Remarks

The number format is specified using the same format codes displayed on the Number tab of the Format Cells dialog box. You can use a built-in number format, for example "General", or create a custom number format.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.NumStdDev Property (Excel)

 Copy code hover
[image]

AboveAverage.NumStdDev Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the numeric standard deviation for an AboveAverage object. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .NumStdDev

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Parent Property (Excel)

 Copy code hover
[image]

AboveAverage.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Priority Property (Excel)

 Copy code hover
[image]

AboveAverage.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents an AboveAverage object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.PTCondition Property (Excel)

 Copy code hover
[image]

AboveAverage.PTCondition Property (Excel)
See also Send feedback

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.ScopeType Property (Excel)

 Copy code hover
[image]

AboveAverage.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents an AboveAverage object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.StopIfTrue Property (Excel)

 Copy code hover
[image]

AboveAverage.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents an AboveAverage object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.Type Property (Excel)

 Copy code hover
[image]

AboveAverage.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents an AboveAverage object.

Remarks

This property will always return a Long value of "12", which is equivalent to xlAboveAverageCondition.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage Methods (Excel)

 Copy code hover
[image]

AboveAverage Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


AboveAverage.Delete Method (Excel)

 Copy code hover
[image]

AboveAverage.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents an AboveAverage object.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

AboveAverage.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents an AboveAverage object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.SetFirstPriority Method (Excel)

 Copy code hover
[image]

AboveAverage.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents an AboveAverage object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


AboveAverage.SetLastPriority Method (Excel)

 Copy code hover
[image]

AboveAverage.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents an AboveAverage object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

AboveAverage Object

Other resources

AboveAverage Object Members


Action Object (Excel)

 Copy code hover
[image]

Action Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an action to be executed in a Pivottable or sheet data.

Version Information

Version Added: Excel 2007

See also

Concepts

Excel Object Model Reference

Other resources

Action Object Members


Action Members (Excel)

 Copy code hover
[image]

Action Members (Excel)
Send feedback

Published: July 16, 2012

Represents an action to be executed in a Pivottable or sheet data.

Methods

Name | Description
Execute | Performs the specified action.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns the caption assigned to the Action object. Read-only String.
Content | Returns the content associated to the Action object. Read-only String.
Coordinate | Returns the coordinate property of the Action object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns the action type. Read-only XlActionType.


Action Properties (Excel)

 Copy code hover
[image]

Action Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns the caption assigned to the Action object. Read-only String.
Content | Returns the content associated to the Action object. Read-only String.
Coordinate | Returns the coordinate property of the Action object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns the action type. Read-only XlActionType.


Action.Application Property (Excel)

 Copy code hover
[image]

Action.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an Action object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Caption Property (Excel)

 Copy code hover
[image]

Action.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the caption assigned to the Action object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Caption

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Content Property (Excel)

 Copy code hover
[image]

Action.Content Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the content associated to the Action object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Content

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Coordinate Property (Excel)

 Copy code hover
[image]

Action.Coordinate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the coordinate property of the Action object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Coordinate

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Creator Property (Excel)

 Copy code hover
[image]

Action.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns a Action object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Name Property (Excel)

 Copy code hover
[image]

Action.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Name

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Parent Property (Excel)

 Copy code hover
[image]

Action.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action.Type Property (Excel)

 Copy code hover
[image]

Action.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the action type. Read-only XlActionType.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Action Methods (Excel)

 Copy code hover
[image]

Action Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Execute | Performs the specified action.


Action.Execute Method (Excel)

 Copy code hover
[image]

Action.Execute Method (Excel)
See also Send feedback

Published: July 16, 2012

Performs the specified action.

Version Information

Version Added: Excel 2007

Syntax

expression .Execute

expression A variable that represents an Action object.

See also

Concepts

Action Object

Other resources

Action Object Members


Actions Object (Excel)

 Copy code hover
[image]

Actions Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all Action objects for the specified series.

Version Information

Version Added: Excel 2007

See also

Concepts

Excel Object Model Reference

Other resources

Actions Object Members


Actions Members (Excel)

 Copy code hover
[image]

Actions Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all Action objects for the specified series.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Actions object that represents a collection of actions in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Actions Properties (Excel)

 Copy code hover
[image]

Actions Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Actions object that represents a collection of actions in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Actions.Application Property (Excel)

 Copy code hover
[image]

Actions.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an Actions object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Actions Object

Other resources

Actions Object Members


Actions.Count Property (Excel)

 Copy code hover
[image]

Actions.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents an Actions object.

See also

Concepts

Actions Object

Other resources

Actions Object Members


Actions.Creator Property (Excel)

 Copy code hover
[image]

Actions.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns a Actions object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Actions Object

Other resources

Actions Object Members


Actions.Item Property (Excel)

 Copy code hover
[image]

Actions.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Actions object that represents a collection of actions in a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents an Actions object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the action.

See also

Concepts

Actions Object

Other resources

Actions Object Members


Actions.Parent Property (Excel)

 Copy code hover
[image]

Actions.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an Actions object.

See also

Concepts

Actions Object

Other resources

Actions Object Members


AddIn Object (Excel)

 Copy code hover
[image]

AddIn Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single add-in, either installed or not installed.

Remarks

The AddIn object is a member of the AddIns collection. The AddIns collection contains a list of all the add-ins available to Microsoft Excel, regardless of whether they're installed. This list corresponds to the list of add-ins displayed in the Add-Ins dialog box.

Example

Use AddIns(index), where index is the add-in title or index number, to return a single AddIn object. The following example installs the Analysis Toolpak add-in.

VBA Copy code Copy code
AddIns("analysis toolpak").Installed = True

Don't confuse the add-in title, which appears in the Add-Ins dialog box, with the add-in name, which is the file name of the add-in. You must spell the add-in title exactly as it's spelled in the Add-Ins dialog box, but the capitalization doesn't have to match.

The index number represents the position of the add-in in the Add-ins available box in the Add-Ins dialog box. The following example creates a list that contains specified properties of the available add-ins.

VBA Copy code Copy code
With Worksheets("sheet1")
 .Rows(1).Font.Bold = True
 .Range("a1:d1").Value = _
 Array("Name", "Full Name", "Title", "Installed")
 For i = 1 To AddIns.Count
 .Cells(i + 1, 1) = AddIns(i).Name
 .Cells(i + 1, 2) = AddIns(i).FullName
 .Cells(i + 1, 3) = AddIns(i).Title
 .Cells(i + 1, 4) = AddIns(i).Installed
 Next
 .Range("a1").CurrentRegion.Columns.AutoFit
End With

The Add method adds an add-in to the list of available add-ins but doesn't install the add-in. Set the Installed property of the add-in to True to install the add-in. To install an add-in that doesn't appear in the list of available add-ins, you must first use the Add method and then set the Installed property. This can be done in a single step, as shown in the following example (note that you use the name of the add-in, not its title, with the Add method).

VBA Copy code Copy code
AddIns.Add("generic.xll").Installed = True

Use Workbooks(index) where index is the add-in filename (not title) to return a reference to the workbook corresponding to a loaded add-in. You must use the file name because loaded add-ins don't normally appear in the Workbooks collection. This example sets the wb variable to the workbook for Myaddin.xla.

VBA Copy code Copy code
Set wb = Workbooks("myaddin.xla")

The following example sets the wb variable to the workbook for the Analysis Toolpak add-in.

VBA Copy code Copy code
Set wb = Workbooks(AddIns("analysis toolpak").Name)

If the Installed property returns True, but calls to functions in the add-in still fail, the add-in may not actually be loaded. This is because the Addin object represents the existence and installed state of the add-in but doesn't represent the actual contents of the add-in workbook.To guarantee that an installed add-in is loaded, you should open the add-in workbook. The following example opens the workbook for the add-in named "My Addin" if the add-in isn't already present in the Workbooks collection.

VBA Copy code Copy code
On Error Resume Next ' turn off error checking
Set wbMyAddin = Workbooks(AddIns("My Addin").Name)
lastError = Err
On Error Goto 0 ' restore error checking
If lastError <> 0 Then
 ' the add-in workbook isn't currently open. Manually open it.
 Set wbMyAddin = Workbooks.Open(AddIns("My Addin").FullName)
End If

See also

Concepts

Excel Object Model Reference

Other resources

AddIn Object Members


AddIn Members (Excel)

 Copy code hover
[image]

AddIn Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single add-in, either installed or not installed.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CLSID | Returns a read-only unique identifier, or CLSID, identifying an object, as a String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FullName | Returns the name of the object, including its path on disk, as a string. Read-only String.
Installed | True if the add-in is installed or to install the add-in, False if the add-in is uninstalled or to uninstall the add-in. Read/write Boolean.
IsOpen | Returns True if the add-in is currently open. Boolean Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the Add-in, excluding the final separator and name of the Add-in.
progID | Returns the programmatic identifiers for the object. Read-only String.


AddIn Properties (Excel)

 Copy code hover
[image]

AddIn Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CLSID | Returns a read-only unique identifier, or CLSID, identifying an object, as a String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FullName | Returns the name of the object, including its path on disk, as a string. Read-only String.
Installed | True if the add-in is installed or to install the add-in, False if the add-in is uninstalled or to uninstall the add-in. Read/write Boolean.
IsOpen | Returns True if the add-in is currently open. Boolean Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the Add-in, excluding the final separator and name of the Add-in.
progID | Returns the programmatic identifiers for the object. Read-only String.


AddIn.Application Property (Excel)

 Copy code hover
[image]

AddIn.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AddIn object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.CLSID Property (Excel)

 Copy code hover
[image]

AddIn.CLSID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a read-only unique identifier, or CLSID, identifying an object, as a String.

Syntax

expression .CLSID

expression A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Creator Property (Excel)

 Copy code hover
[image]

AddIn.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns a AddIn object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.FullName Property (Excel)

 Copy code hover
[image]

AddIn.FullName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the object, including its path on disk, as a string. Read-only String.

Syntax

expression .FullName

expression A variable that represents an AddIn object.

Example

This example displays the path and file name of every available add-in.

VBA Copy code Copy code
For Each a In AddIns
 MsgBox a.FullName
Next a

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Installed Property (Excel)

 Copy code hover
[image]

AddIn.Installed Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the add-in is installed or to install the add-in, False if the add-in is uninstalled or to uninstall the add-in. Read/write Boolean.

Syntax

expression .Installed

expression A variable that represents an AddIn object.

Remarks

Setting this property to True installs the add-in and calls its Auto_Add functions. Setting this property to False removes the add-in and calls its Auto_Remove functions.

Example

This example uses a message box to display the installation status of the Solver add-in.

VBA Copy code Copy code
Set a = AddIns("Solver Add-In")
If a.Installed = True Then
 MsgBox "The Solver add-in is installed"
Else
 MsgBox "The Solver add-in is not installed"
End If

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.IsOpen Property (Excel)

 Copy code hover
[image]

AddIn.IsOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the add-in is currently open. Boolean Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .IsOpen

expression A variable that returns an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Name Property (Excel)

 Copy code hover
[image]

AddIn.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Parent Property (Excel)

 Copy code hover
[image]

AddIn.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Path Property (Excel)

 Copy code hover
[image]

AddIn.Path Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the complete path to the Add-in, excluding the final separator and name of the Add-in.

Syntax

expression .Path

expression A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.progID Property (Excel)

 Copy code hover
[image]

AddIn.progID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the programmatic identifiers for the object. Read-only String.

Syntax

expression .progID

expression A variable that represents an AddIn object.

Example

This example creates a list of the programmatic identifiers for the OLE objects on worksheet one.

VBA Copy code Copy code
rw = 0
For Each o in Worksheets(1).OLEObjects
 With Worksheets(2)
 rw = rw + 1
 .cells(rw, 1).Value = o.ProgId
 End With
Next

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIns Object (Excel)

 Copy code hover
[image]

AddIns Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of AddIn objects that represents all the add-ins available to Microsoft Excel, regardless of whether they're installed.

Remarks

This list corresponds to the list of add-ins displayed in the Add-Ins dialog box.

Example

Use the AddIns property to return the AddIns collection. The following example creates a list that contains the names and installed states of all the available add-ins.

VBA Copy code Copy code
Sub DisplayAddIns()
 Worksheets("Sheet1").Activate
 rw = 1
 For Each ad In Application.AddIns
 Worksheets("Sheet1").Cells(rw, 1) = ad.Name
 Worksheets("Sheet1").Cells(rw, 2) = ad.Installed
 rw = rw + 1
 Next
End Sub

Use the Add method to add an add-in to the list of available add-ins. The Add method adds an add-in to the list but doesn't install the add-in. Set the Installed property of the add-in to True to install the add-in. To install an add-in that doesn't appear in the list of available add-ins, you must first use the Add method and then set the Installed property. This can be done in a single step, as shown in the following example (note that you use the name of the add-in, not its title, with the Add method).

VBA Copy code Copy code
AddIns.Add("generic.xll").Installed = True

Use AddIns(index) where index is the add-in title or index number to return a single AddIn object. The following example installs the Analysis Toolpak add-in.

Don't confuse the add-in title, which appears in the Add-Ins dialog box, with the add-in name, which is the file name of the add-in. You must spell the add-in title exactly as it's spelled in the Add-Ins dialog box, but the capitalization doesn't have to match.

VBA Copy code Copy code
AddIns("analysis toolpak").Installed = True

See also

Concepts

Excel Object Model Reference

Other resources

AddIns Object Members


AddIns Members (Excel)

 Copy code hover
[image]

AddIns Members (Excel)
Send feedback

Published: July 16, 2012

A collection of AddIn objects that represents all the add-ins available to Microsoft Excel, regardless of whether they're installed.

Methods

Name | Description
Add | Adds a new add-in file to the list of add-ins. Returns an AddIn object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


AddIns Properties (Excel)

 Copy code hover
[image]

AddIns Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


AddIns.Application Property (Excel)

 Copy code hover
[image]

AddIns.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AddIns object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns.Count Property (Excel)

 Copy code hover
[image]

AddIns.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an AddIns object.

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns.Creator Property (Excel)

 Copy code hover
[image]

AddIns.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns a AddIns object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns.Item Property (Excel)

 Copy code hover
[image]

AddIns.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an AddIns object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example displays the status of the Analysis ToolPak add-in. Note that the string used as the index to the AddIns method is the Title property of the AddIn object.

VBA Copy code Copy code
If ThisWorkbook.Application.AddIns.Item("Analysis ToolPak").Installed = True Then
 MsgBox "Analysis ToolPak add-in is installed"
Else
 MsgBox "Analysis ToolPak add-in is not installed"
End If

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns.Parent Property (Excel)

 Copy code hover
[image]

AddIns.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AddIns object.

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns Methods (Excel)

 Copy code hover
[image]

AddIns Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new add-in file to the list of add-ins. Returns an AddIn object.


AddIns.Add Method (Excel)

 Copy code hover
[image]

AddIns.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new add-in file to the list of add-ins. Returns an AddIn object.

Syntax

expression .Add(FileName, CopyFile)

expression A variable that represents an AddIns object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file that contains the add-in or the ProgID of the automation add-in that you want to add to the list in the add-in manager.
CopyFile | Optional | Variant | Ignored if the add-in file is on a hard disk. True to copy the add-in to your hard disk, if the add-in is on a removable medium (a floppy disk or compact disc). False to have the add-in remain on the removable medium. If this argument is omitted, Microsoft Excel displays a dialog box and asks you to choose.

Return Value

An AddIn object that represents the new add-in.

Remarks

This method does not install the new add-in. You must set the Installed property to install the add-in.

Example

This example inserts the add-in Myaddin.xla from drive A. When you run this example, Microsoft Excel copies the file A:\Myaddin.xla to the Library folder on your hard disk and adds the add-in title to the list in the Add-Ins dialog box.

VBA Copy code Copy code
Sub UseAddIn()

 Set myAddIn = AddIns.Add(Filename:="A:\MYADDIN.XLA", _
 CopyFile:=True)
 MsgBox myAddIn.Title & " has been added to the list"

End Sub

See also

Concepts

AddIns Collection

Other resources

AddIns Object Members


AddIns2 Object (Excel)

 Copy code hover
[image]

AddIns2 Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of AddIn objects that represent all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed.

Version Information

Version Added: Excel 2010

Remarks

The contents of the AddIns2 collection correspond to the list of add-ins displayed in the Add-Ins dialog box (Add-Ins command on the Developer tab) and any add-ins that are currently open.

See also

Concepts

Excel Object Model Reference

Other resources

AddIns2 Object Members


AddIns2 Members (Excel)

 Copy code hover
[image]

AddIns2 Members (Excel)
Send feedback

Published: July 16, 2012

A collection of AddIn objects that represent all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed.

Methods

Name | Description
Add | Adds a new add-in to the list of add-ins.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


AddIns2 Properties (Excel)

 Copy code hover
[image]

AddIns2 Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


AddIns2.Application Property (Excel)

 Copy code hover
[image]

AddIns2.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents an AddIns2 object.

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


AddIns2.Count Property (Excel)

 Copy code hover
[image]

AddIns2.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a AddIns2 object.

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


AddIns2.Creator Property (Excel)

 Copy code hover
[image]

AddIns2.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AddIns2 object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


AddIns2.Item Property (Excel)

 Copy code hover
[image]

AddIns2.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that returns a AddIns2 object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example displays the status of the Analysis ToolPak add-in. Note that the string used as the index to the AddIns2 method is the Title property of the AddIn object.

VBA Copy code Copy code
If ThisWorkbook.Application.AddIns2.Item("Analysis ToolPak").Installed = True Then
 MsgBox "Analysis ToolPak add-in is installed"
Else
 MsgBox "Analysis ToolPak add-in is not installed"
End If

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


AddIns2.Parent Property (Excel)

 Copy code hover
[image]

AddIns2.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents an AddIns2 object.

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


AddIns2 Methods (Excel)

 Copy code hover
[image]

AddIns2 Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new add-in to the list of add-ins.


AddIns2.Add Method (Excel)

 Copy code hover
[image]

AddIns2.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new add-in to the list of add-ins.

Version Information

Version Added: Excel 2010

Syntax

expression .Add(Filename, CopyFile)

expression A variable that returns an AddIns2 object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file that contains the add-in to add to the list in the Add-Ins dialog box.
CopyFile | Optional | Variant | If the add-in file is on a removable medium, specifies whether to copy the add-in to the local hard disk. Specify True to copy the add-in to your hard disk. Specify False to keep the add-in on the removable medium. If this argument is omitted, Microsoft Excel displays a dialog box and asks the user to choose whether to copy the add-in file. This parameter is ignored if the add-in file is already on the hard disk.

Return Value

AddIn

See also

Concepts

AddIns2 Object

Other resources

AddIns2 Object Members


Adjustments Object (Excel)

 Copy code hover
[image]

Adjustments Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains a collection of adjustment values for the specified AutoShape, WordArt object, or connector.

Remarks

Each adjustment value represents one way an adjustment handle can be adjusted. Because some adjustment handles can be adjusted in two ways — for instance, some handles can be adjusted both horizontally and vertically — a shape can have more adjustment values than it has adjustment handles. A shape can have up to eight adjustments.

Use the Adjustments property to return an Adjustments object. Use Adjustments(index), where index is the adjustment value's index number, to return a single adjustment value.

Different shapes have different numbers of adjustment values, different kinds of adjustments change the geometry of a shape in different ways, and different kinds of adjustments have different ranges of valid values. For example, the following illustration shows what each of the four adjustment values for a right-arrow callout contributes to the definition of the callout's geometry.

Note Note

Because each adjustable shape has a different set of adjustments, the best way to verify the adjustment behavior for a specific shape is to manually create an instance of the shape, make adjustments with the macro recorder turned on, and then examine the recorded code.

The following table summarizes the ranges of valid adjustment values for different types of adjustments. In most cases, if you specify a value that's beyond the range of valid values, the closest valid value will be assigned to the adjustment.

Type of adjustment | Valid values
Linear (horizontal or vertical) | Generally the value 0.0 represents the left or top edge of the shape and the value 1.0 represents the right or bottom edge of the shape. Valid values correspond to valid adjustments you can make to the shape manually. For example, if you can only pull an adjustment handle half way across the shape manually, the maximum value for the corresponding adjustment will be 0.5. For shapes such as connectors and callouts, where the values 0.0 and 1.0 represent the limits of the rectangle defined by the starting and ending points of the connector or callout line, negative numbers and numbers greater than 1.0 are valid values.
Radial | An adjustment value of 1.0 corresponds to the width of the shape. The maximum value is 0.5, or half way across the shape.
Angle | Values are expressed in degrees. If you specify a value outside the range - 180 to 180, it will be normalized to be within that range.

Example

The following example adds a right-arrow callout to myDocument and sets adjustment values for the callout. Note that although the shape has only three adjustment handles, it has four adjustments. Adjustments three and four both correspond to the handle between the head and neck of the arrow.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set rac = myDocument.Shapes.AddShape(msoShapeRightArrowCallout, _
 10, 10, 250, 190)
With rac.Adjustments
 .Item(1) = 0.5 'adjusts width of text box
 .Item(2) = 0.15 'adjusts width of arrow head
 .Item(3) = 0.8 'adjusts length of arrow head
 .Item(4) = 0.4 'adjusts width of arrow neck
End With

See also

Concepts

Excel Object Model Reference

Other resources

Adjustments Object Members


Adjustments Members (Excel)

 Copy code hover
[image]

Adjustments Members (Excel)
Send feedback

Published: July 16, 2012

Contains a collection of adjustment values for the specified AutoShape, WordArt object, or connector.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns or sets the adjustment value specified by the Index argument. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.


Adjustments Properties (Excel)

 Copy code hover
[image]

Adjustments Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns or sets the adjustment value specified by the Index argument. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.


Adjustments.Application Property (Excel)

 Copy code hover
[image]

Adjustments.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Adjustments object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Count Property (Excel)

 Copy code hover
[image]

Adjustments.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Integer value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an Adjustments object.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Creator Property (Excel)

 Copy code hover
[image]

Adjustments.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Adjustments object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Item Property (Excel)

 Copy code hover
[image]

Adjustments.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the adjustment value specified by the Index argument. Read/write Single.

Syntax

expression .Item(Index)

expression A variable that represents an Adjustments object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | [INT] | Long. The index number of the adjustment.

Remarks

AutoShapes, connectors, and WordArt objects can have up to eight adjustments.

For linear adjustments, an adjustment value of 0.0 generally corresponds to the left or top edge of the shape, and a value of 1.0 generally corresponds to the right or bottom edge of the shape. However, adjustments can pass beyond shape boundaries for some shapes. For radial adjustments, an adjustment value of 1.0 corresponds to the width of the shape. For angular adjustments, the adjustment value is specified in degrees. The Item property applies only to shapes that have adjustments.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Parent Property (Excel)

 Copy code hover
[image]

Adjustments.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Adjustments object.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


AllowEditRange Object (Excel)

 Copy code hover
[image]

AllowEditRange Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the cells that can be edited on a protected worksheet.

Remarks

Use the Add method or the Item property of the AllowEditRanges collection to return an AllowEditRange object.

Once an AllowEditRange object has been returned, you can use the ChangePassword method to change the password to access a range that can be edited on a protected worksheet.

Example

In this example, Microsoft Excel allows edits to range "A1:A4" on the active worksheet, notifies the user, then changes the password for this specified range and notifies the user of this change.

VBA Copy code Copy code
Sub UseChangePassword()

 Dim wksOne As Worksheet
 Dim wksPassword As String

 Set wksOne = Application.ActiveSheet

 wksPassword = InputBox ("Enter password for the worksheet")

 ' Establish a range that can allow edits
 ' on the protected worksheet.
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:=wksPassword

 MsgBox "Cells A1 to A4 can be edited on the protected worksheet."

 ' Change the password.

 wksPassword = InputBox ("Enter the new password for the worksheet")

 wksOne.Protection.AllowEditRanges(1).ChangePassword _
 Password:=wksPassword

 MsgBox "The password for these cells has been changed."

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

AllowEditRange Object Members


AllowEditRange Members (Excel)

 Copy code hover
[image]

AllowEditRange Members (Excel)
Send feedback

Published: July 16, 2012

Represents the cells that can be edited on a protected worksheet.

Methods

Name | Description
ChangePassword | Changes the password for a range that can be edited on a protected worksheet.
Delete | Deletes the object.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Properties

Name | Description
Range | Returns a Range object that represents a subset of the ranges that can be edited edited on a protected worksheet.
Title | Returns or sets the title of the range of cells that can edited on a protected sheet. Read/write String.
Users | Returns a UserAccessList object for the protected range on a worksheet.


AllowEditRange Properties (Excel)

 Copy code hover
[image]

AllowEditRange Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Range | Returns a Range object that represents a subset of the ranges that can be edited edited on a protected worksheet.
Title | Returns or sets the title of the range of cells that can edited on a protected sheet. Read/write String.
Users | Returns a UserAccessList object for the protected range on a worksheet.


AllowEditRange.Range Property (Excel)

 Copy code hover
[image]

AllowEditRange.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a subset of the ranges that can be edited edited on a protected worksheet.

Syntax

expression .Range

expression A variable that represents an AllowEditRange object.

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRange.Title Property (Excel)

 Copy code hover
[image]

AllowEditRange.Title Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the range of cells that can edited on a protected sheet. Read/write String.

Syntax

expression .Title

expression A variable that represents an AllowEditRange object.

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRange.Users Property (Excel)

 Copy code hover
[image]

AllowEditRange.Users Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a UserAccessList object for the protected range on a worksheet.

Syntax

expression .Users

expression A variable that represents an AllowEditRange object.

Example

In this example, Microsoft Excel displays the name of the first user allowed access to the first protected range on the active worksheet. This example assumes that a range has been chosen to be protected and that a particular user has been given access to this range.

VBA Copy code Copy code
Sub DisplayUserName()

 Dim wksSheet As Worksheet

 Set wksSheet = Application.ActiveSheet

 ' Display name of user with access to protected range.
 MsgBox wksSheet.Protection.AllowEditRanges(1).Users(1).Name

End Sub

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRange Methods (Excel)

 Copy code hover
[image]

AllowEditRange Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ChangePassword | Changes the password for a range that can be edited on a protected worksheet.
Delete | Deletes the object.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.


AllowEditRange.ChangePassword Method (Excel)

 Copy code hover
[image]

AllowEditRange.ChangePassword Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the password for a range that can be edited on a protected worksheet.

Syntax

expression .ChangePassword(Password)

expression A variable that represents an AllowEditRange object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Required | String | The new password.

Example

In this example, Microsoft Excel allows edits to range "A1:A4" on the active worksheet, notifies the user, changes the password for this specified range, and notifies the user of the change. The worksheet must be unprotected before running this code.

VBA Copy code Copy code
Sub UseChangePassword()

 Dim wksOne As Worksheet
 Dim strPassword As String

 Set wksOne = Application.ActiveSheet

 ' Establish a range that can allow edits
 ' on the protected worksheet.

 strPassword = InputBox("Please enter the password for the range")
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:=strPassword

 strPassword = InputBox("Please enter the new password for the range")

 ' Change the password.
 wksOne.Protection.AllowEditRanges("Classified").ChangePassword _
 Password:="strPassword"

 MsgBox "The password for these cells has been changed."

End Sub

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRange.Delete Method (Excel)

 Copy code hover
[image]

AllowEditRange.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an AllowEditRange object.

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRange.Unprotect Method (Excel)

 Copy code hover
[image]

AllowEditRange.Unprotect Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Syntax

expression .Unprotect(Password)

expression A variable that represents an AllowEditRange object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that denotes the case-sensitive password to use to unprotect the range of cells. If the range isn't protected with a password, this argument is ignored.

Remarks

If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.

See also

Concepts

AllowEditRange Object

Other resources

AllowEditRange Object Members


AllowEditRanges Object (Excel)

 Copy code hover
[image]

AllowEditRanges Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the AllowEditRange objects that represent the cells that can be edited on a protected worksheet.

Remarks

Use the AllowEditRanges property of the Protection object to return an AllowEditRanges collection.

Once an AllowEditRanges collection has been returned, you can use the Add method to add a range that can be edited on a protected worksheet.

Example

In this example, Microsoft Excel allows edits to range "A1:A4" on the active worksheet and notifies the user of the title and address of the specified range.

VBA Copy code Copy code
Sub UseAllowEditRanges()

 Dim wksOne As Worksheet
 Dim wksPassword As String

 Set wksOne = Application.ActiveSheet

 ' Unprotect worksheet.
 wksOne.Unprotect

 wksPassword = InputBox ("Enter password for the worksheet")

 ' Establish a range that can allow edits
 ' on the protected worksheet.
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:=wksPassword

 ' Notify the user
 ' the title and address of the range.
 With wksOne.Protection.AllowEditRanges.Item(1)
 MsgBox "Title of range: " & .Title
 MsgBox "Address of range: " & .Range.Address
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

AllowEditRanges Object Members


AllowEditRanges Members (Excel)

 Copy code hover
[image]

AllowEditRanges Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the AllowEditRange objects that represent the cells that can be edited on a protected worksheet.

Methods

Name | Description
Add | Adds a range that can be edited on a protected worksheet. Returns a AllowEditRange object.

Properties

Name | Description
Count | Returns a Long value that represents the number of objects in the collection.
Item | Returns a single object from a collection.


AllowEditRanges Properties (Excel)

 Copy code hover
[image]

AllowEditRanges Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns a Long value that represents the number of objects in the collection.
Item | Returns a single object from a collection.


AllowEditRanges.Count Property (Excel)

 Copy code hover
[image]

AllowEditRanges.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an AllowEditRanges object.

See also

Concepts

AllowEditRanges Collection

Other resources

AllowEditRanges Object Members


AllowEditRanges.Item Property (Excel)

 Copy code hover
[image]

AllowEditRanges.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an AllowEditRanges object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example allows edits to range ("A1:A4") on the active worksheet, notifies the user, then changes the password for this specified range and notifies the user of this change.

VBA Copy code Copy code
Sub UseChangePassword()

 Dim wksOne As Worksheet

 Set wksOne = Application.ActiveSheet

 ' Establish a range that can allow edits
 ' on the protected worksheet.
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:="secret"

 MsgBox "Cells A1 to A4 can be edited on the protected worksheet."

 ' Change the password.
 wksOne.Protection.AllowEditRanges.Item(1).ChangePassword _
 Password:="moresecret"

 MsgBox "The password for these cells has been changed."

End Sub

See also

Concepts

AllowEditRanges Collection

Other resources

AllowEditRanges Object Members


AllowEditRanges Methods (Excel)

 Copy code hover
[image]

AllowEditRanges Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a range that can be edited on a protected worksheet. Returns a AllowEditRange object.


AllowEditRanges.Add Method (Excel)

 Copy code hover
[image]

AllowEditRanges.Add Method (Excel)
See also Send feedback

Adds a range that can be edited on a protected worksheet. Returns a AllowEditRange object.

Syntax

expression .Add(Title, Range, Password)

expression A variable that represents an AllowEditRanges object.

Parameters

Name | Required/Optional | Data Type | Description
Title | Required | String | The title of range.
Range | Required | Range | Range object. The range allowed to be edited.
Password | Optional | Variant | The password for the range.

Return Value

An AllowEditRange object that represents the range.

Example

This example allows edits to range "A1:A4" on the active worksheet, notifies the user, then changes the password for this specified range and notifies the user of this change.

VBA Copy code Copy code
Sub UseChangePassword()

 Dim wksOne As Worksheet

 Set wksOne = Application.ActiveSheet

 ' Protect the worksheet.
 wksOne.Protect

 ' Establish a range that can allow edits
 ' on the protected worksheet.
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:="secret"

 MsgBox "Cells A1 to A4 can be edited on the protected worksheet."

 ' Change the password.
 wksOne.Protection.AllowEditRanges(1).ChangePassword _
 Password:="moresecret"

 MsgBox "The password for these cells has been changed."

End Sub

See also

Concepts

AllowEditRanges Collection

Other resources

AllowEditRanges Object Members


Application Object (Excel)

 Copy code hover
[image]

Application Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the entire Microsoft Excel application.

Remarks

The Application object contains:

  • Application-wide settings and options.

  • Methods that return top-level objects, such as ActiveCell, ActiveSheet, and so on.

Example

Use the Application property to return the Application object. The following example applies the Windows property to the Application object.

VBA Copy code Copy code
Application.Windows("book1.xls").Activate

The following example creates a Microsoft Excel workbook object in another application and then opens a workbook in Microsoft Excel.

VBA Copy code Copy code
Set xl = CreateObject("Excel.Sheet")
xl.Application.Workbooks.Open "newbook.xls"

Many of the properties and methods that return the most common user-interface objects, such as the active cell (ActiveCell property), can be used without the Application object qualifier. For example, instead of writing

VBA Copy code Copy code
Application.ActiveCell.Font.Bold = True

You can write

VBA Copy code Copy code
ActiveCell.Font.Bold = True

See also

Concepts

Excel Object Model Reference

Other resources

Application Object Members


Application Members (Excel)

 Copy code hover
[image]

Application Members (Excel)
Send feedback

Published: July 16, 2012

Represents the entire Microsoft Excel application.

Events

Name | Description
AfterCalculate | The AfterCalculate event occurs when all pending refresh activity (both synchronous and asynchronous) and all of the resultant calculation activities have been completed.
NewWorkbook | Occurs when a new workbook is created.
ProtectedViewWindowActivate | Occurs when a Protected View window is activated.
ProtectedViewWindowBeforeClose | Occurs immediately before a Protected View window or a workbook in a Protected View window closes.
ProtectedViewWindowBeforeEdit | Occurs immediately before editing is enabled on the workbook in the specified Protected View window.
ProtectedViewWindowDeactivate | Occurs when a Protected View window is deactivated.
ProtectedViewWindowOpen | Occurs when a workbook is opened in a Protected View window.
ProtectedViewWindowResize | Occurs when any Protected View window is resized.
SheetActivate | Occurs when any sheet is activated.
SheetBeforeDelete |
SheetBeforeDoubleClick | Occurs when any worksheet is double-clicked, before the default double-click action.
SheetBeforeRightClick | Occurs when any worksheet is right-clicked, before the default right-click action.
SheetCalculate | Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.
SheetChange | Occurs when cells in any worksheet are changed by the user or by an external link.
SheetDeactivate | Occurs when any sheet is deactivated.
SheetFollowHyperlink | Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.
SheetLensGalleryRenderComplete | Occurs after a callout gallery's icons (dynamic & static) have finished rendering.
SheetPivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
SheetPivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
SheetPivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
SheetPivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
SheetPivotTableUpdate | Occurs after the sheet of the PivotTable report has been updated.
SheetSelectionChange | Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).
SheetTableUpdate | Occurs when a table on a worksheet is updated.
WindowActivate | Occurs when any workbook window is activated.
WindowDeactivate | Occurs when any workbook window is deactivated.
WindowResize | Occurs when any workbook window is resized.
WorkbookActivate | Occurs when any workbook is activated.
WorkbookAddinInstall | Occurs when a workbook is installed as an add-in.
WorkbookAddinUninstall | Occurs when any add-in workbook is uninstalled.
WorkbookAfterSave | Occurs after the workbook is saved.
WorkbookAfterXmlExport | Occurs after Microsoft Excel saves or exports XML data from the specified workbook.
WorkbookAfterXmlImport | Occurs after an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.
WorkbookBeforeClose | Occurs immediately before any open workbook closes.
WorkbookBeforePrint | Occurs before any open workbook is printed.
WorkbookBeforeSave | Occurs before any open workbook is saved.
WorkbookBeforeXmlExport | Occurs before Microsoft Excel saves or exports XML data from the specified workbook.
WorkbookBeforeXmlImport | Occurs before an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.
WorkbookDeactivate | Occurs when any open workbook is deactivated.
WorkbookModelChange | Occurs when the data model is updated.
WorkbookNewChart | Occurs when a new chart is created in any open workbook.
WorkbookNewSheet | Occurs when a new sheet is created in any open workbook.
WorkbookOpen | Occurs when a workbook is opened.
WorkbookPivotTableCloseConnection | Occurs after a PivotTable report connection has been closed.
WorkbookPivotTableOpenConnection | Occurs after a PivotTable report connection has been opened.
WorkbookRowsetComplete | The WorkbookRowsetComplete event occurs when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.
WorkbookSync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Methods

Name | Description
ActivateMicrosoftApp | Activates a Microsoft application. If the application is already running, this method activates the running application. If the application isn't running, this method starts a new instance of the application.
AddCustomList | Adds a custom list for custom autofill and/or custom sort.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
CalculateFull | Forces a full calculation of the data in all open workbooks.
CalculateFullRebuild | For all open workbooks, forces a full calculation of the data and rebuilds the dependencies.
CalculateUntilAsyncQueriesDone | Runs all pending queries to OLEDB and OLAP data sources.
CentimetersToPoints | Converts a measurement from centimeters to points (one point equals 0.035 centimeters).
CheckAbort | Stops recalculation in a Microsoft Excel application.
CheckSpelling | Checks the spelling of a single word.
ConvertFormula | Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both. Variant.
DDEExecute | Runs a command or performs some other action or actions in another application by way of the specified DDE channel.
DDEInitiate | Opens a DDE channel to an application.
DDEPoke | Sends data to an application.
DDERequest | Requests information from the specified application. This method always returns an array.
DDETerminate | Closes a channel to another application.
DeleteCustomList | Deletes a custom list.
DisplayXMLSourcePane | Opens the XML Source task pane and displays the XML map specified by the XmlMap argument.
DoubleClick | Equivalent to double-clicking the active cell.
Evaluate | Converts a Microsoft Excel name to an object or a value.
ExecuteExcel4Macro | Runs a Microsoft Excel 4.0 macro function and then returns the result of the function. The return type depends on the function.
FindFile | Displays the Open dialog box.
GetCustomListContents | Returns a custom list (an array of strings).
GetCustomListNum | Returns the custom list number for an array of strings. You can use this method to match both built-in lists and custom-defined lists.
GetOpenFilename | Displays the standard Open dialog box and gets a file name from the user without actually opening any files.
GetPhonetic | Returns the Japanese phonetic text of the specified text string. This method is available to you only if you have selected or installed Japanese language support for Microsoft Office.
GetSaveAsFilename | Displays the standard Save As dialog box and gets a file name from the user without actually saving any files.
Goto | Selects any range or Visual Basic procedure in any workbook, and activates that workbook if it's not already active.
Help | Displays a Help topic.
InchesToPoints | Converts a measurement from inches to points.
InputBox | Displays a dialog box for user input. Returns the information entered in the dialog box.
Intersect | Returns a Range object that represents the rectangular intersection of two or more ranges.
MacroOptions | Corresponds to options in the Macro Options dialog box. You can also use this method to display a user defined function (UDF) in a built-in or new category within the Insert Function dialog box.
MailLogoff | Closes a MAPI mail session established by Microsoft Excel.
MailLogon | Logs in to MAPI Mail or Microsoft Exchange and establishes a mail session. If Microsoft Mail isn't already running, you must use this method to establish a mail session before mail or document routing functions can be used.
NextLetter | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
OnKey | Runs a specified procedure when a particular key or key combination is pressed.
OnRepeat | Sets the Repeat item and the name of the procedure that will run if you choose the Repeat command after running the procedure that sets this property.
OnTime | Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).
OnUndo | Sets the text of the Undo command and the name of the procedure that's run if you choose the Undo command after running the procedure that sets this property.
Quit | Quits Microsoft Excel.
RecordMacro | Records code if the macro recorder is on.
RegisterXLL | Loads an XLL code resource and automatically registers the functions and commands contained in the resource.
Repeat | Repeats the last user-interface action.
Run | Runs a macro or calls a function. This can be used to run a macro written in Visual Basic or the Microsoft Excel macro language, or to run a function in a DLL or XLL.
SendKeys | Sends keystrokes to the active application.
SharePointVersion | Returns the version number of SharePoint Foundation instances running at site for the specified URL.
Undo | Cancels the last user-interface action.
Union | Returns the union of two or more ranges.
Volatile | Marks a user-defined function as volatile. A volatile function must be recalculated whenever calculation occurs in any cells on the worksheet. A nonvolatile function is recalculated only when the input variables change. This method has no effect if it's not inside a user-defined function used to calculate a worksheet cell.
Wait | Pauses a running macro until a specified time. Returns True if the specified time has arrived.

Properties

Name | Description
ActiveCell | Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActiveEncryptionSession | Returns a Long that represents the encryption session associated with the active document. Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active Protected View window (the window on top). Read-only. Returns Nothing if there are no Protected View windows open. Read-only
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveWindow | Returns a Window object that represents the active window (the window on top). Read-only. Returns Nothing if there are no windows open.
ActiveWorkbook | Returns a Workbook object that represents the workbook in the active window (the window on top). Read-only. Returns Nothing if there are no windows open or if either the Info window or the Clipboard window is the active window.
AddIns | Returns an AddIns collection that represents all the add-ins listed in the Add-Ins dialog box (Add-Ins command on the Developer tab). Read-only.
AddIns2 | Returns an AddIns2 collection that represents all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed. Read-only
AlertBeforeOverwriting | True if Microsoft Excel displays a message before overwriting nonblank cells during a drag-and-drop editing operation. Read/write Boolean.
AltStartupPath | Returns or sets the name of the alternate startup folder. Read/write String.
AlwaysUseClearType | Returns or sets a Boolean that represents whether to use ClearType to display fonts in the menu, ribbon, and dialog box text. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ArbitraryXMLSupportAvailable | Returns a Boolean value that indicates whether the XML features in Microsoft Excel are available. Read-only.
AskToUpdateLinks | True if Microsoft Excel asks the user to update links when opening files with links. False if links are automatically updated with no dialog box. Read/write Boolean.
Assistance | Returns an IAssistance object for Microsoft Excel that represents the Microsoft Office Help Viewer. Read-only.
AutoCorrect | Returns an AutoCorrect object that represents the Microsoft Excel AutoCorrect attributes. Read-only.
AutoFormatAsYouTypeReplaceHyperlinks | True (default) if Microsoft Excel automatically formats hyperlinks as you type. False if Excel does not automatically format hyperlinks as you type. Read/write Boolean.
AutomationSecurity | Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files. Read/write.
AutoPercentEntry | True if entries in cells formatted as percentages aren't automatically multiplied by 100 as soon as they are entered. Read/write Boolean.
AutoRecover | Returns an AutoRecover object, which backs up all file formats on a timed interval.
Build | Returns the Microsoft Excel build number. Read-only Long.
CalculateBeforeSave | True if workbooks are calculated before they're saved to disk (if the Calculation property is set to xlManual). This property is preserved even if you change the Calculation property. Read/write Boolean.
Calculation | Returns or sets a XlCalculation value that represents the calculation mode.
CalculationInterruptKey | Sets or returns an XlCalculationInterruptKey constant that specifies the key that can interrupt Microsoft Excel when performing calculations. Read/write.
CalculationState | Returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel. Read-only.
CalculationVersion | Returns a number whose rightmost four digits are the minor calculation engine version number, and whose other digits (on the left) are the major version of Microsoft Excel. Read-only Long.
Caller | Returns information about how Visual Basic was called (for more information, see the Remarks section).
CanPlaySounds | This property should not be used. Sound notes have been removed from Microsoft Excel.
CanRecordSounds | This property should not be used. Sound notes have been removed from Microsoft Excel.
Caption | Returns or sets a String value that represents the name that appears in the title bar of the main Microsoft Excel window.
CellDragAndDrop | True if dragging and dropping cells is enabled. Read/write Boolean.
Cells | Returns a Range object that represents all the cells on the active worksheet. If the active document is not a worksheet, this property fails.
ChartDataPointTrack | True will cause all charts in newly created documents to use the cell reference tracking behavior.Boolean
Charts | Returns a Sheets collection that represents all the chart sheets in the active workbook.
ClipboardFormats | Returns the formats that are currently on the Clipboard, as an array of numeric values. To determine whether a particular format is on the Clipboard, compare each element in the array with the appropriate constant listed in the Remarks section. Read-only Variant.
ClusterConnector | Returns or sets the name of the High Performance Computing (HPC) Cluster Connector that is used to run user-defined functions in XLL add-ins. Read/write
Columns | Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.
COMAddIns | Returns the COMAddIns collection for Microsoft Excel, which represents the currently installed COM add-ins. Read-only.
CommandBars | Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.
CommandUnderlines | Returns or sets the state of the command underlines in Microsoft Excel for the Macintosh. Can be one of the constants of XlCommandUnderlines. Read/write Long.
ConstrainNumeric | True if handwriting recognition is limited to numbers and punctuation only. Read/write Boolean.
ControlCharacters | True if Microsoft Excel displays control characters for right-to-left languages. Read/write Boolean.
CopyObjectsWithCells | True if objects are cut, copied, extracted, and sorted with cells. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Cursor | Returns or sets the appearance of the mouse pointer in Microsoft Excel. Read/write XlMousePointer.
CursorMovement | Returns or sets a value that indicates whether a visual cursor or a logical cursor is used. Can be one of the following constants: xlVisualCursor or xlLogicalCursor. Read/write Long.
CustomListCount | Returns the number of defined custom lists (including built-in lists). Read-only Long.
CutCopyMode | Returns or sets the status of Cut or Copy mode. Can be True, False, or an XLCutCopyMode constant, as shown in the following tables. Read/write Long.
DataEntryMode | Returns or sets Data Entry mode, as shown in the following table. When in Data Entry mode, you can enter data only in the unlocked cells in the currently selected range. Read/write Long.
DDEAppReturnCode | Returns the application-specific DDE return code that was contained in the last DDE acknowledge message received by Microsoft Excel. Read-only Long.
DecimalSeparator | Sets or returns the character used for the decimal separator as a String. Read/write.
DefaultFilePath | Returns or sets the default path that Microsoft Excel uses when it opens files. Read/write String.
DefaultSaveFormat | Returns or sets the default format for saving files. For a list of valid constants, see the FileFormat property. Read/write Long.
DefaultSheetDirection | Returns or sets the default direction in which Microsoft Excel displays new windows and worksheets. Can be one of the following constants: xlRTL (right to left) or xlLTR (left to right). Read/write Long.
DefaultWebOptions | Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Excel whenever you save a document as a Web page or open a Web page. Read-only.
DeferAsyncQueries | Gets or sets whether asychronous queries to OLAP data sources are executed when a worksheet is calculated by VBA code. Read/write Boolean.
Dialogs | Returns a Dialogs collection that represents all built-in dialog boxes. Read-only.
DisplayAlerts | True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.
DisplayClipboardWindow | Returns True if the Microsoft Office Clipboard can be displayed. Read/write Boolean.
DisplayCommentIndicator | Returns or sets the way cells display comments and indicators. Can be one of the XlCommentDisplayMode constants.
DisplayDocumentActionTaskPane | Set to True to display the Document Actions task pane; set to False to hide the Document Actions task pane. Read/write Boolean.
DisplayDocumentInformationPanel | Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write Boolean.
DisplayExcel4Menus | True if Microsoft Excel displays version 4.0 menu bars. Read/write Boolean.
DisplayFormulaAutoComplete | Gets or sets whether to show a list of relevant functions and defined names when building cell formulas. Read/write Boolean.
DisplayFormulaBar | True if the formula bar is displayed. Read/write Boolean.
DisplayFullScreen | True if Microsoft Excel is in full-screen mode. Read/write Boolean.
DisplayFunctionToolTips | True if function ToolTips can be displayed. Read/write Boolean.
DisplayInsertOptions | True if the Insert Options button should be displayed. Read/write Boolean.
DisplayNoteIndicator | True if cells containing notes display cell tips and contain note indicators (small dots in their upper-right corners). Read/write Boolean.
DisplayPasteOptions | True if the Paste Options button can be displayed. Read/write Boolean.
DisplayRecentFiles | True if the list of recently used files is displayed in the UI. Read/write Boolean.
DisplayScrollBars | True if scroll bars are visible for all workbooks. Read/write Boolean.
DisplayStatusBar | True if the status bar is displayed. Read/write Boolean.
EditDirectlyInCell | True if Microsoft Excel allows editing in cells. Read/write Boolean.
EnableAutoComplete | True if the AutoComplete feature is enabled. Read/write Boolean.
EnableCancelKey | Controls how Microsoft Excel handles CTRL+BREAK (or ESC or COMMAND+PERIOD) user interruptions to the running procedure. Read/write XlEnableCancelKey.
EnableCheckFileExtensions |
EnableEvents | True if events are enabled for the specified object. Read/write Boolean.
EnableLargeOperationAlert | Sets or returns a Boolean that represents whether to display an alert message when a user attempts to perform an operation that affects a larger number of cells than is specified in the Office center UI. Read/write Boolean.
EnableLivePreview | Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. Setting this property to True shows a preview of your workbook before applying the command. Read/write Boolean.
EnableMacroAnimations | Controls whether macro animations are enabled. True if user interface animations or chart animations are enabled. Is set to False (no animation) by default. If it is set to True during the running of a macro, it will enable animation and then will reset to False after the macro runs. Read/write Boolean.
EnableSound | True if sound is enabled for Microsoft Office. Read/write Boolean.
ErrorCheckingOptions | Returns an ErrorCheckingOptions object, which represents the error checking options for an application.
Excel4IntlMacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.
Excel4MacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.
ExtendList | True if Microsoft Excel automatically extends formatting and formulas to new data that is added to a list. Read/write Boolean.
FeatureInstall | Returns or sets a value (constant) that specifies how Microsoft Excel handles calls to methods and properties that require features that aren't yet installed. Can be one of the MsoFeatureInstall constants listed in the following table. Read/write MsoFeatureInstall.
FileConverters | Returns information about installed file converters. Returns null if there are no converters installed. Read-only Variant.
FileDialog | Returns a FileDialog object representing an instance of the file dialog.
FileExportConverters | Returns a FileExportConverters collection that represents all the file converters for saving files available to Microsoft Excel. Read-only.
FileValidation | Returns or sets how Excel will validate files before opening them. Read/write
FileValidationPivot | Returns or sets how Excel will validate the contents of the data caches for PivotTable reports. Read/write
FindFormat | Sets or returns the search criteria for the type of cell formats to find.
FixedDecimal | All data entered after this property is set to True will be formatted with the number of fixed decimal places set by the FixedDecimalPlaces property. Read/write Boolean.
FixedDecimalPlaces | Returns or sets the number of fixed decimal places used when the FixedDecimal property is set to True. Read/write Long.
FlashFill | TRUE indicates that the Excel Flash Fill feature has been enabled and active. Boolean Read/Write
FlashFillMode | True if the Flash Fill feature is enabled. Boolean Read/Write
FormulaBarHeight | Allows the user to specify the height of the formula bar in lines. Read/write Long.
GenerateGetPivotData | Returns True when Microsoft Excel can get PivotTable report data. Read/write Boolean.
GenerateTableRefs | The GenerateTableRefs property determines whether the traditional notation method or the new structured referencing notation method is used for referencing tables in formulas. Read/write.
Height | Returns or sets a Double value that represents tThe height, in points, of the main application window.
HighQualityModeForGraphics | Returns or sets whether Excel uses high quality mode to print graphics. Read/write
Hinstance | Returns a handle to the instance of Microsoft Excel 2013 represented by the Application object. Read-only Long.
HinstancePtr | Returns a handle to the instance of Microsoft Excel 2013 represented by the specified Application object. Read-only Variant.
Hwnd | Returns a Long indicating the top-level window handle of the Microsoft Excel window. Read-only.
IgnoreRemoteRequests | True if remote DDE requests are ignored. Read/write Boolean.
Interactive | True if Microsoft Excel is in interactive mode; this property is usually True. If you set the this property to False, Microsoft Excel will block all input from the keyboard and mouse (except input to dialog boxes that are displayed by your code). Read/write Boolean.
International | Returns information about the current country/region and international settings. Read-only Variant.
IsSandboxed | Returns True if the specified workbook is open in a Protected View window. Read-only
Iteration | True if Microsoft Excel will use iteration to resolve circular references. Read/write Boolean.
LanguageSettings | Returns the LanguageSettings object, which contains information about the language settings in Microsoft Excel. Read-only.
LargeOperationCellThousandCount | Returns or sets the maximum number of cells needed in an operation beyond which an alert is triggered. Read/write Long.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the screen to the left edge of the main Microsoft Excel window.
LibraryPath | Returns the path to the Library folder, but without the final separator. Read-only String.
MailSession | Returns the MAPI mail session number as a hexadecimal string (if there's an active session), or returns null if there's no session. Read-only Variant.
MailSystem | Returns the mail system that's installed on the host machine. Read-only XlMailSystem.
MapPaperSize | True if documents formatted for the standard paper size of another country/region (for example, A4) are automatically adjusted so that they're printed correctly on the standard paper size (for example, Letter) of your country/region. Read/write Boolean.
MathCoprocessorAvailable | True if a math coprocessor is available. Read-only Boolean.
MaxChange | Returns or sets the maximum amount of change between each iteration as Microsoft Excel resolves circular references. Read/write Double.
MaxIterations | Returns or sets the maximum number of iterations that Microsoft Excel can use to resolve a circular reference. Read/write Long.
MeasurementUnit | Specifies the measurement unit used in the application. Read/write xlMeasurementUnit.
MergeInstances |
MouseAvailable | True if a mouse is available. Read-only Boolean.
MoveAfterReturn | True if the active cell will be moved as soon as the ENTER (RETURN) key is pressed. Read/write Boolean.
MoveAfterReturnDirection | Returns or sets the direction in which the active cell is moved when the user presses ENTER. Read/write XlDirection.
MultiThreadedCalculation | Returns a MultiThreadedCalculation object that controls the multi-threaded recalculation settings. Read-only.
Name | Returns a String value that represents the name of the object.
Names | Returns a Names collection that represents all the names in the active workbook. Read-only Names object.
NetworkTemplatesPath | Returns the network path where templates are stored. If the network path doesn't exist, this property returns an empty string. Read-only String.
NewWorkbook | Returns a NewFile object.
ODBCErrors | Returns an ODBCErrors collection that contains all the ODBC errors generated by the most recent query table or PivotTable report operation. Read-only.
ODBCTimeout | Returns or sets the ODBC query time limit, in seconds. The default value is 45 seconds. Read/write Long.
OLEDBErrors | Returns the OLEDBErrors collection, which represents the error information returned by the most recent OLE DB query. Read-only.
OnWindow | Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.
OperatingSystem | Returns the name and version number of the current operating system — for example, "Windows (32-bit) 4.00" or "Macintosh 7.00". Read-only String.
OrganizationName | Returns the registered organization name. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the application, excluding the final separator and name of the application.
PathSeparator | Returns the path separator character ("\"). Read-only String.
PivotTableSelection | True if PivotTable reports use structured selection. Read/write Boolean.
PreviousSelections | Returns an array of the last four ranges or names selected. Each element in the array is a Range object. Read-only Variant.
PrintCommunication | Specifies whether communication with the printer is turned on. Boolean Read/write
ProductCode | Returns the globally unique identifier (GUID) for Microsoft Excel. Read-only String.
PromptForSummaryInfo | True if Microsoft Excel asks for summary information when files are first saved. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows collection that represents all the Protected View windows that are open in the application. Read-only
QuickAnalysis | Returns a QuickAnalysis object that represents the Quick Analysis options of the application.
Range | Returns a Range object that represents a cell or a range of cells.
Ready | Returns True when the Microsoft Excel application is ready; False when the Excel application is not ready. Read-only Boolean.
RecentFiles | Returns a RecentFiles collection that represents the list of recently used files.
RecordRelative | True if macros are recorded using relative references; False if recording is absolute. Read-only Boolean.
ReferenceStyle | Returns or sets how Microsoft Excel displays cell references and row and column headings in either A1 or R1C1 reference style. Read/write XlReferenceStyle.
RegisteredFunctions | Returns information about functions in either dynamic-link libraries (DLLs) or code resources that were registered with the REGISTER or REGISTER.ID macro functions. Read-only Variant.
ReplaceFormat | Sets the replacement criteria to use in replacing cell formats. The replacement criteria is then used in a subsequent call to the Replace method of the Range object.
RollZoom | True if the IntelliMouse zooms instead of scrolling. Read/write Boolean.
Rows | Returns a Range object that represents all the rows on the active worksheet. If the active document isn't a worksheet, the Rows property fails. Read-only Range object.
RTD | Returns an RTD object.
ScreenUpdating | True if screen updating is turned on. Read/write Boolean.
Selection | Returns the selected object in the active window for an Application object.
Sheets | Returns a Sheets collection that represents all the sheets in the active workbook. Read-only Sheets object.
SheetsInNewWorkbook | Returns or sets the number of sheets that Microsoft Excel automatically inserts into new workbooks. Read/write Long.
ShowChartTipNames | True if charts show chart tip names. The default value is True. Read/write Boolean.
ShowChartTipValues | True if charts show chart tip values. The default value is True. Read/write Boolean.
ShowDevTools | Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write Boolean.
ShowMenuFloaties | Returns or sets a Boolean that represents whether to display Mini toolbars when the user right-clicks in the workbook window. False if Mini toolbars are displayed. Read/write Boolean.
ShowQuickAnalysis | Controls whether the Quick Analysis contextual user interface is displayed on selection. TRUE means the Quick Analysis button will show. Corresponds to the Show Quick Analysis options on selection checkbox located in the File menu, Options, Excel Options, and then General tab. Read/Write. Boolean.
ShowSelectionFloaties | Returns or sets a Boolean that represents whether Mini toolbars displays when a user selects text. False if Mini toolbars are displayed. Read/write Boolean.
ShowStartupDialog | Returns True (default is False) when the New Workbook task pane appears for a Microsoft Excel application. Read/write Boolean.
ShowToolTips | True if ToolTips are turned on. Read/write Boolean.
SmartArtColors | Returns the set of color styles that are currently loaded in the application. Read-only
SmartArtLayouts | Returns the set of SmartArt layouts that are currently loaded in the application. Read-only
SmartArtQuickStyles | Returns the set of SmartArt quick styles which are currently loaded in the application. Read-only
Speech | Returns a Speech object.
SpellingOptions | Returns a SpellingOptions object that represents the spelling options of the application.
StandardFont | Returns or sets the name of the standard font. Read/write String.
StandardFontSize | Returns or sets the standard font size, in points. Read/write Long.
StartupPath | Returns the complete path of the startup folder, excluding the final separator. Read-only String.
StatusBar | Returns or sets the text in the status bar. Read/write String.
TemplatesPath | Returns the local path where templates are stored. Read-only String.
ThisCell | Returns the cell in which the user-defined function is being called from as a Range object.
ThisWorkbook | Returns a Workbook object that represents the workbook where the current macro code is running. Read-only.
ThousandsSeparator | Sets or returns the character used for the thousands separator as a String. Read/write.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the screen to the top edge of the main Microsoft Excel window.
TransitionMenuKey | Returns or sets the Microsoft Excel menu or help key, which is usually "/". Read/write String.
TransitionMenuKeyAction | Returns or sets the action taken when the Microsoft Excel menu key is pressed. Can be either xlExcelMenus or xlLotusHelp. Read/write Long.
TransitionNavigKeys | True if transition navigation keys are active. Read/write Boolean.
UsableHeight | Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.
UsableWidth | Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.
UseClusterConnector | Returns or sets whether Excel allows user-defined functions in XLL add-ins to be run on a compute cluster. Read/write
UsedObjects | Returns a UsedObjects object representing objects allocated in a workbook. Read-only
UserControl | True if the application is visible or if it was created or started by the user. False if you created or started the application programmatically by using the CreateObject or GetObject functions, and the application is hidden. Read/write Boolean.
UserLibraryPath | Returns the path to the location on the user's computer where the COM add-ins are installed. Read-only String.
UserName | Returns or sets the name of the current user. Read/write String.
UseSystemSeparators | True (default) if the system separators of Microsoft Excel are enabled. Read/write Boolean.
Value | Returns a String value that represents the name of the application.
VBE | Returns a VBE object that represents the Visual Basic Editor. Read-only.
Version | Returns a String value that represents the Microsoft Excel version number.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
WarnOnFunctionNameConflict | The WarnOnFunctionNameConflict property, when set to True, raises an alert if a developer tries to create a new function using an existing function name. Read/write Boolean.
Watches | Returns a Watches object representing a range which is tracked when the worksheet is recalculated.
Width | Returns or sets a Double value that represents the distance, in points, from the left edge of the application window to its right edge.
Windows | Returns a Windows collection that represents all the windows in all the workbooks. Read-only Windows object.
WindowsForPens | True if the computer is running under Microsoft Windows for Pen Computing. Read-only Boolean.
WindowState | Returns or sets the state of the window. Read/write XlWindowState.
Workbooks | Returns a Workbooks collection that represents all the open workbooks. Read-only.
WorksheetFunction | Returns the WorksheetFunction object. Read-only.
Worksheets | For an Application object, returns a Sheets collection that represents all the worksheets in the active workbook. For a Workbook object, returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.


Application Properties (Excel)

 Copy code hover
[image]

Application Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveCell | Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActiveEncryptionSession | Returns a Long that represents the encryption session associated with the active document. Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active Protected View window (the window on top). Read-only. Returns Nothing if there are no Protected View windows open. Read-only
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveWindow | Returns a Window object that represents the active window (the window on top). Read-only. Returns Nothing if there are no windows open.
ActiveWorkbook | Returns a Workbook object that represents the workbook in the active window (the window on top). Read-only. Returns Nothing if there are no windows open or if either the Info window or the Clipboard window is the active window.
AddIns | Returns an AddIns collection that represents all the add-ins listed in the Add-Ins dialog box (Add-Ins command on the Developer tab). Read-only.
AddIns2 | Returns an AddIns2 collection that represents all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed. Read-only
AlertBeforeOverwriting | True if Microsoft Excel displays a message before overwriting nonblank cells during a drag-and-drop editing operation. Read/write Boolean.
AltStartupPath | Returns or sets the name of the alternate startup folder. Read/write String.
AlwaysUseClearType | Returns or sets a Boolean that represents whether to use ClearType to display fonts in the menu, ribbon, and dialog box text. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ArbitraryXMLSupportAvailable | Returns a Boolean value that indicates whether the XML features in Microsoft Excel are available. Read-only.
AskToUpdateLinks | True if Microsoft Excel asks the user to update links when opening files with links. False if links are automatically updated with no dialog box. Read/write Boolean.
Assistance | Returns an IAssistance object for Microsoft Excel that represents the Microsoft Office Help Viewer. Read-only.
AutoCorrect | Returns an AutoCorrect object that represents the Microsoft Excel AutoCorrect attributes. Read-only.
AutoFormatAsYouTypeReplaceHyperlinks | True (default) if Microsoft Excel automatically formats hyperlinks as you type. False if Excel does not automatically format hyperlinks as you type. Read/write Boolean.
AutomationSecurity | Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files. Read/write.
AutoPercentEntry | True if entries in cells formatted as percentages aren't automatically multiplied by 100 as soon as they are entered. Read/write Boolean.
AutoRecover | Returns an AutoRecover object, which backs up all file formats on a timed interval.
Build | Returns the Microsoft Excel build number. Read-only Long.
CalculateBeforeSave | True if workbooks are calculated before they're saved to disk (if the Calculation property is set to xlManual). This property is preserved even if you change the Calculation property. Read/write Boolean.
Calculation | Returns or sets a XlCalculation value that represents the calculation mode.
CalculationInterruptKey | Sets or returns an XlCalculationInterruptKey constant that specifies the key that can interrupt Microsoft Excel when performing calculations. Read/write.
CalculationState | Returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel. Read-only.
CalculationVersion | Returns a number whose rightmost four digits are the minor calculation engine version number, and whose other digits (on the left) are the major version of Microsoft Excel. Read-only Long.
Caller | Returns information about how Visual Basic was called (for more information, see the Remarks section).
CanPlaySounds | This property should not be used. Sound notes have been removed from Microsoft Excel.
CanRecordSounds | This property should not be used. Sound notes have been removed from Microsoft Excel.
Caption | Returns or sets a String value that represents the name that appears in the title bar of the main Microsoft Excel window.
CellDragAndDrop | True if dragging and dropping cells is enabled. Read/write Boolean.
Cells | Returns a Range object that represents all the cells on the active worksheet. If the active document is not a worksheet, this property fails.
ChartDataPointTrack | True will cause all charts in newly created documents to use the cell reference tracking behavior.Boolean
Charts | Returns a Sheets collection that represents all the chart sheets in the active workbook.
ClipboardFormats | Returns the formats that are currently on the Clipboard, as an array of numeric values. To determine whether a particular format is on the Clipboard, compare each element in the array with the appropriate constant listed in the Remarks section. Read-only Variant.
ClusterConnector | Returns or sets the name of the High Performance Computing (HPC) Cluster Connector that is used to run user-defined functions in XLL add-ins. Read/write
Columns | Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.
COMAddIns | Returns the COMAddIns collection for Microsoft Excel, which represents the currently installed COM add-ins. Read-only.
CommandBars | Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.
CommandUnderlines | Returns or sets the state of the command underlines in Microsoft Excel for the Macintosh. Can be one of the constants of XlCommandUnderlines. Read/write Long.
ConstrainNumeric | True if handwriting recognition is limited to numbers and punctuation only. Read/write Boolean.
ControlCharacters | True if Microsoft Excel displays control characters for right-to-left languages. Read/write Boolean.
CopyObjectsWithCells | True if objects are cut, copied, extracted, and sorted with cells. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Cursor | Returns or sets the appearance of the mouse pointer in Microsoft Excel. Read/write XlMousePointer.
CursorMovement | Returns or sets a value that indicates whether a visual cursor or a logical cursor is used. Can be one of the following constants: xlVisualCursor or xlLogicalCursor. Read/write Long.
CustomListCount | Returns the number of defined custom lists (including built-in lists). Read-only Long.
CutCopyMode | Returns or sets the status of Cut or Copy mode. Can be True, False, or an XLCutCopyMode constant, as shown in the following tables. Read/write Long.
DataEntryMode | Returns or sets Data Entry mode, as shown in the following table. When in Data Entry mode, you can enter data only in the unlocked cells in the currently selected range. Read/write Long.
DDEAppReturnCode | Returns the application-specific DDE return code that was contained in the last DDE acknowledge message received by Microsoft Excel. Read-only Long.
DecimalSeparator | Sets or returns the character used for the decimal separator as a String. Read/write.
DefaultFilePath | Returns or sets the default path that Microsoft Excel uses when it opens files. Read/write String.
DefaultSaveFormat | Returns or sets the default format for saving files. For a list of valid constants, see the FileFormat property. Read/write Long.
DefaultSheetDirection | Returns or sets the default direction in which Microsoft Excel displays new windows and worksheets. Can be one of the following constants: xlRTL (right to left) or xlLTR (left to right). Read/write Long.
DefaultWebOptions | Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Excel whenever you save a document as a Web page or open a Web page. Read-only.
DeferAsyncQueries | Gets or sets whether asychronous queries to OLAP data sources are executed when a worksheet is calculated by VBA code. Read/write Boolean.
Dialogs | Returns a Dialogs collection that represents all built-in dialog boxes. Read-only.
DisplayAlerts | True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.
DisplayClipboardWindow | Returns True if the Microsoft Office Clipboard can be displayed. Read/write Boolean.
DisplayCommentIndicator | Returns or sets the way cells display comments and indicators. Can be one of the XlCommentDisplayMode constants.
DisplayDocumentActionTaskPane | Set to True to display the Document Actions task pane; set to False to hide the Document Actions task pane. Read/write Boolean.
DisplayDocumentInformationPanel | Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write Boolean.
DisplayExcel4Menus | True if Microsoft Excel displays version 4.0 menu bars. Read/write Boolean.
DisplayFormulaAutoComplete | Gets or sets whether to show a list of relevant functions and defined names when building cell formulas. Read/write Boolean.
DisplayFormulaBar | True if the formula bar is displayed. Read/write Boolean.
DisplayFullScreen | True if Microsoft Excel is in full-screen mode. Read/write Boolean.
DisplayFunctionToolTips | True if function ToolTips can be displayed. Read/write Boolean.
DisplayInsertOptions | True if the Insert Options button should be displayed. Read/write Boolean.
DisplayNoteIndicator | True if cells containing notes display cell tips and contain note indicators (small dots in their upper-right corners). Read/write Boolean.
DisplayPasteOptions | True if the Paste Options button can be displayed. Read/write Boolean.
DisplayRecentFiles | True if the list of recently used files is displayed in the UI. Read/write Boolean.
DisplayScrollBars | True if scroll bars are visible for all workbooks. Read/write Boolean.
DisplayStatusBar | True if the status bar is displayed. Read/write Boolean.
EditDirectlyInCell | True if Microsoft Excel allows editing in cells. Read/write Boolean.
EnableAutoComplete | True if the AutoComplete feature is enabled. Read/write Boolean.
EnableCancelKey | Controls how Microsoft Excel handles CTRL+BREAK (or ESC or COMMAND+PERIOD) user interruptions to the running procedure. Read/write XlEnableCancelKey.
EnableCheckFileExtensions |
EnableEvents | True if events are enabled for the specified object. Read/write Boolean.
EnableLargeOperationAlert | Sets or returns a Boolean that represents whether to display an alert message when a user attempts to perform an operation that affects a larger number of cells than is specified in the Office center UI. Read/write Boolean.
EnableLivePreview | Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. Setting this property to True shows a preview of your workbook before applying the command. Read/write Boolean.
EnableMacroAnimations | Controls whether macro animations are enabled. True if user interface animations or chart animations are enabled. Is set to False (no animation) by default. If it is set to True during the running of a macro, it will enable animation and then will reset to False after the macro runs. Read/write Boolean.
EnableSound | True if sound is enabled for Microsoft Office. Read/write Boolean.
ErrorCheckingOptions | Returns an ErrorCheckingOptions object, which represents the error checking options for an application.
Excel4IntlMacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.
Excel4MacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.
ExtendList | True if Microsoft Excel automatically extends formatting and formulas to new data that is added to a list. Read/write Boolean.
FeatureInstall | Returns or sets a value (constant) that specifies how Microsoft Excel handles calls to methods and properties that require features that aren't yet installed. Can be one of the MsoFeatureInstall constants listed in the following table. Read/write MsoFeatureInstall.
FileConverters | Returns information about installed file converters. Returns null if there are no converters installed. Read-only Variant.
FileDialog | Returns a FileDialog object representing an instance of the file dialog.
FileExportConverters | Returns a FileExportConverters collection that represents all the file converters for saving files available to Microsoft Excel. Read-only.
FileValidation | Returns or sets how Excel will validate files before opening them. Read/write
FileValidationPivot | Returns or sets how Excel will validate the contents of the data caches for PivotTable reports. Read/write
FindFormat | Sets or returns the search criteria for the type of cell formats to find.
FixedDecimal | All data entered after this property is set to True will be formatted with the number of fixed decimal places set by the FixedDecimalPlaces property. Read/write Boolean.
FixedDecimalPlaces | Returns or sets the number of fixed decimal places used when the FixedDecimal property is set to True. Read/write Long.
FlashFill | TRUE indicates that the Excel Flash Fill feature has been enabled and active. Boolean Read/Write
FlashFillMode | True if the Flash Fill feature is enabled. Boolean Read/Write
FormulaBarHeight | Allows the user to specify the height of the formula bar in lines. Read/write Long.
GenerateGetPivotData | Returns True when Microsoft Excel can get PivotTable report data. Read/write Boolean.
GenerateTableRefs | The GenerateTableRefs property determines whether the traditional notation method or the new structured referencing notation method is used for referencing tables in formulas. Read/write.
Height | Returns or sets a Double value that represents tThe height, in points, of the main application window.
HighQualityModeForGraphics | Returns or sets whether Excel uses high quality mode to print graphics. Read/write
Hinstance | Returns a handle to the instance of Microsoft Excel 2013 represented by the Application object. Read-only Long.
HinstancePtr | Returns a handle to the instance of Microsoft Excel 2013 represented by the specified Application object. Read-only Variant.
Hwnd | Returns a Long indicating the top-level window handle of the Microsoft Excel window. Read-only.
IgnoreRemoteRequests | True if remote DDE requests are ignored. Read/write Boolean.
Interactive | True if Microsoft Excel is in interactive mode; this property is usually True. If you set the this property to False, Microsoft Excel will block all input from the keyboard and mouse (except input to dialog boxes that are displayed by your code). Read/write Boolean.
International | Returns information about the current country/region and international settings. Read-only Variant.
IsSandboxed | Returns True if the specified workbook is open in a Protected View window. Read-only
Iteration | True if Microsoft Excel will use iteration to resolve circular references. Read/write Boolean.
LanguageSettings | Returns the LanguageSettings object, which contains information about the language settings in Microsoft Excel. Read-only.
LargeOperationCellThousandCount | Returns or sets the maximum number of cells needed in an operation beyond which an alert is triggered. Read/write Long.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the screen to the left edge of the main Microsoft Excel window.
LibraryPath | Returns the path to the Library folder, but without the final separator. Read-only String.
MailSession | Returns the MAPI mail session number as a hexadecimal string (if there's an active session), or returns null if there's no session. Read-only Variant.
MailSystem | Returns the mail system that's installed on the host machine. Read-only XlMailSystem.
MapPaperSize | True if documents formatted for the standard paper size of another country/region (for example, A4) are automatically adjusted so that they're printed correctly on the standard paper size (for example, Letter) of your country/region. Read/write Boolean.
MathCoprocessorAvailable | True if a math coprocessor is available. Read-only Boolean.
MaxChange | Returns or sets the maximum amount of change between each iteration as Microsoft Excel resolves circular references. Read/write Double.
MaxIterations | Returns or sets the maximum number of iterations that Microsoft Excel can use to resolve a circular reference. Read/write Long.
MeasurementUnit | Specifies the measurement unit used in the application. Read/write xlMeasurementUnit.
MergeInstances |
MouseAvailable | True if a mouse is available. Read-only Boolean.
MoveAfterReturn | True if the active cell will be moved as soon as the ENTER (RETURN) key is pressed. Read/write Boolean.
MoveAfterReturnDirection | Returns or sets the direction in which the active cell is moved when the user presses ENTER. Read/write XlDirection.
MultiThreadedCalculation | Returns a MultiThreadedCalculation object that controls the multi-threaded recalculation settings. Read-only.
Name | Returns a String value that represents the name of the object.
Names | Returns a Names collection that represents all the names in the active workbook. Read-only Names object.
NetworkTemplatesPath | Returns the network path where templates are stored. If the network path doesn't exist, this property returns an empty string. Read-only String.
NewWorkbook | Returns a NewFile object.
ODBCErrors | Returns an ODBCErrors collection that contains all the ODBC errors generated by the most recent query table or PivotTable report operation. Read-only.
ODBCTimeout | Returns or sets the ODBC query time limit, in seconds. The default value is 45 seconds. Read/write Long.
OLEDBErrors | Returns the OLEDBErrors collection, which represents the error information returned by the most recent OLE DB query. Read-only.
OnWindow | Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.
OperatingSystem | Returns the name and version number of the current operating system — for example, "Windows (32-bit) 4.00" or "Macintosh 7.00". Read-only String.
OrganizationName | Returns the registered organization name. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the application, excluding the final separator and name of the application.
PathSeparator | Returns the path separator character ("\"). Read-only String.
PivotTableSelection | True if PivotTable reports use structured selection. Read/write Boolean.
PreviousSelections | Returns an array of the last four ranges or names selected. Each element in the array is a Range object. Read-only Variant.
PrintCommunication | Specifies whether communication with the printer is turned on. Boolean Read/write
ProductCode | Returns the globally unique identifier (GUID) for Microsoft Excel. Read-only String.
PromptForSummaryInfo | True if Microsoft Excel asks for summary information when files are first saved. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows collection that represents all the Protected View windows that are open in the application. Read-only
QuickAnalysis | Returns a QuickAnalysis object that represents the Quick Analysis options of the application.
Range | Returns a Range object that represents a cell or a range of cells.
Ready | Returns True when the Microsoft Excel application is ready; False when the Excel application is not ready. Read-only Boolean.
RecentFiles | Returns a RecentFiles collection that represents the list of recently used files.
RecordRelative | True if macros are recorded using relative references; False if recording is absolute. Read-only Boolean.
ReferenceStyle | Returns or sets how Microsoft Excel displays cell references and row and column headings in either A1 or R1C1 reference style. Read/write XlReferenceStyle.
RegisteredFunctions | Returns information about functions in either dynamic-link libraries (DLLs) or code resources that were registered with the REGISTER or REGISTER.ID macro functions. Read-only Variant.
ReplaceFormat | Sets the replacement criteria to use in replacing cell formats. The replacement criteria is then used in a subsequent call to the Replace method of the Range object.
RollZoom | True if the IntelliMouse zooms instead of scrolling. Read/write Boolean.
Rows | Returns a Range object that represents all the rows on the active worksheet. If the active document isn't a worksheet, the Rows property fails. Read-only Range object.
RTD | Returns an RTD object.
ScreenUpdating | True if screen updating is turned on. Read/write Boolean.
Selection | Returns the selected object in the active window for an Application object.
Sheets | Returns a Sheets collection that represents all the sheets in the active workbook. Read-only Sheets object.
SheetsInNewWorkbook | Returns or sets the number of sheets that Microsoft Excel automatically inserts into new workbooks. Read/write Long.
ShowChartTipNames | True if charts show chart tip names. The default value is True. Read/write Boolean.
ShowChartTipValues | True if charts show chart tip values. The default value is True. Read/write Boolean.
ShowDevTools | Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write Boolean.
ShowMenuFloaties | Returns or sets a Boolean that represents whether to display Mini toolbars when the user right-clicks in the workbook window. False if Mini toolbars are displayed. Read/write Boolean.
ShowQuickAnalysis | Controls whether the Quick Analysis contextual user interface is displayed on selection. TRUE means the Quick Analysis button will show. Corresponds to the Show Quick Analysis options on selection checkbox located in the File menu, Options, Excel Options, and then General tab. Read/Write. Boolean.
ShowSelectionFloaties | Returns or sets a Boolean that represents whether Mini toolbars displays when a user selects text. False if Mini toolbars are displayed. Read/write Boolean.
ShowStartupDialog | Returns True (default is False) when the New Workbook task pane appears for a Microsoft Excel application. Read/write Boolean.
ShowToolTips | True if ToolTips are turned on. Read/write Boolean.
SmartArtColors | Returns the set of color styles that are currently loaded in the application. Read-only
SmartArtLayouts | Returns the set of SmartArt layouts that are currently loaded in the application. Read-only
SmartArtQuickStyles | Returns the set of SmartArt quick styles which are currently loaded in the application. Read-only
Speech | Returns a Speech object.
SpellingOptions | Returns a SpellingOptions object that represents the spelling options of the application.
StandardFont | Returns or sets the name of the standard font. Read/write String.
StandardFontSize | Returns or sets the standard font size, in points. Read/write Long.
StartupPath | Returns the complete path of the startup folder, excluding the final separator. Read-only String.
StatusBar | Returns or sets the text in the status bar. Read/write String.
TemplatesPath | Returns the local path where templates are stored. Read-only String.
ThisCell | Returns the cell in which the user-defined function is being called from as a Range object.
ThisWorkbook | Returns a Workbook object that represents the workbook where the current macro code is running. Read-only.
ThousandsSeparator | Sets or returns the character used for the thousands separator as a String. Read/write.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the screen to the top edge of the main Microsoft Excel window.
TransitionMenuKey | Returns or sets the Microsoft Excel menu or help key, which is usually "/". Read/write String.
TransitionMenuKeyAction | Returns or sets the action taken when the Microsoft Excel menu key is pressed. Can be either xlExcelMenus or xlLotusHelp. Read/write Long.
TransitionNavigKeys | True if transition navigation keys are active. Read/write Boolean.
UsableHeight | Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.
UsableWidth | Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.
UseClusterConnector | Returns or sets whether Excel allows user-defined functions in XLL add-ins to be run on a compute cluster. Read/write
UsedObjects | Returns a UsedObjects object representing objects allocated in a workbook. Read-only
UserControl | True if the application is visible or if it was created or started by the user. False if you created or started the application programmatically by using the CreateObject or GetObject functions, and the application is hidden. Read/write Boolean.
UserLibraryPath | Returns the path to the location on the user's computer where the COM add-ins are installed. Read-only String.
UserName | Returns or sets the name of the current user. Read/write String.
UseSystemSeparators | True (default) if the system separators of Microsoft Excel are enabled. Read/write Boolean.
Value | Returns a String value that represents the name of the application.
VBE | Returns a VBE object that represents the Visual Basic Editor. Read-only.
Version | Returns a String value that represents the Microsoft Excel version number.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
WarnOnFunctionNameConflict | The WarnOnFunctionNameConflict property, when set to True, raises an alert if a developer tries to create a new function using an existing function name. Read/write Boolean.
Watches | Returns a Watches object representing a range which is tracked when the worksheet is recalculated.
Width | Returns or sets a Double value that represents the distance, in points, from the left edge of the application window to its right edge.
Windows | Returns a Windows collection that represents all the windows in all the workbooks. Read-only Windows object.
WindowsForPens | True if the computer is running under Microsoft Windows for Pen Computing. Read-only Boolean.
WindowState | Returns or sets the state of the window. Read/write XlWindowState.
Workbooks | Returns a Workbooks collection that represents all the open workbooks. Read-only.
WorksheetFunction | Returns the WorksheetFunction object. Read-only.
Worksheets | For an Application object, returns a Sheets collection that represents all the worksheets in the active workbook. For a Workbook object, returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.


Application.ActiveCell Property (Excel)

 Copy code hover
[image]

Application.ActiveCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.

Syntax

expression .ActiveCell

expression A variable that represents an Application object.

Remarks

If you don't specify an object qualifier, this property returns the active cell in the active window.

Be careful to distinguish between the active cell and the selection. The active cell is a single cell inside the current selection. The selection may contain more than one cell, but only one is the active cell.

The following expressions all return the active cell, and are all equivalent.

VBA Copy code Copy code
ActiveCell
Application.ActiveCell
ActiveWindow.ActiveCell
Application.ActiveWindow.ActiveCell

Example

This example uses a message box to display the value in the active cell. Because the ActiveCell property fails if the active sheet isn't a worksheet, the example activates Sheet1 before using the ActiveCell property.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox ActiveCell.Value

This example changes the font formatting for the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
With ActiveCell.Font
 .Bold = True
 .Italic = True
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveChart Property (Excel)

 Copy code hover
[image]

Application.ActiveChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.

Syntax

expression .ActiveChart

expression A variable that represents an Application object.

Remarks

If you don't specify an object qualifier, this property returns the active chart in the active workbook.

Example

This example turns on the legend for the active chart.

VBA Copy code Copy code
ActiveChart.HasLegend = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveEncryptionSession Property (Excel)

 Copy code hover
[image]

Application.ActiveEncryptionSession Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the encryption session associated with the active document. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ActiveEncryptionSession

expression An expression that returns a Application object.

Return Value

Long

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActivePrinter Property (Excel)

 Copy code hover
[image]

Application.ActivePrinter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the active printer. Read/write String.

Syntax

expression .ActivePrinter

expression A variable that represents an Application object.

Example

This example displays the name of the active printer.

VBA Copy code Copy code
MsgBox "The name of the active printer is " & _
 Application.ActivePrinter

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveProtectedViewWindow Property (Excel)

 Copy code hover
[image]

Application.ActiveProtectedViewWindow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindow object that represents the active Protected View window (the window on top). Read-only. Returns Nothing if there are no Protected View windows open. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .ActiveProtectedViewWindow

expression A variable that represents an Application object.

Example

The following code example displays the name (Caption property) of the active Protected View window.

VBA Copy code Copy code
MsgBox "The name of the active Protected View window is " & ActiveProtectedWindow.Caption

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveSheet Property (Excel)

 Copy code hover
[image]

Application.ActiveSheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.

Syntax

expression .ActiveSheet

expression A variable that represents an Application object.

Remarks

If you do not specify an object qualifier, this property returns the active sheet in the active workbook.

If a workbook appears in more than one window, the ActiveSheet property may be different in different windows.

Example

This example displays the name of the active sheet.

VBA Copy code Copy code
MsgBox "The name of the active sheet is " & ActiveSheet.Name

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example creates a print preview of the active sheet that has the page number at the top of column B on each page.

VBA Copy code Copy code
Sub PrintSheets()

   'Set up your variables.
   Dim iRow As Integer, iRowL As Integer, iPage As Integer
   'Find the last row that contains data.
   iRowL = Cells(Rows.Count, 1).End(xlUp).Row

   'Define the print area as the range containing all the data in the first two columns of the current worksheet.
   ActiveSheet.PageSetup.PrintArea = Range("A1:B" & iRowL).Address

   'Select all the rows containing data.
   Rows(iRowL).Select

   'display the automatic page breaks
   ActiveSheet.DisplayAutomaticPageBreaks = True
   Range("B1").Value = "Page 1"

   'After each page break, go to the next cell in column B and write out the page number.
   For iPage = 1 To ActiveSheet.HPageBreaks.Count
      ActiveSheet.HPageBreaks(iPage) _
         .Location.Offset(0, 1).Value = "Page " & iPage + 1
   Next iPage

   'Show the print preview, and afterwards remove the page numbers from column B.
   ActiveSheet.PrintPreview
   Columns("B").ClearContents
   Range("A1").Select
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveWindow Property (Excel)

 Copy code hover
[image]

Application.ActiveWindow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Window object that represents the active window (the window on top). Read-only. Returns Nothing if there are no windows open.

Syntax

expression .ActiveWindow

expression A variable that represents an Application object.

Example

This example displays the name (Caption property) of the active window.

VBA Copy code Copy code
MsgBox "The name of the active window is " & ActiveWindow.Caption

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveWorkbook Property (Excel)

 Copy code hover
[image]

Application.ActiveWorkbook Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Workbook object that represents the workbook in the active window (the window on top). Read-only. Returns Nothing if there are no windows open or if either the Info window or the Clipboard window is the active window.

Note Note

The document in the active protected view window cannot be accessed using this property. Instead, use the Workbook property of the ProtectedViewWindow object.

Syntax

expression .ActiveWorkbook

expression A variable that represents an Application object.

Example

This example displays the name of the active workbook.

VBA Copy code Copy code
MsgBox "The name of the active workbook is " & ActiveWorkbook.Name

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AddIns Property (Excel)

 Copy code hover
[image]

Application.AddIns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AddIns collection that represents all the add-ins listed in the Add-Ins dialog box (Add-Ins command on the Developer tab). Read-only.

Syntax

expression .AddIns

expression A variable that represents an Application object.

Remarks

Using this method without an object qualifier is equivalent to Application.Addins.

Example

This example displays the status of the Analysis ToolPak add-in. Note that the string used as the index to the AddIns collection is the title of the add-in, not the add-in's file name.

VBA Copy code Copy code
If AddIns("Analysis ToolPak").Installed = True Then
 MsgBox "Analysis ToolPak add-in is installed"
Else
 MsgBox "Analysis ToolPak add-in is not installed"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AddIns2 Property (Excel)

 Copy code hover
[image]

Application.AddIns2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AddIns2 collection that represents all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AddIns2

expression A variable that returns an Application object.

Example

This example displays the status of the Analysis ToolPak add-in. Note that the string used as the index to the AddIns collection is the title of the add-in, not the add-in's file name.

VBA Copy code Copy code
If Application.AddIns2("Analysis ToolPak").Installed = True Then
 MsgBox "Analysis ToolPak add-in is installed"
Else
 MsgBox "Analysis ToolPak add-in is not installed"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AlertBeforeOverwriting Property (Excel)

 Copy code hover
[image]

Application.AlertBeforeOverwriting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel displays a message before overwriting nonblank cells during a drag-and-drop editing operation. Read/write Boolean.

Syntax

expression .AlertBeforeOverwriting

expression A variable that represents an Application object.

Example

This example causes Microsoft Excel to display an alert before overwriting nonblank cells during drag-and-drop editing.

VBA Copy code Copy code
Application.AlertBeforeOverwriting = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AltStartupPath Property (Excel)

 Copy code hover
[image]

Application.AltStartupPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the alternate startup folder. Read/write String.

Syntax

expression .AltStartupPath

expression A variable that represents an Application object.

Example

This example sets the alternate startup folder.

VBA Copy code Copy code
Application.AltStartupPath = "C:\EXCEL\MACROS"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AlwaysUseClearType Property (Excel)

 Copy code hover
[image]

Application.AlwaysUseClearType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to use ClearType to display fonts in the menu, ribbon, and dialog box text. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AlwaysUseClearType

expression A variable that represents an Application object.

Remarks

Even if the Microsoft Windows setting for ClearType is turned off, setting this property to True overrides the Windows setting and uses ClearType in all Microsoft Office applications.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Application Property (Excel)

 Copy code hover
[image]

Application.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Application object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ArbitraryXMLSupportAvailable Property (Excel)

 Copy code hover
[image]

Application.ArbitraryXMLSupportAvailable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value that indicates whether the XML features in Microsoft Excel are available. Read-only.

Syntax

expression .ArbitraryXMLSupportAvailable

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AskToUpdateLinks Property (Excel)

 Copy code hover
[image]

Application.AskToUpdateLinks Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel asks the user to update links when opening files with links. False if links are automatically updated with no dialog box. Read/write Boolean.

Syntax

expression .AskToUpdateLinks

expression A variable that represents an Application object.

Example

This example sets Microsoft Excel to ask the user to update links whenever a file that contains links is opened.

VBA Copy code Copy code
Application.AskToUpdateLinks = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Assistance Property (Excel)

 Copy code hover
[image]

Application.Assistance Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an IAssistance object for Microsoft Excel that represents the Microsoft Office Help Viewer. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Assistance

expression A variable that represents an Application object.

Remarks

The IAssistance object allows developers to show custom help and help that is installed with Office in the Office Help Viewer.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoCorrect Property (Excel)

 Copy code hover
[image]

Application.AutoCorrect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that represents the Microsoft Excel AutoCorrect attributes. Read-only.

Syntax

expression .AutoCorrect

expression A variable that represents an Application object.

Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

VBA Copy code Copy code
With Application.AutoCorrect
 .AddReplacement "Temperature", "Temp."
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoFormatAsYouTypeReplaceHyperlinks Property (Excel)

 Copy code hover
[image]

Application.AutoFormatAsYouTypeReplaceHyperlinks Property (Excel)
See also Send feedback

Published: July 16, 2012

True (default) if Microsoft Excel automatically formats hyperlinks as you type. False if Excel does not automatically format hyperlinks as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceHyperlinks

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel determines if the ability to format hyperlinks automatically as they are typed is enabled and notifies the user.

VBA Copy code Copy code
Sub CheckHyperlinks()

 ' Determine if automatic formatting is enabled and notify user.
 If Application.AutoFormatAsYouTypeReplaceHyperlinks = True Then
 MsgBox "Automatic formatting for typing in hyperlinks is enabled."
 Else
 MsgBox "Automatic formatting for typing in hyperlinks is not enabled."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutomationSecurity Property (Excel)

 Copy code hover
[image]

Application.AutomationSecurity Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files. Read/write.

Syntax

expression .AutomationSecurity

expression A variable that represents an Application object.

Remarks

This property is automatically set to msoAutomationSecurityLow when the application is started. Therefore, to avoid breaking solutions that rely on the default setting, you should be careful to reset this property to msoAutomationSecurityLow after programmatically opening a file. Also, this property should be set immediately before and after opening a file programmatically to avoid malicious subversion.

MsoAutomationSecurity can be one of these MsoAutomationSecurity constants.

msoAutomationSecurityByUI. Uses the security setting specified in the Security dialog box.

msoAutomationSecurityForceDisable. Disables all macros in all files opened programmatically without showing any security alerts.

Note Note

This setting does not disable Microsoft Excel 4.0 macros. If a file that contains Microsoft Excel 4.0 macros is opened programmatically, the user will be prompted to decide whether or not to open the file.

msoAutomationSecurityLow. Enables all macros. This is the default value when the application is started.

Setting ScreenUpdating to False does not affect alerts and will not affect security warnings. The DisplayAlerts setting will not apply to security warnings. For example, if the user sets DisplayAlerts equal to False and AutomationSecurity to msoAutomationSecurityByUI, while the user is on Medium security level, then there will be security warnings while the macro is running. This allows the macro to trap file open errors, while still showing the security warning if the file open succeeds.

Example

This example captures the current automation security setting, changes the setting to disable macros, displays the Open dialog box, and after opening the selected document, sets the automation security back to its original setting.

VBA Copy code Copy code
Sub Security()
    Dim secAutomation As MsoAutomationSecurity

    secAutomation = Application.AutomationSecurity

    Application.AutomationSecurity = msoAutomationSecurityForceDisable
    Application.FileDialog(msoFileDialogOpen).Show

    Application.AutomationSecurity = secAutomation

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoPercentEntry Property (Excel)

 Copy code hover
[image]

Application.AutoPercentEntry Property (Excel)
See also Send feedback

Published: July 16, 2012

True if entries in cells formatted as percentages aren't automatically multiplied by 100 as soon as they are entered. Read/write Boolean.

Syntax

expression .AutoPercentEntry

expression A variable that represents an Application object.

Example

This example enables automatic multiplication by 100 for subsequent entries in cells formatted as percentages.

VBA Copy code Copy code
Application.AutoPercentEntry = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoRecover Property (Excel)

 Copy code hover
[image]

Application.AutoRecover Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AutoRecover object, which backs up all file formats on a timed interval.

Syntax

expression .AutoRecover

expression A variable that represents an Application object.

Remarks

Valid time intervals are whole numbers from 1 to 120.

Example

In this example, the Time property is used in conjunction with the AutoRecover property to set the time interval for Microsoft Excel to wait before saving another copy to five minutes.

VBA Copy code Copy code
Sub UseAutoRecover()

 Application.AutoRecover.Time = 5

 MsgBox "The time that will elapse between each automatic " & _
 "save has been set to " & _
 Application.AutoRecover.Time & " minutes."

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Build Property (Excel)

 Copy code hover
[image]

Application.Build Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Microsoft Excel build number. Read-only Long.

Syntax

expression .Build

expression A variable that represents an Application object.

Remarks

It's usually safer to test the Version property, unless you're sure you need to know the build number.

Example

This example tests the Build property.

VBA Copy code Copy code
If Application.Build > 2500 Then
 ' build-dependent code here
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculateBeforeSave Property (Excel)

 Copy code hover
[image]

Application.CalculateBeforeSave Property (Excel)
See also Send feedback

Published: July 16, 2012

True if workbooks are calculated before they're saved to disk (if the Calculation property is set to xlManual). This property is preserved even if you change the Calculation property. Read/write Boolean.

Syntax

expression .CalculateBeforeSave

expression A variable that represents an Application object.

Example

This example sets Microsoft Excel to calculate workbooks before they're saved to disk.

VBA Copy code Copy code
Application.Calculation = xlManual
Application.CalculateBeforeSave = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Calculation Property (Excel)

 Copy code hover
[image]

Application.Calculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlCalculation value that represents the calculation mode.

Syntax

expression .Calculation

expression A variable that represents an Application object.

Remarks

For OLAP data sources, this property can only return or be set to xlNormal.

Example

This example causes Microsoft Excel to calculate workbooks before they are saved to disk.

VBA Copy code Copy code
Application.Calculation = xlCalculationManual
Application.CalculateBeforeSave = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculationInterruptKey Property (Excel)

 Copy code hover
[image]

Application.CalculationInterruptKey Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns an XlCalculationInterruptKey constant that specifies the key that can interrupt Microsoft Excel when performing calculations. Read/write.

Syntax

expression .CalculationInterruptKey

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel determines the setting for the calculation interrupt key and notifies the user.

VBA Copy code Copy code
Sub CheckInterruptKey()

 ' Determine the calculation interrupt key and notify the user.
 Select Case Application.CalculationInterruptKey
 Case xlAnyKey
 MsgBox "The calcuation interrupt key is set to any key."
 Case xlEscKey
 MsgBox "The calcuation interrupt key is set to 'Escape'"
 Case xlNoKey
 MsgBox "The calcuation interrupt key is set to no key."
 End Select

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculationState Property (Excel)

 Copy code hover
[image]

Application.CalculationState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel. Read-only.

Syntax

expression .CalculationState

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel checks to see if any calculations are being performed. If no calculations are being performed, a message displays the calculation state as "Done". Otherwise, a message displays the calculation state as "Not Done".

VBA Copy code Copy code
Sub StillCalculating()

 If Application.CalculationState = xlDone Then
 MsgBox "Done"
 Else
 MsgBox "Not Done"
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculationVersion Property (Excel)

 Copy code hover
[image]

Application.CalculationVersion Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number whose rightmost four digits are the minor calculation engine version number, and whose other digits (on the left) are the major version of Microsoft Excel. Read-only Long.

Syntax

expression .CalculationVersion

expression A variable that represents an Application object.

Remarks

If the workbook was saved in an earlier version of Excel and if the workbook hasn't been fully recalculated, then this property returns 0.

Example

This example compares the version of Microsoft Excel with the version of Excel that the workbook was last calculated in. If the two version numbers are different, the example sets the blnFullCalc variable to True.

VBA Copy code Copy code
If Application.CalculationVersion <> _
 Workbooks(1).CalculationVersion Then
 blnFullCalc = True
Else
 blnFullCalc = False
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Caller Property (Excel)

 Copy code hover
[image]

Application.Caller Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns information about how Visual Basic was called (for more information, see the Remarks section).

Syntax

expression .Caller(Index)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | An index to the array. This argument is used only when the property returns an array (for more information, see the Remarks section).

Remarks

This property returns information about how Visual Basic was called, as shown in the following table.

Caller | Return value
A custom function entered in a single cell | A Range object specifying that cell
A custom function that is part of an array formula in a range of cells | A Range object specifying that range of cells
An Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro | The name of the document as text
A macro set by either the OnDoubleClick or OnEntry property | The name of the chart object identifier or cell reference (if applicable) to which the macro applies
The Macro dialog box (Tools menu), or any caller not described above | The #REF! error value

Example

This example displays information about how Visual Basic was called.

VBA Copy code Copy code
Select Case TypeName(Application.Caller)
 Case "Range"
 v = Application.Caller.Address
 Case "String"
 v = Application.Caller
 Case "Error"
 v = "Error"
 Case Else
 v = "unknown"
End Select
MsgBox "caller = " & v

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CanPlaySounds Property (Excel)

 Copy code hover
[image]

Application.CanPlaySounds Property (Excel)
See also Send feedback

Published: July 16, 2012

This property should not be used. Sound notes have been removed from Microsoft Excel.

Syntax

expression .CanPlaySounds

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CanRecordSounds Property (Excel)

 Copy code hover
[image]

Application.CanRecordSounds Property (Excel)
See also Send feedback

Published: July 16, 2012

This property should not be used. Sound notes have been removed from Microsoft Excel.

Syntax

expression .CanRecordSounds

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Caption Property (Excel)

 Copy code hover
[image]

Application.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name that appears in the title bar of the main Microsoft Excel window.

Syntax

expression .Caption

expression A variable that represents an Application object.

Remarks

If you don't set a name, or if you set the name to Empty, this property returns "Microsoft Excel".

Example

This example sets the name that appears in the title bar of the main Microsoft Excel window to be a custom name.

VBA Copy code Copy code
Application.Caption = "Blue Sky Airlines Reservation System"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CellDragAndDrop Property (Excel)

 Copy code hover
[image]

Application.CellDragAndDrop Property (Excel)
See also Send feedback

Published: July 16, 2012

True if dragging and dropping cells is enabled. Read/write Boolean.

Syntax

expression .CellDragAndDrop

expression A variable that represents an Application object.

Example

This example enables dragging and dropping cells.

VBA Copy code Copy code
Application.CellDragAndDrop = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Cells Property (Excel)

 Copy code hover
[image]

Application.Cells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells on the active worksheet. If the active document is not a worksheet, this property fails.

Syntax

expression .Cells

expression A variable that represents an Application object.

Remarks

Because the Item property is the default property for the Range object, you can specify the row and column index immediately after the Cells keyword. For more information, see the Item property and the examples for this topic.

Using this property without an object qualifier returns a Range object that represents all the cells on the active worksheet.

Example

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

This example looks at data in each row and inserts a blank row each time the value in column A changes.

VBA Copy code Copy code
Sub ChangeInsertRows()
    Application.ScreenUpdating = False
    Dim xRow As Long

    For xRow = Application.Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1
        If Application.Cells(xRow, 1).Value <> Application.Cells(xRow - 1, 1).Value Then Rows(xRow).Resize(1).Insert
    Next xRow

    Application.ScreenUpdating = True
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ChartDataPointTrack Property (Excel)

 Copy code hover
[image]

Application.ChartDataPointTrack Property (Excel)
See also Send feedback

Published: July 16, 2012

True will cause all charts in newly created documents to use the cell reference tracking behavior.Boolean

Version information

Version Added: Excel 2013

Syntax

expression .ChartDataPointTrack

expression A variable that represents a Application object.

Notes

Data labels will now track the actual data point to which they are attached (as opposed to the legacy behavior of tracking the index of the data point), allowing the label-to-point relationship to persist across events such as filter and sort.

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Charts Property (Excel)

 Copy code hover
[image]

Application.Charts Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the chart sheets in the active workbook.

Syntax

expression .Charts

expression A variable that represents an Application object.

Example

This example sets the text for the title of Chart1.

VBA Copy code Copy code
With Charts("Chart1")
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With

This example hides Chart1, Chart3, and Chart5.

VBA Copy code Copy code
Charts(Array("Chart1", "Chart3", "Chart5")).Visible = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ClipboardFormats Property (Excel)

 Copy code hover
[image]

Application.ClipboardFormats Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the formats that are currently on the Clipboard, as an array of numeric values. To determine whether a particular format is on the Clipboard, compare each element in the array with the appropriate constant listed in the Remarks section. Read-only Variant.

Syntax

expression .ClipboardFormats(Index)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The array element to be returned. If this argument is omitted, the property returns the entire array of formats that are currently on the Clipboard. For more information, see the Remarks section.

Remarks

This property returns an array of numeric values. To determine whether a particular format is on the Clipboard compare each element of the array with one of the XlClipboardFormat constants.

Example

This example displays a message box if the Clipboard contains a rich-text format (RTF) object. You can create an RTF object by copying text from a Word document.

VBA Copy code Copy code
aFmts = Application.ClipboardFormats
For Each fmt In aFmts
 If fmt = xlClipboardFormatRTF Then
 MsgBox "Clipboard contains rich text"
 End If
Next

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ClusterConnector Property (Excel)

 Copy code hover
[image]

Application.ClusterConnector Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the High Performance Computing (HPC) Cluster Connector that is used to run user-defined functions in XLL add-ins. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ClusterConnector

expression A variable that represents an Application object.

Return Value

String

Remarks

The setting of the ClusterConnector property corresponds to the Cluster type drop-down box under Formulas in the Advanced category of the Excel Options dialog box.

Note Note

To specify the ClusterConnector property you must install a High Performance Computing (HPC) Cluster Connector. A Cluster Connector enables you to run cluster-safe XLL functions remotely on an HPC cluster for increased performance.

Before you can specify the ClusterConnector property, you must use the UseClusterConnector property to allow Excel to run user-defined functions in XLL add-ins.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Columns Property (Excel)

 Copy code hover
[image]

Application.Columns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.

Syntax

expression .Columns

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Columns.

When applied to a Range object that's a multiple-area selection, this property returns columns from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Columns.Count returns 2, not 4. To use this property on a range that may contain a multiple-area selection, test Areas.Count to determine whether the range contains more than one area. If it does, loop over each area in the range.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.COMAddIns Property (Excel)

 Copy code hover
[image]

Application.COMAddIns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the COMAddIns collection for Microsoft Excel, which represents the currently installed COM add-ins. Read-only.

Syntax

expression .COMAddIns

expression A variable that represents an Application object.

Example

This example displays the number of COM add-ins that are currently installed.

VBA Copy code Copy code
Set objAI = Application.COMAddIns
MsgBox "Number of COM add-ins available:" & _
    objAI.Count

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CommandBars Property (Excel)

 Copy code hover
[image]

Application.CommandBars Property (Excel)
See also Send feedback

Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.

Syntax

expression .CommandBars

expression An expression that returns a Application object.

Remarks

Used with the Application object, this property returns the set of built-in and custom command bars available to the application.

When a workbook is embedded in another application and activated by the user by double-clicking the workbook, using this property with a Workbook object returns the set of Microsoft Excel command bars available within the other application. At all other times, using this property with a Workbook object returns Nothing.

There is no programmatic way to return the set of command bars attached to a workbook.

Example

This example deletes all custom command bars that aren't visible.

VBA Copy code Copy code
For Each bar In Application.CommandBars
    If Not bar.BuiltIn And Not bar.Visible Then bar.Delete
Next

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CommandUnderlines Property (Excel)

 Copy code hover
[image]

Application.CommandUnderlines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the command underlines in Microsoft Excel for the Macintosh. Can be one of the constants of XlCommandUnderlines. Read/write Long.

Syntax

expression .CommandUnderlines

expression A variable that represents an Application object.

Remarks

In Microsoft Excel for Windows, reading this property always returns xlCommandUnderlinesOn, and setting this property to anything other than xlCommandUnderlinesOn is an error.

Example

This example turns off command underlines in Microsoft Excel for the Macintosh.

VBA Copy code Copy code
Application.CommandUnderlines = xlCommandUnderlinesOff

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ConstrainNumeric Property (Excel)

 Copy code hover
[image]

Application.ConstrainNumeric Property (Excel)
See also Send feedback

Published: July 16, 2012

True if handwriting recognition is limited to numbers and punctuation only. Read/write Boolean.

Syntax

expression .ConstrainNumeric

expression A variable that represents an Application object.

Remarks

This property is available only if you're using Microsoft Windows for Pen Computing. If you try to set this property under any other operating system, an error occurs.

Example

This example limits handwriting recognition to numbers and punctuation only if Microsoft Windows for Pen Computing is running.

VBA Copy code Copy code
If Application.WindowsForPens Then
 Application.ConstrainNumeric = True
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ControlCharacters Property (Excel)

 Copy code hover
[image]

Application.ControlCharacters Property (Excel)
See also Send feedback

True if Microsoft Excel displays control characters for right-to-left languages. Read/write Boolean.

Syntax

expression .ControlCharacters

expression A variable that represents an Application object.

Remarks

This property can be set only when right to left language support has been installed and selected.

Example

This example sets Microsoft Excel to interpret control characters.

VBA Copy code Copy code
Application.ControlCharacters = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CopyObjectsWithCells Property (Excel)

 Copy code hover
[image]

Application.CopyObjectsWithCells Property (Excel)
See also Send feedback

Published: July 16, 2012

True if objects are cut, copied, extracted, and sorted with cells. Read/write Boolean.

Syntax

expression .CopyObjectsWithCells

expression A variable that represents an Application object.

Example

This example sets Microsoft Excel to cut, copy, extract, and sort objects with cells.

VBA Copy code Copy code
Application.CopyObjectsWithCells = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Creator Property (Excel)

 Copy code hover
[image]

Application.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns a Application object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Cursor Property (Excel)

 Copy code hover
[image]

Application.Cursor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the appearance of the mouse pointer in Microsoft Excel. Read/write XlMousePointer.

Syntax

expression .Cursor

expression A variable that represents an Application object.

Remarks

XlMousePointer can be one of these XlMousePointer constants.

xlDefault. The default pointer.

xlIBeam. The I-beam pointer.

xlNorthwestArrow. The northwest-arrow pointer.

xlWait. The hourglass pointer.

The Cursor property isn't reset automatically when the macro stops running. You should reset the pointer to xlDefault before your macro stops running.

Example

This example changes the mouse pointer to an I-beam, pauses, and then changes it to the default pointer.

VBA Copy code Copy code
Sub ChangeCursor()

 Application.Cursor = xlIBeam
 For x = 1 To 1000
 For y = 1 to 1000
 Next y
 Next x
 Application.Cursor = xlDefault

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CursorMovement Property (Excel)

 Copy code hover
[image]

Application.CursorMovement Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether a visual cursor or a logical cursor is used. Can be one of the following constants: xlVisualCursor or xlLogicalCursor. Read/write Long.

Syntax

expression .CursorMovement

expression A variable that represents an Application object.

Remarks

These constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets Microsoft Excel to use the visual cursor.

VBA Copy code Copy code
Application.CursorMovement = xlVisualCursor

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CustomListCount Property (Excel)

 Copy code hover
[image]

Application.CustomListCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of defined custom lists (including built-in lists). Read-only Long.

Syntax

expression .CustomListCount

expression A variable that represents an Application object.

Example

This example displays the number of custom lists that are currently defined.

VBA Copy code Copy code
MsgBox "There are currently " & Application.CustomListCount & _
 " defined custom lists."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CutCopyMode Property (Excel)

 Copy code hover
[image]

Application.CutCopyMode Property (Excel)
See also Send feedback

Returns or sets the status of Cut or Copy mode. Can be True, False, or an XLCutCopyMode constant, as shown in the following tables. Read/write Long.

Syntax

expression .CutCopyMode

expression A variable that represents an Application object.

Remarks

Return value | Description
False | Not in Cut or Copy mode.
xlCopy | In Copy mode.
xlCut | In Cut mode.
Set value | Description
False | Cancels Cut or Copy mode and removes the moving border.
True | Cancels Cut or Copy mode and removes the moving border.

Example

This example uses a message box to display the status of Cut or Copy mode.

VBA Copy code Copy code
Select Case Application.CutCopyMode
 Case Is = False
 MsgBox "Not in Cut or Copy mode"
 Case Is = xlCopy
 MsgBox "In Copy mode"
 Case Is = xlCut
 MsgBox "In Cut mode"
End Select

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DataEntryMode Property (Excel)

 Copy code hover
[image]

Application.DataEntryMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets Data Entry mode, as shown in the following table. When in Data Entry mode, you can enter data only in the unlocked cells in the currently selected range. Read/write Long.

Syntax

expression .DataEntryMode

expression A variable that represents an Application object.

Remarks

Value | Meaning
xlOn | Data Entry mode is turned on.
xlOff | Data Entry mode is turned off.
xlStrict | Data Entry mode is turned on, and pressing ESC won't turn it off.

Example

This example turns off Data Entry mode if it's on.

VBA Copy code Copy code
If (Application.DataEntryMode = xlOn) Or _
 (Application.DataEntryMode = xlStrict) Then
 Application.DataEntryMode = xlOff
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEAppReturnCode Property (Excel)

 Copy code hover
[image]

Application.DDEAppReturnCode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the application-specific DDE return code that was contained in the last DDE acknowledge message received by Microsoft Excel. Read-only Long.

Syntax

expression .DDEAppReturnCode

expression A variable that represents an Application object.

Example

This example sets the variable appErrorCode to the DDE return code.

VBA Copy code Copy code
appErrorCode = Application.DDEAppReturnCode

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DecimalSeparator Property (Excel)

 Copy code hover
[image]

Application.DecimalSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns the character used for the decimal separator as a String. Read/write.

Syntax

expression .DecimalSeparator

expression A variable that represents an Application object.

Example

This example places "1,234,567.89" in cell A1 then changes the system separators to dashes for the decimals and thousands separators.

VBA Copy code Copy code
Sub ChangeSystemSeparators()

 Range("A1").Formula = "1,234,567.89"
 MsgBox "The system separators will now change."

 ' Define separators and apply.
 Application.DecimalSeparator = "-"
 Application.ThousandsSeparator = "-"
 Application.UseSystemSeparators = False

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultFilePath Property (Excel)

 Copy code hover
[image]

Application.DefaultFilePath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the default path that Microsoft Excel uses when it opens files. Read/write String.

Syntax

expression .DefaultFilePath

expression A variable that represents an Application object.

Example

This example displays the current default file path.

VBA Copy code Copy code
MsgBox "The current default file path is " & _
 Application.DefaultFilePath

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultSaveFormat Property (Excel)

 Copy code hover
[image]

Application.DefaultSaveFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the default format for saving files. For a list of valid constants, see the FileFormat property. Read/write Long.

Syntax

expression .DefaultSaveFormat

expression A variable that represents an Application object.

Example

This example sets the default format for saving files.

VBA Copy code Copy code
Application.DefaultSaveFormat = xlExcel4Workbook

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultSheetDirection Property (Excel)

 Copy code hover
[image]

Application.DefaultSheetDirection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the default direction in which Microsoft Excel displays new windows and worksheets. Can be one of the following constants: xlRTL (right to left) or xlLTR (left to right). Read/write Long.

Syntax

expression .DefaultSheetDirection

expression A variable that represents an Application object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets right to left as the default direction.

VBA Copy code Copy code
Application.DefaultSheetDirection = xlRTL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultWebOptions Property (Excel)

 Copy code hover
[image]

Application.DefaultWebOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Excel whenever you save a document as a Web page or open a Web page. Read-only.

Syntax

expression .DefaultWebOptions

expression A variable that represents an Application object.

Example

This example checks to see whether the default setting for document encoding is Western, and then it sets the string strDocEncoding accordingly.

VBA Copy code Copy code
If Application.DefaultWebOptions.Encoding = msoEncodingWestern Then
 strDocEncoding = "Western"
Else
 strDocEncoding = "Other"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DeferAsyncQueries Property (Excel)

 Copy code hover
[image]

Application.DeferAsyncQueries Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets whether asychronous queries to OLAP data sources are executed when a worksheet is calculated by VBA code. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DeferAsyncQueries

expression A variable that represents an Application object.

Remarks

Setting the DeferAsyncQueries property to True prevents any asynchronous queries form executing until the CalculateUntilAsyncQueriesDone method is called.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Dialogs Property (Excel)

 Copy code hover
[image]

Application.Dialogs Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Dialogs collection that represents all built-in dialog boxes. Read-only.

Syntax

expression .Dialogs

expression A variable that represents an Application object.

Example

This example displays the Open dialog box (File menu).

VBA Copy code Copy code
Application.Dialogs(xlDialogOpen).Show

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example opens an e-mail message in Microsoft Outlook with the current workbook attached.

VBA Copy code Copy code
Sub SendIt()
    Application.Dialogs(xlDialogSendMail).Show arg1:="ask@mrexcel.com", arg2:="This goes in the subject line"
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayAlerts Property (Excel)

 Copy code hover
[image]

Application.DisplayAlerts Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.

Syntax

expression .DisplayAlerts

expression A variable that represents an Application object.

Remarks

The default value is True. Set this property to False to suppress prompts and alert messages while a macro is running; when a message requires a response, Microsoft Excel chooses the default response.

If you set this property to False, Microsoft Excel sets this property to True when the code is finished, unless you are running cross-process code.

Note Note

When using the SaveAs method for workbooks to overwrite an existing file, the Confirm Save As dialog box has a default of No, while the Yes response is selected by Excel when the DisplayAlerts property is set to False. The Yes response overwrites the existing file.
When using the SaveAs method for workbooks to save a workbook that contains a Visual Basic for Applications (VBA) project in the Excel 5.0/95 file format, the Microsoft Excel dialog box has a default of Yes, while the Cancel response is selected by Excel when the DisplayAlerts property is set to False. You cannot save a workbook that contains a VBA project using the Excel 5.0/95 file format.

Example

This example closes the Workbook Book1.xls and does not prompt the user to save changes. Changes to Book1.xls are not saved.

VBA Copy code Copy code
Application.DisplayAlerts = False
Workbooks("BOOK1.XLS").Close
Application.DisplayAlerts = True

This example suppresses the message that otherwise appears when you initiate a DDE channel to an application that is not running.

VBA Copy code Copy code
Application.DisplayAlerts = False
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\FORMLETR.DOC")
Application.DisplayAlerts = True
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayClipboardWindow Property (Excel)

 Copy code hover
[image]

Application.DisplayClipboardWindow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the Microsoft Office Clipboard can be displayed. Read/write Boolean.

Syntax

expression .DisplayClipboardWindow

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel determines if the Office Clipboard can be displayed and notifies the user.

VBA Copy code Copy code
Sub SeeClipboard()

 ' Determine if Office Clipboard can be displayed.
 If Application.DisplayClipboardWindow = True Then
 MsgBox "Office Clipboard can be displayed."
 Else
 MsgBox "Office Clipboard cannot be displayed."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayCommentIndicator Property (Excel)

 Copy code hover
[image]

Application.DisplayCommentIndicator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way cells display comments and indicators. Can be one of the XlCommentDisplayMode constants.

Syntax

expression .DisplayCommentIndicator

expression A variable that represents an Application object.

Example

This example hides cell tips but retains comment indicators.

VBA Copy code Copy code
Application.DisplayCommentIndicator = xlCommentIndicatorOnly

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayDocumentActionTaskPane Property (Excel)

 Copy code hover
[image]

Application.DisplayDocumentActionTaskPane Property (Excel)
See also Send feedback

Published: July 16, 2012

Set to True to display the Document Actions task pane; set to False to hide the Document Actions task pane. Read/write Boolean.

Syntax

expression .DisplayDocumentActionTaskPane

expression A variable that represents an Application object.

Remarks

Setting this property to True will result in a run-time error if the active workbook is not a smart document.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayDocumentInformationPanel Property (Excel)

 Copy code hover
[image]

Application.DisplayDocumentInformationPanel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayDocumentInformationPanel

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayExcel4Menus Property (Excel)

 Copy code hover
[image]

Application.DisplayExcel4Menus Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel displays version 4.0 menu bars. Read/write Boolean.

Syntax

expression .DisplayExcel4Menus

expression A variable that represents an Application object.

Example

This example switches the display to Microsoft Excel version 4.0 menus.

VBA Copy code Copy code
Application.DisplayExcel4Menus = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayFormulaAutoComplete Property (Excel)

 Copy code hover
[image]

Application.DisplayFormulaAutoComplete Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets whether to show a list of relevant functions and defined names when building cell formulas. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayFormulaAutoComplete

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayFormulaBar Property (Excel)

 Copy code hover
[image]

Application.DisplayFormulaBar Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the formula bar is displayed. Read/write Boolean.

Syntax

expression .DisplayFormulaBar

expression A variable that represents an Application object.

Example

This example hides the formula bar.

VBA Copy code Copy code
Application.DisplayFormulaBar = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayFullScreen Property (Excel)

 Copy code hover
[image]

Application.DisplayFullScreen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel is in full-screen mode. Read/write Boolean.

Syntax

expression .DisplayFullScreen

expression A variable that represents an Application object.

Remarks

Full-screen mode maximizes the application window so that it fills the entire screen and hides the application title bar. Toolbars, the status bar, and the formula bar maintain separate display settings for full-screen mode and normal mode.

Example

This example sets Microsoft Excel to be displayed in full-screen mode.

VBA Copy code Copy code
Application.DisplayFullScreen = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayFunctionToolTips Property (Excel)

 Copy code hover
[image]

Application.DisplayFunctionToolTips Property (Excel)
See also Send feedback

True if function ToolTips can be displayed. Read/write Boolean.

Syntax

expression .DisplayFunctionToolTips

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel notifies the user the status of displaying function Tool Tips.

VBA Copy code Copy code
Sub CheckToolTip()

 ' Notify the user of the ability to display function ToolTips.
 If Application.DisplayFunctionToolTips = True Then
 MsgBox "The ability to display function ToolTips is on."
 Else
 MsgBox "The ability to display function ToolTips is off."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayInsertOptions Property (Excel)

 Copy code hover
[image]

Application.DisplayInsertOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Insert Options button should be displayed. Read/write Boolean.

Syntax

expression .DisplayInsertOptions

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel notifies the user the status of displaying the Insert Options button.

VBA Copy code Copy code
Sub SettingToolTip()

 ' Notify the user of the ToolTip status.
 If Application.DisplayInsertOptions = True Then
 MsgBox "The ability to display the Insert Options button is on."
 Else
 MsgBox "The ability to display the Insert Options button is off."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayNoteIndicator Property (Excel)

 Copy code hover
[image]

Application.DisplayNoteIndicator Property (Excel)
See also Send feedback

Published: July 16, 2012

True if cells containing notes display cell tips and contain note indicators (small dots in their upper-right corners). Read/write Boolean.

Syntax

expression .DisplayNoteIndicator

expression A variable that represents an Application object.

Example

This example hides note indicators.

VBA Copy code Copy code
Application.DisplayNoteIndicator = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayPasteOptions Property (Excel)

 Copy code hover
[image]

Application.DisplayPasteOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Paste Options button can be displayed. Read/write Boolean.

Syntax

expression .DisplayPasteOptions

expression A variable that represents an Application object.

Remarks

This is a Microsoft Office-wide setting. This setting affects all other Microsoft Office applications. Setting the DisplayPasteOptions property to True turns off the Auto Fill Options button in Microsoft Excel. The Auto Fill Options button is only in Excel, but the Paste Options button is in all the other Microsoft Office applications.

Example

In this example, Microsoft Excel notifies the user the status of displaying the Paste Options button.

VBA Copy code Copy code
Sub CheckDisplayFeature()

 ' Check if the options button can be displayed.
 If Application.DisplayPasteOptions = True Then
 MsgBox "The ability to display the Paste Options button is on."
 Else
 MsgBox "The ability to display the Paste Options button is off."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayRecentFiles Property (Excel)

 Copy code hover
[image]

Application.DisplayRecentFiles Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the list of recently used files is displayed in the UI. Read/write Boolean.

Syntax

expression .DisplayRecentFiles

expression A variable that represents an Application object.

Example

This example turns off the list of recently used files.

VBA Copy code Copy code
Application.DisplayRecentFiles = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayScrollBars Property (Excel)

 Copy code hover
[image]

Application.DisplayScrollBars Property (Excel)
See also Send feedback

Published: July 16, 2012

True if scroll bars are visible for all workbooks. Read/write Boolean.

Syntax

expression .DisplayScrollBars

expression A variable that represents an Application object.

Example

This example turns off scroll bars for all workbooks.

VBA Copy code Copy code
Application.DisplayScrollBars = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayStatusBar Property (Excel)

 Copy code hover
[image]

Application.DisplayStatusBar Property (Excel)
See also Send feedback

True if the status bar is displayed. Read/write Boolean.

Syntax

expression .DisplayStatusBar

expression A variable that represents an Application object.

Example

This example saves the current state of the DisplayStatusBar property and then sets the property to True so that the status bar is visible.

VBA Copy code Copy code
saveStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EditDirectlyInCell Property (Excel)

 Copy code hover
[image]

Application.EditDirectlyInCell Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel allows editing in cells. Read/write Boolean.

Syntax

expression .EditDirectlyInCell

expression A variable that represents an Application object.

Example

This example enables editing in cells.

VBA Copy code Copy code
Application.EditDirectlyInCell = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableAnimations Property (Excel)

 Copy code hover
[image]

Application.EnableAnimations Property (Excel)
See also Send feedback

Published: July 16, 2012

This object, member, or enumeration is deprecated and is not intended to be used in your code.

Syntax

expression .EnableAnimations

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableAutoComplete Property (Excel)

 Copy code hover
[image]

Application.EnableAutoComplete Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the AutoComplete feature is enabled. Read/write Boolean.

Syntax

expression .EnableAutoComplete

expression A variable that represents an Application object.

Example

This example enables the AutoComplete feature.

VBA Copy code Copy code
Application.EnableAutoComplete = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableCancelKey Property (Excel)

 Copy code hover
[image]

Application.EnableCancelKey Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls how Microsoft Excel handles CTRL+BREAK (or ESC or COMMAND+PERIOD) user interruptions to the running procedure. Read/write XlEnableCancelKey.

Syntax

expression .EnableCancelKey

expression A variable that represents an Application object.

Remarks

XlEnableCancelKey can be one of these XlEnableCancelKey constants.

xlDisabled. Cancel key trapping is completely disabled.

xlErrorHandler. The interrupt is sent to the running procedure as an error, trappable by an error handler set up with an On Error GoTo statement. The trappable error code is 18.

xlInterrupt. The current procedure is interrupted, and the user can debug or end the procedure.

Use this property very carefully. If you use xlDisabled, there's no way to interrupt a runaway loop or other non - self-terminating code. Likewise, if you use xlErrorHandler but your error handler always returns using the Resume statement, there's no way to stop runaway code.

The EnableCancelKey property is always reset to xlInterrupt whenever Microsoft Excel returns to the idle state and there's no code running. To trap or disable cancellation in your procedure, you must explicitly change the EnableCancelKey property every time the procedure is called.

Example

This example shows how you can use the EnableCancelKey property to set up a custom cancellation handler.

VBA Copy code Copy code
On Error GoTo handleCancel
Application.EnableCancelKey = xlErrorHandler
MsgBox "This may take a long time: press ESC to cancel"
For x = 1 To 1000000 ' Do something 1,000,000 times (long!)
 ' do something here
Next x

handleCancel:
If Err = 18 Then
 MsgBox "You cancelled"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableCheckFileExtensions Property (Excel)

 Copy code hover
[image]

Application.EnableCheckFileExtensions Property (Excel)
See also Send feedback

True to enable the Tell me if Microsoft Excel isn't the default program for viewing and editing spreadsheets dialog box. Read/write Boolean.

Syntax

expression .EnableCheckFileExtensions

expression A variable that represents an Application object.

Example

This example disables the dialog box.

VBA Copy code Copy code
Application.EnableCheckFileExtensions = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableEvents Property (Excel)

 Copy code hover
[image]

Application.EnableEvents Property (Excel)
See also Send feedback

True if events are enabled for the specified object. Read/write Boolean.

Syntax

expression .EnableEvents

expression A variable that represents an Application object.

Example

This example disables events before a file is saved so that the BeforeSave event doesn't occur.

VBA Copy code Copy code
Application.EnableEvents = False
ActiveWorkbook.Save
Application.EnableEvents = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableLargeOperationAlert Property (Excel)

 Copy code hover
[image]

Application.EnableLargeOperationAlert Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether to display an alert message when a user attempts to perform an operation that affects a larger number of cells than is specified in the Office center UI. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableLargeOperationAlert

expression A variable that represents an Application object.

Remarks

The default value of this property is True.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableLivePreview Property (Excel)

 Copy code hover
[image]

Application.EnableLivePreview Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. Setting this property to True shows a preview of your workbook before applying the command. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableLivePreview

expression A variable that represents an Application object.

Remarks

This property corresponds to the Enable Live Preview check box in the Excel Options dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableMacroAnimations Property (Excel)

 Copy code hover
[image]

Application.EnableMacroAnimations Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls whether macro animations are enabled. True if user interface animations or chart animations are enabled. Is set to False (no animation) by default. If it is set to True during the running of a macro, it will enable animation and then will reset to False after the macro runs. Read/write Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .EnableMacroAnimations

expression A variable that represents an Application object.

Example

This example disables animation.

VBA Copy code Copy code
Application.EnableMacroAnimations = False

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableSound Property (Excel)

 Copy code hover
[image]

Application.EnableSound Property (Excel)
See also Send feedback

Published: July 16, 2012

True if sound is enabled for Microsoft Office. Read/write Boolean.

Syntax

expression .EnableSound

expression A variable that represents an Application object.

Example

This example disables sound feedback.

VBA Copy code Copy code
Application.EnableSound = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ErrorCheckingOptions Property (Excel)

 Copy code hover
[image]

Application.ErrorCheckingOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an ErrorCheckingOptions object, which represents the error checking options for an application.

Syntax

expression .ErrorCheckingOptions

expression A variable that represents an Application object.

Example

In this example, the TextDate property is used in conjunction with the ErrorCheckingOptions property. When the user selects a cell containing a two-digit year in the date, the AutoCorrect Options button appears.

VBA Copy code Copy code
Sub CheckTextDate()

 ' Enable Microsoft Excel to identify dates written as text.
 Application.ErrorCheckingOptions.TextDate = True

 Range("A1").Formula = "'April 23, 00"

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Excel4IntlMacroSheets Property (Excel)

 Copy code hover
[image]

Application.Excel4IntlMacroSheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.

Syntax

expression .Excel4IntlMacroSheets

expression A variable that represents an Application object.

Remarks

Using this property with the Application object or without an object qualifier is equivalent to using ActiveWorkbook.Excel4IntlMacroSheets.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Excel4MacroSheets Property (Excel)

 Copy code hover
[image]

Application.Excel4MacroSheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.

Syntax

expression .Excel4MacroSheets

expression A variable that represents an Application object.

Remarks

Using this property with the Application object or without an object qualifier is equivalent to using ActiveWorkbook.Excel4MacroSheets.

Example

This example displays the number of Microsoft Excel 4.0 macro sheets in the active workbook.

VBA Copy code Copy code
MsgBox "There are " & ActiveWorkbook.Excel4MacroSheets.Count & _
 " Microsoft Excel 4.0 macro sheets in this workbook."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ExtendList Property (Excel)

 Copy code hover
[image]

Application.ExtendList Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel automatically extends formatting and formulas to new data that is added to a list. Read/write Boolean.

Syntax

expression .ExtendList

expression A variable that represents an Application object.

Remarks

To be extended, formats and formulas must appear in at least three of the five list rows or columns preceding the new row or column, and you must add the data to the bottom or to the right-hand side of the list.

Example

This example sets Excel to not apply formatting and formulas to data subsequently added to an existing list.

VBA Copy code Copy code
Application.ExtendList = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FeatureInstall Property (Excel)

 Copy code hover
[image]

Application.FeatureInstall Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value (constant) that specifies how Microsoft Excel handles calls to methods and properties that require features that aren't yet installed. Can be one of the MsoFeatureInstall constants listed in the following table. Read/write MsoFeatureInstall.

Syntax

expression .FeatureInstall

expression A variable that represents an Application object.

Remarks

MsoFeatureInstall can be one of these MsoFeatureInstall constants.

msoFeatureInstallNone. Generates a generic Automation error at run time when uninstalled features are called. This is the default constant.

msoFeatureInstallOnDemand. Prompts the user to install new features.

msoFeatureInstallOnDemandWithUI. Displays a progress meter during installation; doesn't prompt the user to install new features.

You can use the msoFeatureInstallOnDemandWithUI constant to prevent users from thinking that the application isn't responding while a feature is being installed. Use the msoFeatureInstallNone constant if you want the developer to be the only one who can install features.

If you have the DisplayAlerts property set to False, users won't be prompted to install new features even if the FeatureInstall property is set to msoFeatureInstallOnDemand. If the DisplayAlerts property is set to True, an installation progress meter will appear if the FeatureInstall property is set to msoFeatureInstallOnDemand.

Example

This example activates a new instance of Microsoft Word and checks the value of the FeatureInstall property. Be sure to set a reference to the Microsoft Word object library. If the FeatureInstall property is set to msoFeatureInstallNone, the code displays a message box that asks the user whether they want to change the property setting. If the user responds Yes, the property is set to msoFeatureInstallOnDemand.

VBA Copy code Copy code
Dim WordApp As New Word.Application, Reply As Integer
Application.ActivateMicrosoftApp xlMicrosoftWord With WordApp
    If .FeatureInstall = msoFeatureInstallNone Then
        Reply = MsgBox("Uninstalled features for this " _
            & "application " & vbCrLf _
            & "may cause a run-time error when called." & vbCrLf _
            & vbCrLf _
            & "Would you like to change this setting" & vbCrLf _
            & "to automatically install missing features?" _
            , 52, "Feature Install Setting")
        If Reply = 6 Then
            .FeatureInstall = msoFeatureInstallOnDemand
        End If
    End If
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileConverters Property (Excel)

 Copy code hover
[image]

Application.FileConverters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns information about installed file converters. Returns null if there are no converters installed. Read-only Variant.

Syntax

expression .FileConverters(Index1, Index2)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index1 | Optional | Variant | The long name of the converter, including the file-type search string in Windows (for example, "Lotus 1-2-3 Files (*.wk*)").
Index2 | Optional | Variant | The path of the converter DLL or code resource.

Remarks

If you don't specify the index arguments, this property returns an array that containing information about all the installed file converters. Each row in the array contains information about a single file converter, as shown in the following table.

Column | Contents
1 | The long name of the converter
2 | The path of the converter DLL or code resource
3 | The file-extension search string

Example

This example displays a message if the Multiplan file converter is installed.

VBA Copy code Copy code
installedCvts = Application.FileConverters
foundMultiplan = False
If Not IsNull(installedCvts) Then
 For arrayRow = 1 To UBound(installedCvts, 1)
 If installedCvts(arrayRow, 1) Like "*Multiplan*" Then
 foundMultiplan = True
 Exit For
 End If
 Next arrayRow
End If
If foundMultiplan = True Then
 MsgBox "Multiplan converter is installed"
Else
 MsgBox "Multiplan converter is not installed"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileDialog Property (Excel)

 Copy code hover
[image]

Application.FileDialog Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FileDialog object representing an instance of the file dialog.

Syntax

expression .FileDialog(fileDialogType)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
fileDialogType | Required | MsoFileDialogType | The type of file dialog.

Remarks

MsoFileDialogType can be one of these MsoFileDialogType constants.

msoFileDialogFilePicker. Allows user to select a file.

msoFileDialogFolderPicker. Allows user to select a folder.

msoFileDialogOpen. Allows user to open a file.

msoFileDialogSaveAs. Allows user to save a file.

Example

In this example, Microsoft Excel opens the file dialog allowing the user to select one or more files. Once these files are selected, Excel displays the path for each file in a separate message.

VBA Copy code Copy code
Sub UseFileDialogOpen()

    Dim lngCount As Long

    ' Open the file dialog
    With Application.FileDialog(msoFileDialogOpen)
        .AllowMultiSelect = True
        .Show

        ' Display paths of each file selected
        For lngCount = 1 To .SelectedItems.Count
            MsgBox .SelectedItems(lngCount)
        Next lngCount

    End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileExportConverters Property (Excel)

 Copy code hover
[image]

Application.FileExportConverters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FileExportConverters collection that represents all the file converters for saving files available to Microsoft Excel. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .FileExportConverters

expression A variable that represents an Application object.

Remarks

For more information about returning a single member of a collection, see Returning an Object from a Collection.

Example

The following example displays the description for the first file converter in the FileExportConverters collection.

VBA Copy code Copy code
Dim fcTemp As FileExportConverter
Set fcTemp = FileExportConverter(1)

MsgBox fcTemp.Description

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileValidation Property (Excel)

 Copy code hover
[image]

Application.FileValidation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how Excel will validate files before opening them. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .FileValidation

expression A variable that represents an Application object.

Return Value

MsoFileValidationMode

Remarks

Files that do not pass validation will be opened in a Protected View window. If you set the FileValidation property, that setting will remain in effect for the entire session the application is open.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileValidationPivot Property (Excel)

 Copy code hover
[image]

Application.FileValidationPivot Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how Excel will validate the contents of the data caches for PivotTable reports. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .FileValidationPivot

expression A variable that represents an Application object.

Return Value

XlFileValidationPivotMode

Remarks

Files that contain data caches that do not validate will be opened in a Protected View window. If you set the FileValidationPivot property, that setting will remain in effect for the entire session the application is open.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FindFormat Property (Excel)

 Copy code hover
[image]

Application.FindFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns the search criteria for the type of cell formats to find.

Syntax

expression .FindFormat

expression A variable that represents an Application object.

Example

In this example, the search criteria is set to look for Arial, Regular, Size 10 font cells and the user is notified.

VBA Copy code Copy code
Sub UseFindFormat()

 ' Establish search criteria.
 With Application.FindFormat.Font
 .Name = "Arial"
 .FontStyle = "Regular"
 .Size = 10
 End With

 ' Notify user.
 With Application.FindFormat.Font
 MsgBox .Name & "-" & .FontStyle & "-" & .Size & _
 " font is what the search criteria is set to."
 End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FixedDecimal Property (Excel)

 Copy code hover
[image]

Application.FixedDecimal Property (Excel)
See also Send feedback

Published: July 16, 2012

All data entered after this property is set to True will be formatted with the number of fixed decimal places set by the FixedDecimalPlaces property. Read/write Boolean.

Syntax

expression .FixedDecimal

expression A variable that represents an Application object.

Example

This example sets the FixedDecimal property to True and then sets the FixedDecimalPlaces property to 4. Entering "30000" after running this example produces "3" on the worksheet, and entering "12500" produces "1.25."

VBA Copy code Copy code
Application.FixedDecimal = True
Application.FixedDecimalPlaces = 4

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FixedDecimalPlaces Property (Excel)

 Copy code hover
[image]

Application.FixedDecimalPlaces Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of fixed decimal places used when the FixedDecimal property is set to True. Read/write Long.

Syntax

expression .FixedDecimalPlaces

expression A variable that represents an Application object.

Example

This example sets the FixedDecimal property to True and then sets the FixedDecimalPlaces property to 4. Entering "30000" after running this example produces "3" on the worksheet, and entering "12500" produces "1.25."

VBA Copy code Copy code
Application.FixedDecimal = True
Application.FixedDecimalPlaces = 4

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FlashFill Property (Excel)

 Copy code hover
[image]

Application.FlashFill Property (Excel)
See also Send feedback

Published: July 16, 2012

TRUE indicates that the Excel Flash Fill feature has been enabled and active. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .FlashFill

expression A variable that represents a Application object.

Remarks

Flash Fill detects when you are modifying data that fits a pattern which can be filled down and applied to additional data in the workbook, and then automatically fills down the column with the results.

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FlashFillMode Property (Excel)

 Copy code hover
[image]

Application.FlashFillMode Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Flash Fill feature is enabled. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .FlashFillMode

expression A variable that represents a Application object.

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FormulaBarHeight Property (Excel)

 Copy code hover
[image]

Application.FormulaBarHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows the user to specify the height of the formula bar in lines. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .FormulaBarHeight

expression A variable that represents an Application object.

Remarks

If the specified value of FormulaBarHeight is greater than the viewable window space, the formula bar is resized to be equal to the window height.

Example

In the following example, the height of the formula bar is set to five lines.

Copy code Copy code
Application.FormulaBarHeight = 5

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GenerateGetPivotData Property (Excel)

 Copy code hover
[image]

Application.GenerateGetPivotData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True when Microsoft Excel can get PivotTable report data. Read/write Boolean.

Syntax

expression .GenerateGetPivotData

expression A variable that represents an Application object.

Example

In the following example, Microsoft Excel determines the status of getting PivotTable report data and notifies the user. This example assumes a PivotTable report exists on the active worksheet.

VBA Copy code Copy code
Sub PivotTableInfo()

 ' Determine the ability to get PivotTable report data and notify user.
 If Application.GenerateGetPivotData = True Then
 MsgBox "The ability to get PivotTable report data is enabled."
 Else
 Msgbox "The ability to get PivotTable report data is disabled."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GenerateTableRefs Property (Excel)

 Copy code hover
[image]

Application.GenerateTableRefs Property (Excel)
See also Send feedback

Published: July 16, 2012

The GenerateTableRefs property determines whether the traditional notation method or the new structured referencing notation method is used for referencing tables in formulas. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .GenerateTableRefs

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Height Property (Excel)

 Copy code hover
[image]

Application.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents tThe height, in points, of the main application window.

Syntax

expression .Height

expression A variable that represents an Application object.

Remarks

If the window is minimized, this property is read-only and refers to the height of the icon. If the window is maximized, this property cannot be set. Use the WindowState property to determine the window state.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.HighQualityModeForGraphics Property (Excel)

 Copy code hover
[image]

Application.HighQualityModeForGraphics Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether Excel uses high quality mode to print graphics. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .HighQualityModeForGraphics

expression A variable that represents an Application object.

Remarks

This property corresponds to the setting of the High quality mode for graphics check box in the Print section of the Advanced category of the Excel Options dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Hinstance Property (Excel)

 Copy code hover
[image]

Application.Hinstance Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a handle to the instance of Microsoft Excel 2013 represented by the Application object. Read-only Long.

Syntax

expression .Hinstance

expression A variable that represents an Application object.

Remarks

Important note Important

This property returns a correct handle only in the 32-bit version of Excel. In Excel 2013, the HinstancePtr property was introduced, which works correctly in both 32- and 64-bit versions of Excel 2013.

Example

In this example, a message box displays the Microsoft Excel instance handle to the user.

VBA Copy code Copy code
Sub CheckHinstance()

 MsgBox Application.Hinstance

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.HinstancePtr Property (Excel)

 Copy code hover
[image]

Application.HinstancePtr Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a handle to the instance of Microsoft Excel 2013 represented by the specified Application object. Read-only Variant.

Version Information

Version Added: Excel 2010

Syntax

expression .HinstancePtr

expression A variable that represents an Application object.

Remarks

This property returns a correct handle in both the 32- and 64-bit versions of Excel. It extends the functionality of the Hinstance property of the Application object, which only works correctly in the 32-bit version of Excel.

The ideal data type to use with this property is the LongPtr data type. Assigning the value returned by this property to a LongPtr variable will work as expected in both 32- and 64-bit versions of Excel. The property is defined as Variant for internal implementation reasons. However, it always returns a 32-bit value on 32-bit systems and a 64-bit value on 64-bit systems.

This property only works starting with Excel 2013, and is only required with the 64-bit version of Excel. If you must write code that will also work with earlier versions of Excel, in order to avoid compilation errors, read this property under an #if Win64 conditional compilation directive, and use the Hinstance property under the #else directive.

Note that this property works fine in both 32- and 64-bit environments starting with Excel 2010. Therefore, if your code is intended to be used only with Excel 2013 or later, either 32- or 64-bit, it can read this property without conditional compilation.

For more information about how to use VBA in 64-bit environments, see 64-Bit Visual Basic for Applications Overview.

Example

In this example, a message box displays the

Excel 2013 instance handle to the user.

VBA Copy code Copy code
Sub CheckHinstance()
    MsgBox Application.HinstancePtr
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Hwnd Property (Excel)

 Copy code hover
[image]

Application.Hwnd Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long indicating the top-level window handle of the Microsoft Excel window. Read-only.

Syntax

expression .Hwnd

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel notifies the user of the top-level window handle of the Excel window.

VBA Copy code Copy code
Sub CheckHwnd()

 MsgBox "The top-level window handle is: " & _
 Application.Hwnd

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.IgnoreRemoteRequests Property (Excel)

 Copy code hover
[image]

Application.IgnoreRemoteRequests Property (Excel)
See also Send feedback

Published: July 16, 2012

True if remote DDE requests are ignored. Read/write Boolean.

Syntax

expression .IgnoreRemoteRequests

expression A variable that represents an Application object.

Example

This example sets the IgnoreRemoteRequests property to True so that remote DDE requests are ignored.

VBA Copy code Copy code
Application.IgnoreRemoteRequests = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Interactive Property (Excel)

 Copy code hover
[image]

Application.Interactive Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel is in interactive mode; this property is usually True. If you set the this property to False, Microsoft Excel will block all input from the keyboard and mouse (except input to dialog boxes that are displayed by your code). Read/write Boolean.

Syntax

expression .Interactive

expression A variable that represents an Application object.

Remarks

Blocking user input will prevent the user from interfering with the macro as it moves or activates Microsoft Excel objects.

This property is useful if you're using DDE or OLE Automation to communicate with Microsoft Excel from another application.

If you set this property to False, don't forget to set it back to True. Microsoft Excel won't automatically set this property back to True when your macro stops running.

Example

This example sets the Interactive property to False while it's using DDE in Windows and then sets this property back to True when it's finished. This prevents the user from interfering with the macro.

VBA Copy code Copy code
Application.Interactive = False
Application.DisplayAlerts = False
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True
Application.Interactive = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.International Property (Excel)

 Copy code hover
[image]

Application.International Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns information about the current country/region and international settings. Read-only Variant.

Syntax

expression .International(Index)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The setting to be returned. Can be one of the XlApplicationInternational constants listed in the following tables.

Remarks

Brackets and Braces

Index | Type | Meaning
xlLeftBrace | String | Character used instead of the left brace ({) in array literals.
xlLeftBracket | String | Character used instead of the left bracket ([) in R1C1-style relative references.
xlLowerCaseColumnLetter | String | Lowercase column letter.
xlLowerCaseRowLetter | String | Lowercase row letter.
xlRightBrace | String | Character used instead of the right brace (}) in array literals.
xlRightBracket | String | Character used instead of the right bracket (]) in R1C1-style references.
xlUpperCaseColumnLetter | String | Uppercase column letter.
xlUpperCaseRowLetter | String | Uppercase row letter (for R1C1-style references).

Country/Region Settings

Index | Type | Meaning
xlCountryCode | Long | Country/Region version of Microsoft Excel.
xlCountrySetting | Long | Current country/region setting in the Windows Control Panel.
xlGeneralFormatName | String | Name of the General number format.

Currency

Index | Type | Meaning
xlCurrencyBefore | Boolean | True if the currency symbol precedes the currency values; False if it follows them.
xlCurrencyCode | String | Currency symbol.
xlCurrencyDigits | Long | Number of decimal digits to be used in currency formats.
xlCurrencyLeadingZeros | Boolean | True if leading zeros are displayed for zero currency values.
xlCurrencyMinusSign | Boolean | True if you're using a minus sign for negative numbers; False if you're using parentheses.
xlCurrencyNegative | Long | Currency format for negative currency values: 0 = (symbolx) or (xsymbol) 1 = -symbolx or -xsymbol 2 = symbol-x or x-symbol 3 = symbolx- or xsymbol- where symbol is the currency symbol of the country or region. Note that the position of the currency symbol is determined by xlCurrencyBefore.
xlCurrencySpaceBefore | Boolean | True if a space is added before the currency symbol.
xlCurrencyTrailingZeros | Boolean | True if trailing zeros are displayed for zero currency values.
xlNoncurrencyDigits | Long | Number of decimal digits to be used in noncurrency formats.

Date and Time

Index | Type | Meaning
xl24HourClock | Boolean | True if you're using 24-hour time; False if you're using 12-hour time.
xl4DigitYears | Boolean | True if you're using four-digit years; False if you're using two-digit years.
xlDateOrder | Long | Order of date elements: 0 = month-day-year 1 = day-month-year 2 = year-month-day
xlDateSeparator | String | Date separator (/).
xlDayCode | String | Day symbol (d).
xlDayLeadingZero | Boolean | True if a leading zero is displayed in days.
xlHourCode | String | Hour symbol (h).
xlMDY | Boolean | True if the date order is month-day-year for dates displayed in the long form; False if the date order is day-month-year.
xlMinuteCode | String | Minute symbol (m).
xlMonthCode | String | Month symbol (m).
xlMonthLeadingZero | Boolean | True if a leading zero is displayed in months (when months are displayed as numbers).
xlMonthNameChars | Long | Always returns three characters for backward compatibility. Abbreviated month names are read from Microsoft Windows and can be any length.
xlSecondCode | String | Second symbol (s).
xlTimeSeparator | String | Time separator (:).
xlTimeLeadingZero | Boolean | True if a leading zero is displayed in times.
xlWeekdayNameChars | Long | Always returns three characters for backward compatibility. Abbreviated weekday names are read from Microsoft Windows and can be any length.
xlYearCode | String | Year symbol in number formats (y).

Measurement Systems

Index | Type | Meaning
xlMetric | Boolean | True if you're using the metric system; False if you're using the English measurement system.
xlNonEnglishFunctions | Boolean | True if you're not displaying functions in English.

Separators

Index | Type | Meaning
xlAlternateArraySeparator | String | Alternate array item separator to be used if the current array separator is the same as the decimal separator.
xlColumnSeparator | String | Character used to separate columns in array literals.
xlDecimalSeparator | String | Decimal separator.
xlListSeparator | String | List separator.
xlRowSeparator | String | Character used to separate rows in array literals.
xlThousandsSeparator | String | Zero or thousands separator.

Symbols, separators, and currency formats shown in the preceding table may differ from those used in your language or geographic location and may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example displays the international decimal separator.

VBA Copy code Copy code
MsgBox "The decimal separator is " & _
 Application.International(xlDecimalSeparator)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.IsSandboxed Property (Excel)

 Copy code hover
[image]

Application.IsSandboxed Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the specified workbook is open in a Protected View window. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .IsSandboxed

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

Use the IsSandboxed property to determine if a workbook is open in a Protected View window.

Example

The following code example displays whether the specified workbook is open in a Protected View window.

VBA Copy code Copy code
Sub CheckIfSandboxed(wbk As Workbook)
 MsgBox wbk.Application.IsSandboxed
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Iteration Property (Excel)

 Copy code hover
[image]

Application.Iteration Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel will use iteration to resolve circular references. Read/write Boolean.

Syntax

expression .Iteration

expression A variable that represents an Application object.

Example

This example sets the Iteration property to True so that circular references will be resolved by iteration.

VBA Copy code Copy code
Application.Iteration = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LanguageSettings Property (Excel)

 Copy code hover
[image]

Application.LanguageSettings Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the LanguageSettings object, which contains information about the language settings in Microsoft Excel. Read-only.

Syntax

expression .LanguageSettings

expression A variable that represents an Application object.

Example

This example returns the language identifier for the language you selected when you installed Microsoft Excel.

VBA Copy code Copy code
Set objLangSet = Application.LanguageSettings
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LargeOperationCellThousandCount Property (Excel)

 Copy code hover
[image]

Application.LargeOperationCellThousandCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of cells needed in an operation beyond which an alert is triggered. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .LargeOperationCellThousandCount

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Left Property (Excel)

 Copy code hover
[image]

Application.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the screen to the left edge of the main Microsoft Excel window.

Syntax

expression .Left

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LibraryPath Property (Excel)

 Copy code hover
[image]

Application.LibraryPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the path to the Library folder, but without the final separator. Read-only String.

Syntax

expression .LibraryPath

expression A variable that represents an Application object.

Example

This example opens the file Oscar.xla in the Library folder.

VBA Copy code Copy code
pathSep = Application.PathSeparator
f = Application.LibraryPath & pathSep & "Oscar.Xla"
Workbooks.Open filename:=f

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailSession Property (Excel)

 Copy code hover
[image]

Application.MailSession Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the MAPI mail session number as a hexadecimal string (if there's an active session), or returns null if there's no session. Read-only Variant.

Syntax

expression .MailSession

expression A variable that represents an Application object.

Remarks

This property applies only to mail sessions created by Microsoft Excel (it doesn't return a mail session number for Microsoft Mail).

This property isn't used on PowerTalk mail systems.

Example

This example closes the established mail session, if there is one.

VBA Copy code Copy code
If Not IsNull(Application.MailSession) Then Application.MailLogoff

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailSystem Property (Excel)

 Copy code hover
[image]

Application.MailSystem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the mail system that's installed on the host machine. Read-only XlMailSystem.

Syntax

expression .MailSystem

expression A variable that represents an Application object.

Remarks

XlMailSystem can be one of these XlMailSystem constants.

xlMAPI

xlNoMailSystem

xlPowerTalk

Example

This example displays the name of the mail system that's installed on the computer.

VBA Copy code Copy code
Select Case Application.MailSystem
 Case xlMAPI
 MsgBox "Mail system is Microsoft Mail"
 Case xlPowerTalk
 MsgBox "Mail system is PowerTalk"
 Case xlNoMailSystem
 MsgBox "No mail system installed"
End Select

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MapPaperSize Property (Excel)

 Copy code hover
[image]

Application.MapPaperSize Property (Excel)
See also Send feedback

Published: July 16, 2012

True if documents formatted for the standard paper size of another country/region (for example, A4) are automatically adjusted so that they're printed correctly on the standard paper size (for example, Letter) of your country/region. Read/write Boolean.

Syntax

expression .MapPaperSize

expression A variable that represents an Application object.

Example

This example determines if Microsoft Excel can adjust the paper size according to the country/region setting and notifies the user.

VBA Copy code Copy code
Sub UseMapPaperSize()

 ' Determine setting and notify user.
 If Application.MapPaperSize = True Then
 MsgBox "Microsoft Excel automatically " & _
 "adjusts the paper size according to the country/region setting."
 Else
 MsgBox "Microsoft Excel does not " & _
 "automatically adjusts the paper size according to the country/region setting."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MathCoprocessorAvailable Property (Excel)

 Copy code hover
[image]

Application.MathCoprocessorAvailable Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a math coprocessor is available. Read-only Boolean.

Syntax

expression .MathCoprocessorAvailable

expression A variable that represents an Application object.

Example

This example displays a message box if a math coprocessor isn't available.

VBA Copy code Copy code
If Not Application.MathCoprocessorAvailable Then
 MsgBox "This macro requires a math coprocessor"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MaxChange Property (Excel)

 Copy code hover
[image]

Application.MaxChange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum amount of change between each iteration as Microsoft Excel resolves circular references. Read/write Double.

Syntax

expression .MaxChange

expression A variable that represents an Application object.

Remarks

The MaxIterations property sets the maximum number of iterations that Microsoft Excel can use when resolving circular references.

Example

This example sets the maximum amount of change for each iteration to 0.1.

VBA Copy code Copy code
Application.MaxChange = 0.1

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MaxIterations Property (Excel)

 Copy code hover
[image]

Application.MaxIterations Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of iterations that Microsoft Excel can use to resolve a circular reference. Read/write Long.

Syntax

expression .MaxIterations

expression A variable that represents an Application object.

Remarks

The MaxChange property sets the maximum amount of change between each iteration when Microsoft Excel is resolving circular references.

Example

This example sets the maximum number of iterations at 1000.

VBA Copy code Copy code
Application.MaxIterations = 1000

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MeasurementUnit Property (Excel)

 Copy code hover
[image]

Application.MeasurementUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the measurement unit used in the application. Read/write xlMeasurementUnit.

Version Information

Version Added: Excel 2007

Syntax

expression .MeasurementUnit

expression A variable that represents an Application object.

Example

In the following example the measurement unit for the application is set to inches.

Copy code Copy code
Application.MeasurementUnit = xlInches

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MergeInstances Property (Excel)

 Copy code hover
[image]

Application.MergeInstances Property (Excel)
See also Send feedback

True to merge multiple instances of the application into a single instance. Read/Write Boolean.

Syntax

expression .MergeInstances

expression A variable that represents an Application object.

Example

This example causes multiple instances of the application to be merged into a single instance.

VBA Copy code Copy code
Application.MergeInstances = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MouseAvailable Property (Excel)

 Copy code hover
[image]

Application.MouseAvailable Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a mouse is available. Read-only Boolean.

Syntax

expression .MouseAvailable

expression A variable that represents an Application object.

Example

This example displays a message if a mouse isn't available.

VBA Copy code Copy code
If Application.MouseAvailable = False Then
 MsgBox "Your system does not have a mouse"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MoveAfterReturn Property (Excel)

 Copy code hover
[image]

Application.MoveAfterReturn Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the active cell will be moved as soon as the ENTER (RETURN) key is pressed. Read/write Boolean.

Syntax

expression .MoveAfterReturn

expression A variable that represents an Application object.

Remarks

Use the MoveAfterReturnDirection property to specify the direction in which the active cell is to be moved.

Example

This example sets the MoveAfterReturn property to True.

VBA Copy code Copy code
Application.MoveAfterReturn = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MoveAfterReturnDirection Property (Excel)

 Copy code hover
[image]

Application.MoveAfterReturnDirection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction in which the active cell is moved when the user presses ENTER. Read/write XlDirection.

Syntax

expression .MoveAfterReturnDirection

expression A variable that represents an Application object.

Remarks

XlDirection can be one of these XlDirection constants.

xlDown

xlToLeft

xlToRight

xlUp

If the MoveAfterReturn property is False, the selection doesn't move at all, regardless of how the MoveAfterReturnDirection property is set.

Example

This example causes the active cell to move to the right when the user presses ENTER.

VBA Copy code Copy code
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MultiThreadedCalculation Property (Excel)

 Copy code hover
[image]

Application.MultiThreadedCalculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a MultiThreadedCalculation object that controls the multi-threaded recalculation settings. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .MultiThreadedCalculation

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Name Property (Excel)

 Copy code hover
[image]

Application.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Names Property (Excel)

 Copy code hover
[image]

Application.Names Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Names collection that represents all the names in the active workbook. Read-only Names object.

Syntax

expression .Names

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveWorkbook.Names.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NetworkTemplatesPath Property (Excel)

 Copy code hover
[image]

Application.NetworkTemplatesPath Property (Excel)
See also Send feedback

Returns the network path where templates are stored. If the network path doesn't exist, this property returns an empty string. Read-only String.

Syntax

expression .NetworkTemplatesPath

expression A variable that represents an Application object.

Example

This example displays the network path where templates are stored.

VBA Copy code Copy code
Msgbox Application.NetworkTemplatesPath

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NewWorkbook Property (Excel)

 Copy code hover
[image]

Application.NewWorkbook Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a NewFile object.

Syntax

expression .NewWorkbook

expression An expression that returns a Application object.

Return Value

NewFile

Example

In this example, Microsoft Excel sets the variable wkbOne to a NewFile object.

VBA Copy code Copy code

Sub SetStartWorking()

    Dim wkbOne As NewFile

    ' Create a reference to an instance of the NewFile object.
    Set wkbOne = Application.NewWorkbook

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ODBCErrors Property (Excel)

 Copy code hover
[image]

Application.ODBCErrors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an ODBCErrors collection that contains all the ODBC errors generated by the most recent query table or PivotTable report operation. Read-only.

Syntax

expression .ODBCErrors

expression A variable that represents an Application object.

Remarks

If there's more than one query running at the same time, the ODBCErrors collection contains the ODBC errors from the query that's finished last.

Example

This example refreshes query table one and displays any ODBC errors that occur.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Refresh
 Set errs = Application.ODBCErrors
 If errs.Count > 0 Then
 Set r = .Destination.Cells(1)
 r.Value = "The following errors occurred:"
 c = 0
 For Each er In errs
 c = c + 1
 r.offset(c, 0).value = er.ErrorString
 r.offset(c, 1).value = er.SqlState
 Next
 Else
 MsgBox "Query complete: all records returned."
 End If
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ODBCTimeout Property (Excel)

 Copy code hover
[image]

Application.ODBCTimeout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ODBC query time limit, in seconds. The default value is 45 seconds. Read/write Long.

Syntax

expression .ODBCTimeout

expression A variable that represents an Application object.

Remarks

The value 0 (zero) indicates an indefinite time limit.

Example

This example sets the ODBC query time limit to 15 seconds.

VBA Copy code Copy code
Application.ODBCTimeout = 15

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OLEDBErrors Property (Excel)

 Copy code hover
[image]

Application.OLEDBErrors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the OLEDBErrors collection, which represents the error information returned by the most recent OLE DB query. Read-only.

Syntax

expression .OLEDBErrors

expression A variable that represents an Application object.

Example

This example displays the error description and SqlState property value for an OLE DB error returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors.Item(1)
MsgBox "The following error occurred:" & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnWindow Property (Excel)

 Copy code hover
[image]

Application.OnWindow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.

Syntax

expression .OnWindow

expression A variable that represents an Application object.

Remarks

The procedure specified by this property isn't run when other procedures switch to the window or when a command to switch to a window is received through a DDE channel. Instead, the procedure responds to the user's actions, such as clicking a window with the mouse.

If a worksheet or macro sheet has an Auto_Activate or Auto_Deactivate macro defined for it, those macros will be run after the procedure specified by the OnWindow property.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OperatingSystem Property (Excel)

 Copy code hover
[image]

Application.OperatingSystem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name and version number of the current operating system — for example, "Windows (32-bit) 4.00" or "Macintosh 7.00". Read-only String.

Syntax

expression .OperatingSystem

expression A variable that represents an Application object.

Example

This example displays the name of the operating system.

VBA Copy code Copy code
MsgBox "Microsoft Excel is using " & Application.OperatingSystem

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OrganizationName Property (Excel)

 Copy code hover
[image]

Application.OrganizationName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the registered organization name. Read-only String.

Syntax

expression .OrganizationName

expression A variable that represents an Application object.

Example

This example displays the registered organization name.

VBA Copy code Copy code
MsgBox "The registered organization is " & _
 Application.OrganizationName

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Parent Property (Excel)

 Copy code hover
[image]

Application.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Path Property (Excel)

 Copy code hover
[image]

Application.Path Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the complete path to the application, excluding the final separator and name of the application.

Syntax

expression .Path

expression A variable that represents an Application object.

Example

This example displays the complete path to Microsoft Excel.

VBA Copy code Copy code
Sub TotalPath()

 MsgBox "The path is " & Application.Path

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PathSeparator Property (Excel)

 Copy code hover
[image]

Application.PathSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the path separator character ("\"). Read-only String.

Syntax

expression .PathSeparator

expression A variable that represents an Application object.

Example

This example displays the current path separator.

VBA Copy code Copy code
MsgBox "The path separator character is " & _
 Application.PathSeparator

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PivotTableSelection Property (Excel)

 Copy code hover
[image]

Application.PivotTableSelection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if PivotTable reports use structured selection. Read/write Boolean.

Syntax

expression .PivotTableSelection

expression A variable that represents an Application object.

Example

This example enables structured selection mode and then sets the first PivotTable report on worksheet one to allow only data to be selected.

VBA Copy code Copy code
Application.PivotTableSelection = True
Worksheets(1).PivotTables(1).SelectionMode = xlDataOnly

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PreviousSelections Property (Excel)

 Copy code hover
[image]

Application.PreviousSelections Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an array of the last four ranges or names selected. Each element in the array is a Range object. Read-only Variant.

Syntax

expression .PreviousSelections(Index)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The index number (from 1 to 4) of the previous range or name.

Remarks

Each time you go to a range or cell by using the Name box or the Go To command (Edit menu), or each time a macro calls the Goto method, the previous range is added to this array as element number 1, and the other items in the array are moved down.

Example

This example displays the cell addresses of all items in the array of previous selections. If there are no previous selections, the LBound function returns an error. This error is trapped, and a message box appears.

VBA Copy code Copy code
On Error GoTo noSelections
For i = LBound(Application.PreviousSelections) To _
 UBound(Application.PreviousSelections)
 MsgBox Application.PreviousSelections(i).Address
Next i
Exit Sub
On Error GoTo 0

noSelections:
 MsgBox "There are no previous selections"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PrintCommunication Property (Excel)

 Copy code hover
[image]

Application.PrintCommunication Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether communication with the printer is turned on. Boolean Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .PrintCommunication

expression A variable that returns an Application object.

Return Value

True, if communication with the printer is turned on; otherwise False.

Remarks

Set the PrintCommunication property to False to speed up the execution of code that sets PageSetup properties. Set the PrintCommunication property to True after setting properties to commit all cached PageSetup commands.

Example

The following example suspends communication with the printer while setting PageSetup properties.

VBA Copy code Copy code
Application.PrintCommunication = False
 With ActiveSheet.PageSetup
 .PrintTitleRows = ""
 .PrintTitleColumns = ""
 End With
Application.PrintCommunication = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProductCode Property (Excel)

 Copy code hover
[image]

Application.ProductCode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the globally unique identifier (GUID) for Microsoft Excel. Read-only String.

Syntax

expression .ProductCode

expression A variable that represents an Application object.

Example

This example displays the globally unique identifier (GUID) for Microsoft Excel.

VBA Copy code Copy code
MsgBox Application.ProductCode

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PromptForSummaryInfo Property (Excel)

 Copy code hover
[image]

Application.PromptForSummaryInfo Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel asks for summary information when files are first saved. Read/write Boolean.

Syntax

expression .PromptForSummaryInfo

expression A variable that represents an Application object.

Example

This example displays a prompt that asks for summary information when files are first saved.

VBA Copy code Copy code
Application.PromptForSummaryInfo = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindows Property (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindows collection that represents all the Protected View windows that are open in the application. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindows

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.QuickAnalysis Property (Excel)

 Copy code hover
[image]

Application.QuickAnalysis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a QuickAnalysis object that represents the Quick Analysis options of the application.

Version information

Version Added: Excel 2013

Syntax

expression .QuickAnalysis

expression A variable that represents an Application object.

Example

The following example displays the Quick Analysis contextual UI with the Sparklines option highlighted.

VBS Copy code Copy code
Sub ShowQuickAnalysisOptions()

'Displays the Quick Analysis contextual UI with the Sparklines option highlighted.
  Application.QuickAnalysis.Show (xlSparklines)

End Sub

Property value

QUICKANALYSIS

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Range Property (Excel)

 Copy code hover
[image]

Application.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a cell or a range of cells.

Syntax

expression .Range(Cell1, Cell2)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Cell1 | Required | Variant | The name of the range. This must be an A1-style reference in the language of the macro. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but they're ignored. You can use a local defined name in any part of the range. If you use a name, the name is assumed to be in the language of the macro.
Cell2 | Optional | Variant | The cell in the upper-left and lower-right corner of the range. Can be a Range object that contains a single cell, an entire column, or entire row, or it can be a string that names a single cell in the language of the macro.

Remarks

When used without an object qualifier, this property is a shortcut for ActiveSheet.Range (it returns a range from the active sheet; if the active sheet isn't a worksheet, the property fails).

When applied to a Range object, the property is relative to the Range object. For example, if the selection is cell C3, then Selection.Range("B1") returns cell D3 because it's relative to the Range object returned by the Selection property. On the other hand, the code ActiveSheet.Range("B1") always returns cell B1.

Example

This example sets the value of cell A1 on Sheet1 to 3.14159.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Value = 3.14159

This example creates a formula in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Formula = "=10*RAND()"

This example loops on cells A1:D10 on Sheet1. If one of the cells has a value less than 0.001, the code replaces that value with 0 (zero).

VBA Copy code Copy code
For Each c in Worksheets("Sheet1").Range("A1:D10")
 If c.Value < .001 Then
 c.Value = 0
 End If
Next c

This example loops on the range named "TestRange" and displays the number of empty cells in the range.

VBA Copy code Copy code
numBlanks = 0
For Each c In Range("TestRange")
 If c.Value = "" Then
 numBlanks = numBlanks + 1
 End If
Next c
MsgBox "There are " & numBlanks & " empty cells in this range"

This example sets the font style in cells A1:C5 on Sheet1 to italic. The example uses Syntax 2 of the Range property.

VBA Copy code Copy code
Worksheets("Sheet1").Range(Cells(1, 1), Cells(5, 3)). _
 Font.Italic = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Ready Property (Excel)

 Copy code hover
[image]

Application.Ready Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True when the Microsoft Excel application is ready; False when the Excel application is not ready. Read-only Boolean.

Syntax

expression .Ready

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel checks to see if the Ready property is set to True, and if so, a message displays "Application is ready." Otherwise, Excel displays the message "Application is not ready."

VBA Copy code Copy code
Sub UseReady()

 If Application.Ready = True Then
 MsgBox "Application is ready."
 Else
 MsgBox "Application is not ready."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RecentFiles Property (Excel)

 Copy code hover
[image]

Application.RecentFiles Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a RecentFiles collection that represents the list of recently used files.

Syntax

expression .RecentFiles

expression A variable that represents an Application object.

Example

This example sets the maximum number of files in the list of recently used files to 6.

VBA Copy code Copy code
Application.RecentFiles.Maximum = 6

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RecordRelative Property (Excel)

 Copy code hover
[image]

Application.RecordRelative Property (Excel)
See also Send feedback

True if macros are recorded using relative references; False if recording is absolute. Read-only Boolean.

Syntax

expression .RecordRelative

expression A variable that represents an Application object.

Example

This example displays the address of the active cell on Sheet1 in A1 style if RecordRelative is False; otherwise, it displays the address in R1C1 style.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
If Application.RecordRelative = False Then
 MsgBox ActiveCell.Address(ReferenceStyle:=xlA1)
Else
 MsgBox ActiveCell.Address(ReferenceStyle:=xlR1C1)
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ReferenceStyle Property (Excel)

 Copy code hover
[image]

Application.ReferenceStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how Microsoft Excel displays cell references and row and column headings in either A1 or R1C1 reference style. Read/write XlReferenceStyle.

Syntax

expression .ReferenceStyle

expression A variable that represents an Application object.

Remarks

XlReferenceStyle can be one of these XlReferenceStyle constants.

xlA1

xlR1C1

Example

This example displays the current reference style.

VBA Copy code Copy code
If Application.ReferenceStyle = xlR1C1 Then
 MsgBox ("Microsoft Excel is using R1C1 references")
Else
 MsgBox ("Microsoft Excel is using A1 references")
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RegisteredFunctions Property (Excel)

 Copy code hover
[image]

Application.RegisteredFunctions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns information about functions in either dynamic-link libraries (DLLs) or code resources that were registered with the REGISTER or REGISTER.ID macro functions. Read-only Variant.

Syntax

expression .RegisteredFunctions(Index1, Index2)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index1 | Optional | Variant | The name of the DLL or code resource.
Index2 | Optional | Variant | The name of the function.

Remarks

If you don't specify the index arguments, this property returns an array that contains a list of all registered functions. Each row in the array contains information about a single function, as shown in the following table.

Column | Contents
1 | The name of the DLL or code resource
2 | The name of the procedure in the DLL or code resource
3 | Strings specifying the data types of the return values, and the number and data types of the arguments

If there are no registered functions, this property returns null.

Example

This example creates a list of registered functions, placing one registered function in each row on Sheet1. Column A contains the full path and file name of the DLL or code resource, column B contains the function name, and column C contains the argument data type code.

VBA Copy code Copy code
theArray = Application.RegisteredFunctions
If IsNull(theArray) Then
 MsgBox "No registered functions"
Else
 For i = LBound(theArray) To UBound(theArray)
 For j = 1 To 3
 Worksheets("Sheet1").Cells(i, j). _
 Formula = theArray(i, j)
 Next j
 Next i
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ReplaceFormat Property (Excel)

 Copy code hover
[image]

Application.ReplaceFormat Property (Excel)
See also Send feedback

Sets the replacement criteria to use in replacing cell formats. The replacement criteria is then used in a subsequent call to the Replace method of the Range object.

Syntax

expression .ReplaceFormat

expression A variable that represents an Application object.

Example

The following example sets the search criteria to find cells containing Arial, Regular, Size 10 font, replaces their formats with Arial, Bold, Size 8 font, and then calls the Replace method, with the optional arguments of SearchFormat and ReplaceFormat set to True to actually make the changes.

VBA Copy code Copy code
Sub MakeBold()

 ' Establish search criteria.
 With Application.FindFormat.Font
 .Name = "Arial"
 .FontStyle = "Regular"
 .Size = 10
 End With

 ' Establish replacement criteria.
 With Application.ReplaceFormat.Font
 .Name = "Arial"
 .FontStyle = "Bold"
 .Size = 8
 End With

 ' Notify user.
 With Application.ReplaceFormat.Font
 MsgBox .Name & "-" & .FontStyle & "-" & .Size & _
 " font is what the search criteria will replace cell formats with."
 End With

 ' Make the replacements in the worksheet.
 Cells.Replace What:="", Replacement:="", _
 SearchFormat:=True, ReplaceFormat:=True

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RollZoom Property (Excel)

 Copy code hover
[image]

Application.RollZoom Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the IntelliMouse zooms instead of scrolling. Read/write Boolean.

Syntax

expression .RollZoom

expression A variable that represents an Application object.

Example

This example enables the IntelliMouse to zoom instead of scroll.

VBA Copy code Copy code
Application.RollZoom = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Rows Property (Excel)

 Copy code hover
[image]

Application.Rows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the rows on the active worksheet. If the active document isn't a worksheet, the Rows property fails. Read-only Range object.

Syntax

expression .Rows

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Rows.

When applied to a Range object that's a multiple selection, this property returns rows from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Rows.Count returns 2, not 4. To use this property on a range that may contain a multiple selection, test Areas.Count to determine whether the range is a multiple selection. If it is, loop over each area in the range, as shown in the third example.

Example

This example deletes row three on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(3).Delete

This example deletes rows in the current region on worksheet one where the value of cell one in the row is the same as the value in cell one in the previous row.

VBA Copy code Copy code
For Each rw In Worksheets(1).Cells(1, 1).CurrentRegion.Rows
 this = rw.Cells(1, 1).Value
 If this = last Then rw.Delete
 last = this
Next

This example displays the number of rows in the selection on Sheet1. If more than one area is selected, the example loops through each area.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
 MsgBox "The selection contains " & _
 Selection.Rows.Count & " rows."
Else
 i = 1
 For Each a In Selection.Areas
 MsgBox "Area " & i & " of the selection contains " & _
 a.Rows.Count & " rows."
 i = i + 1
 Next a
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RTD Property (Excel)

 Copy code hover
[image]

Application.RTD Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an RTD object.

Syntax

expression .RTD

expression An expression that returns a Application object.

Return Value

RTD

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ScreenUpdating Property (Excel)

 Copy code hover
[image]

Application.ScreenUpdating Property (Excel)
See also Send feedback

Published: July 16, 2012

True if screen updating is turned on. Read/write Boolean.

Syntax

expression .ScreenUpdating

expression A variable that represents an Application object.

Remarks

Turn screen updating off to speed up your macro code. You won't be able to see what the macro is doing, but it will run faster.

Remember to set the ScreenUpdating property back to True when your macro ends.

Example

This example demonstrates how turning off screen updating can make your code run faster. The example hides every other column on Sheet1, while keeping track of the time it takes to do so. The first time the example hides the columns, screen updating is turned on; the second time, screen updating is turned off. When you run this example, you can compare the respective running times, which are displayed in the message box.

VBA Copy code Copy code
Dim elapsedTime(2)
Application.ScreenUpdating = True
For i = 1 To 2
 If i = 2 Then Application.ScreenUpdating = False
 startTime = Time
 Worksheets("Sheet1").Activate
 For Each c In ActiveSheet.Columns
 If c.Column Mod 2 = 0 Then
 c.Hidden = True
 End If
 Next c
 stopTime = Time
 elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60
Next i
Application.ScreenUpdating = True
MsgBox "Elapsed time, screen updating on: " & elapsedTime(1) & _
 " sec." & Chr(13) & _
 "Elapsed time, screen updating off: " & elapsedTime(2) & _
 " sec."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Selection Property (Excel)

 Copy code hover
[image]

Application.Selection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the selected object in the active window for an Application object.

Syntax

expression .Selection

expression A variable that represents an Application object.

Remarks

The returned object type depends on the current selection (for example, if a cell is selected, this property returns a Range object). The Selection property returns Nothing if nothing is selected.

Using this property with no object qualifier is equivalent to using Application.Selection.

Example

This example clears the selection on Sheet1 (assuming that the selection is a range of cells).

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Selection.Clear

This example displays the Visual Basic object type of the selection.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The selection object type is " & TypeName(Selection)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Sheets Property (Excel)

 Copy code hover
[image]

Application.Sheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the sheets in the active workbook. Read-only Sheets object.

Syntax

expression .Sheets

expression An expression that returns a Application object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveWorkbook.Sheets.

Example

This example creates a new worksheet and then places a list of the active workbook's sheet names in the first column.

VBA Copy code Copy code
Set newSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
 newSheet.Cells(i, 1).Value = Sheets(i).Name
Next i

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetsInNewWorkbook Property (Excel)

 Copy code hover
[image]

Application.SheetsInNewWorkbook Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of sheets that Microsoft Excel automatically inserts into new workbooks. Read/write Long.

Syntax

expression .SheetsInNewWorkbook

expression A variable that represents an Application object.

Example

This example displays the number of sheets automatically inserted into new workbooks.

VBA Copy code Copy code
MsgBox "Microsoft Excel inserts " & _
 Application.SheetsInNewWorkbook & _
 " sheet(s) in each new workbook"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowChartTipNames Property (Excel)

 Copy code hover
[image]

Application.ShowChartTipNames Property (Excel)
See also Send feedback

Published: July 16, 2012

True if charts show chart tip names. The default value is True. Read/write Boolean.

Syntax

expression .ShowChartTipNames

expression A variable that represents an Application object.

Example

This example turns off chart tip names and values.

VBA Copy code Copy code
With Application
 .ShowChartTipNames = False
 .ShowChartTipValues = False
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowChartTipValues Property (Excel)

 Copy code hover
[image]

Application.ShowChartTipValues Property (Excel)
See also Send feedback

Published: July 16, 2012

True if charts show chart tip values. The default value is True. Read/write Boolean.

Syntax

expression .ShowChartTipValues

expression A variable that represents an Application object.

Example

This example turns off chart tip names and values.

VBA Copy code Copy code
With Application
 .ShowChartTipNames = False
 .ShowChartTipValues = False
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowDevTools Property (Excel)

 Copy code hover
[image]

Application.ShowDevTools Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowDevTools

expression A variable that represents an Application object.

Remarks

This property corresponds to the Show Developer tab in the Ribbon check box in the Excel Options dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowMenuFloaties Property (Excel)

 Copy code hover
[image]

Application.ShowMenuFloaties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to display Mini toolbars when the user right-clicks in the workbook window. False if Mini toolbars are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowMenuFloaties

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowQuickAnalysis Property (Excel)

 Copy code hover
[image]

Application.ShowQuickAnalysis Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls whether the Quick Analysis contextual user interface is displayed on selection. TRUE means the Quick Analysis button will show. Corresponds to the Show Quick Analysis options on selection checkbox located in the File menu, Options, Excel Options, and then General tab. Read/Write. Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .ShowQuickAnalysis

expression A variable that represents an Application object.

Example

This example hides the Quick Analysis button on selection.

VBA Copy code Copy code
Application.ShowQuickAnalysis = False

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowSelectionFloaties Property (Excel)

 Copy code hover
[image]

Application.ShowSelectionFloaties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Mini toolbars displays when a user selects text. False if Mini toolbars are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowSelectionFloaties

expression A variable that represents an Application object.

Remarks

Corresponds with the Show MiniBar on selection check box in the Excel Options dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowStartupDialog Property (Excel)

 Copy code hover
[image]

Application.ShowStartupDialog Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True (default is False) when the New Workbook task pane appears for a Microsoft Excel application. Read/write Boolean.

Syntax

expression .ShowStartupDialog

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel determines if the New Workbook task pane appears and notifies the user.

VBA Copy code Copy code
Sub CheckStartupDialog()

 ' Determine if the New Workbook task pane is enabled.
 If Application.ShowStartupDialog = False Then
 MsgBox "ShowStartupDialog is set to False."
 Else
 MsgBox "ShowStartupDialog is set to True."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowToolTips Property (Excel)

 Copy code hover
[image]

Application.ShowToolTips Property (Excel)
See also Send feedback

Published: July 16, 2012

True if ToolTips are turned on. Read/write Boolean.

Syntax

expression .ShowToolTips

expression A variable that represents an Application object.

Example

This example causes Microsoft Excel to display ToolTips.

VBA Copy code Copy code
Application.ShowToolTips = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtColors Property (Excel)

 Copy code hover
[image]

Application.SmartArtColors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the set of color styles that are currently loaded in the application. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SmartArtColors

expression A variable that represents an Application object.

Return Value

SmartArtColors

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtLayouts Property (Excel)

 Copy code hover
[image]

Application.SmartArtLayouts Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the set of SmartArt layouts that are currently loaded in the application. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SmartArtLayouts

expression A variable that represents an Application object.

Return Value

SmartArtLayouts

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtQuickStyles Property (Excel)

 Copy code hover
[image]

Application.SmartArtQuickStyles Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the set of SmartArt quick styles which are currently loaded in the application. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SmartArtQuickStyles

expression A variable that represents an Application object.

Return Value

SmartArtQuickStyles

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Speech Property (Excel)

 Copy code hover
[image]

Application.Speech Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Speech object.

Syntax

expression .Speech

expression A variable that represents an Application object.

Example

In the following example, Microsoft Excel plays back "Hello". This example assumes speech features have been installed on the host system.

VBA Copy code Copy code
Sub UseSpeech()

 Application.Speech.Speak "Hello"

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SpellingOptions Property (Excel)

 Copy code hover
[image]

Application.SpellingOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SpellingOptions object that represents the spelling options of the application.

Syntax

expression .SpellingOptions

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel checks the setting on the spelling options for ignoring mixed digits, and notifies the user of its status.

VBA Copy code Copy code
Sub MixedDigitCheck()

 ' Determine the setting on spell checking for mixed digits.
 If Application.SpellingOptions.IgnoreMixedDigits = True Then
 MsgBox "The spelling options are set to ignore mixed digits."
 Else
 MsgBox "The spelling options are set to check for mixed digits."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StandardFont Property (Excel)

 Copy code hover
[image]

Application.StandardFont Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the standard font. Read/write String.

Syntax

expression .StandardFont

expression A variable that represents an Application object.

Remarks

If you change the standard font by using this property, the change doesn't take effect until you restart Microsoft Excel.

Example

This example sets the standard font to Geneva (on the Macintosh) or Arial (in Windows).

VBA Copy code Copy code
If Application.OperatingSystem Like "*Macintosh*" Then
 Application.StandardFont = "Geneva"
Else
 Application.StandardFont = "Arial"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StandardFontSize Property (Excel)

 Copy code hover
[image]

Application.StandardFontSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the standard font size, in points. Read/write Long.

Syntax

expression .StandardFontSize

expression A variable that represents an Application object.

Remarks

If you change the standard font size by using this property, the change doesn't take effect until you restart Microsoft Excel.

Example

This example sets the standard font size to 12 points.

VBA Copy code Copy code
Application.StandardFontSize = 12

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StartupPath Property (Excel)

 Copy code hover
[image]

Application.StartupPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the complete path of the startup folder, excluding the final separator. Read-only String.

Syntax

expression .StartupPath

expression A variable that represents an Application object.

Example

This example displays the full path to the Microsoft Excel startup folder.

VBA Copy code Copy code
MsgBox Application.StartupPath

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StatusBar Property (Excel)

 Copy code hover
[image]

Application.StatusBar Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text in the status bar. Read/write String.

Syntax

expression .StatusBar

expression A variable that represents an Application object.

Remarks

This property returns False if Microsoft Excel has control of the status bar. To restore the default status bar text, set the property to False; this works even if the status bar is hidden.

Example

This example sets the status bar text to "Please be patient..." before it opens the workbook Large.xls, and then it restores the default text.

VBA Copy code Copy code
oldStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "Please be patient..."
Workbooks.Open filename:="LARGE.XLS"
Application.StatusBar = False
Application.DisplayStatusBar = oldStatusBar

See also

Concepts

Application Object

Other resources

Application Object Members


Application.TemplatesPath Property (Excel)

 Copy code hover
[image]

Application.TemplatesPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the local path where templates are stored. Read-only String.

Syntax

expression .TemplatesPath

expression A variable that represents an Application object.

Example

This example returns the local path where templates are stored.

VBA Copy code Copy code
Msgbox Application.TemplatesPath

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ThisCell Property (Excel)

 Copy code hover
[image]

Application.ThisCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cell in which the user-defined function is being called from as a Range object.

Syntax

expression .ThisCell

expression A variable that represents an Application object.

Remarks

Users should not access properties or methods on the Range object when inside the user-defined function. Users can cache the Range object for later use and perform additional actions when the recalculation is finished.

Example

In this example, a function called "UseThisCell" contains the ThisCell property to notify the user of the cell address.

VBA Copy code Copy code
Function UseThisCell()
 MsgBox "The cell address is: " & _
 Application.ThisCell.Address
End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ThisWorkbook Property (Excel)

 Copy code hover
[image]

Application.ThisWorkbook Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Workbook object that represents the workbook where the current macro code is running. Read-only.

Syntax

expression .ThisWorkbook

expression A variable that represents an Application object.

Remarks

Use this property to refer to the workbook that contains your macro code. ThisWorkbook is the only way to refer to an add-in workbook from inside the add-in itself. The ActiveWorkbook property doesn't return the add-in workbook; it returns the workbook that's calling the add-in.

The Workbooks property may fail, as the workbook name probably changed when you created the add-in. ThisWorkbook always returns the workbook in which the code is running.

For example, use code such as the following to activate a dialog sheet stored in your add-in workbook.

ThisWorkbook.DialogSheets(1).Show

This property can be used only from inside Microsoft Excel. You cannot use it to access a workbook from any other application.

Example

This example closes the workbook that contains the example code. Changes to the workbook, if any, aren't saved.

VBA Copy code Copy code
ThisWorkbook.Close SaveChanges:=False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ThousandsSeparator Property (Excel)

 Copy code hover
[image]

Application.ThousandsSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns the character used for the thousands separator as a String. Read/write.

Syntax

expression .ThousandsSeparator

expression A variable that represents an Application object.

Example

This example places "1,234,567.89" in cell A1 then changes the system separators to dashes for the decimals and thousands separators.

VBA Copy code Copy code
Sub ChangeSystemSeparators()

 Range("A1").Formula = "1,234,567.89"
 MsgBox "The system separators will now change."

 ' Define separators and apply.
 Application.DecimalSeparator = "-"
 Application.ThousandsSeparator = "-"
 Application.UseSystemSeparators = False

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Top Property (Excel)

 Copy code hover
[image]

Application.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the screen to the top edge of the main Microsoft Excel window.

Syntax

expression .Top

expression A variable that represents an Application object.

Remarks

If the application window is minimized, this property controls the position of the window icon (anywhere on the screen).

See also

Concepts

Application Object

Other resources

Application Object Members


Application.TransitionMenuKey Property (Excel)

 Copy code hover
[image]

Application.TransitionMenuKey Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the Microsoft Excel menu or help key, which is usually "/". Read/write String.

Syntax

expression .TransitionMenuKey

expression A variable that represents an Application object.

Example

This example sets the transition menu key to "/" (which is the default).

VBA Copy code Copy code
Application.TransitionMenuKey = "/"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.TransitionMenuKeyAction Property (Excel)

 Copy code hover
[image]

Application.TransitionMenuKeyAction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the action taken when the Microsoft Excel menu key is pressed. Can be either xlExcelMenus or xlLotusHelp. Read/write Long.

Syntax

expression .TransitionMenuKeyAction

expression A variable that represents an Application object.

Example

This example sets the Microsoft Excel menu key to run Lotus 1-2-3 Help when it is pressed.

VBA Copy code Copy code
Application.TransitionMenuKeyAction = xlLotusHelp

See also

Concepts

Application Object

Other resources

Application Object Members


Application.TransitionNavigKeys Property (Excel)

 Copy code hover
[image]

Application.TransitionNavigKeys Property (Excel)
See also Send feedback

Published: July 16, 2012

True if transition navigation keys are active. Read/write Boolean.

Syntax

expression .TransitionNavigKeys

expression A variable that represents an Application object.

Example

This example displays the current state of the Transition navigation keys option.

VBA Copy code Copy code
If Application.TransitionNavigKeys Then
 keyState = "On"
Else
 keyState = "Off"
End If
MsgBox "The Transition Navigation Keys option is " & keyState

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UsableHeight Property (Excel)

 Copy code hover
[image]

Application.UsableHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.

Syntax

expression .UsableHeight

expression A variable that represents an Application object.

Example

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UsableWidth Property (Excel)

 Copy code hover
[image]

Application.UsableWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.

Syntax

expression .UsableWidth

expression A variable that represents an Application object.

Example

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UseClusterConnector Property (Excel)

 Copy code hover
[image]

Application.UseClusterConnector Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether Excel allows user-defined functions in XLL add-ins to be run on a compute cluster. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .UseClusterConnector

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

True if Excel allows user-defined functions in XLL add-ins to be run on a compute cluster; otherwise False. The setting of the UseClusterConnector property corresponds to the Allow user-defined XLL functions to run on a compute cluster check box under Formulas in the Advanced category of the Excel Options dialog box.

Note Note

To enable the UseClusterConnector property you must install a High Performance Computing (HPC) Cluster Connector. A Cluster Connector enables you to run cluster-safe XLL functions remotely on an HPC cluster for increased performance.

After setting the UseClusterConnector property, use the ClusterConnector property to specify the HPC Cluster Connector to use.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UsedObjects Property (Excel)

 Copy code hover
[image]

Application.UsedObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a UsedObjects object representing objects allocated in a workbook. Read-only

Syntax

expression .UsedObjects

expression A variable that represents an Application object.

Example

In this example, Microsoft Excel determines the quantity of objects that have been allocated and notifies the user. This example assumes a recalculation was performed in the application and was interrupted before finishing.

VBA Copy code Copy code
Sub CountUsedObjects()

 MsgBox "The number of used objects in this application is: " & _
 Application.UsedObjects.Count

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserControl Property (Excel)

 Copy code hover
[image]

Application.UserControl Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the application is visible or if it was created or started by the user. False if you created or started the application programmatically by using the CreateObject or GetObject functions, and the application is hidden. Read/write Boolean.

Syntax

expression .UserControl

expression A variable that represents an Application object.

Remarks

When the UserControl property is False for an object, that object is released when the last programmatic reference to the object is released. If this property is False, Microsoft Excel quits when the last object in the session is released.

Example

This example displays the status of the UserControl property.

VBA Copy code Copy code
If Application.UserControl Then
 MsgBox "This workbook was created by the user"
Else
 MsgBox "This workbook was created programmatically"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserLibraryPath Property (Excel)

 Copy code hover
[image]

Application.UserLibraryPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the path to the location on the user's computer where the COM add-ins are installed. Read-only String.

Syntax

expression .UserLibraryPath

expression A variable that represents an Application object.

Example

This example determines where the COM add-ins are installed on the user's computer and assigns the string to the variable strLibPath.

VBA Copy code Copy code
strLibPath = Application.UserLibraryPath

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserName Property (Excel)

 Copy code hover
[image]

Application.UserName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the current user. Read/write String.

Syntax

expression .UserName

expression A variable that represents an Application object.

Example

This example displays the name of the current user.

VBA Copy code Copy code
MsgBox "Current user is " & Application.UserName

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UseSystemSeparators Property (Excel)

 Copy code hover
[image]

Application.UseSystemSeparators Property (Excel)
See also Send feedback

Published: July 16, 2012

True (default) if the system separators of Microsoft Excel are enabled. Read/write Boolean.

Syntax

expression .UseSystemSeparators

expression A variable that represents an Application object.

Example

In this example, "1,234,567.89" is placed in cell A1. The system separators are then changed to dashes for the decimals and thousands separators.

VBA Copy code Copy code
Sub ChangeSystemSeparators()

 Range("A1").Formula = "1,234,567.89"
 MsgBox "The system separators will now change."

 ' Define separators and apply.
 Application.DecimalSeparator = "-"
 Application.ThousandsSeparator = "-"
 Application.UseSystemSeparators = False

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Value Property (Excel)

 Copy code hover
[image]

Application.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the application.

Syntax

expression .Value

expression A variable that represents an Application object.

Remarks

This property always returns "Microsoft Excel".

See also

Concepts

Application Object

Other resources

Application Object Members


Application.VBE Property (Excel)

 Copy code hover
[image]

Application.VBE Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VBE object that represents the Visual Basic Editor. Read-only.

Syntax

expression .VBE

expression A variable that represents an Application object.

Example

This example changes the name of the active Visual Basic project.

VBA Copy code Copy code
Application.VBE.ActiveVBProject.Name = "TestProject"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Version Property (Excel)

 Copy code hover
[image]

Application.Version Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the Microsoft Excel version number.

Syntax

expression .Version

expression A variable that represents an Application object.

Example

This example displays a message box that contains the Microsoft Excel version number and the name of the operating system.

VBA Copy code Copy code
MsgBox "Welcome to Microsoft Excel version " & _
 Application.Version & " running on " & _
 Application.OperatingSystem & "!"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Visible Property (Excel)

 Copy code hover
[image]

Application.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WarnOnFunctionNameConflict Property (Excel)

 Copy code hover
[image]

Application.WarnOnFunctionNameConflict Property (Excel)
See also Send feedback

Published: July 16, 2012

The WarnOnFunctionNameConflict property, when set to True, raises an alert if a developer tries to create a new function using an existing function name. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .WarnOnFunctionNameConflict

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Watches Property (Excel)

 Copy code hover
[image]

Application.Watches Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Watches object representing a range which is tracked when the worksheet is recalculated.

Syntax

expression .Watches

expression A variable that represents an Application object.

Example

This example creates a summation formula in cell A3, and then adds this cell to the Watch Window.

VBA Copy code Copy code
Sub AddWatch()
 With Application
 .Range("A1").Formula = 1
 .Range("A2").Formula = 2
 .Range("A3").Formula = "=Sum(A1:A2)"
 .Range("A3").Select
 .Watches.Add Source:=ActiveCell
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Width Property (Excel)

 Copy code hover
[image]

Application.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the application window to its right edge.

Syntax

expression .Width

expression A variable that represents an Application object.

Remarks

If the window is minimized, Width is read-only and returns the width of the window icon.

Example

This example expands the active window to the maximum size available (assuming that the window isn't maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Windows Property (Excel)

 Copy code hover
[image]

Application.Windows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Windows collection that represents all the windows in all the workbooks. Read-only Windows object.

Syntax

expression .Windows

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using Application.Windows.

This property returns a collection of both visible and hidden windows.

Example

This example closes the first open or hidden window in Microsoft Excel.

VBA Copy code Copy code
Application.Windows(1).Close

This example names window one in the active workbook "Consolidated Balance Sheet." This name is then used as the index to the Windows collection.

VBA Copy code Copy code
ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet"
ActiveWorkbook.Windows("Consolidated Balance Sheet") _
 .ActiveSheet.Calculate

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowsForPens Property (Excel)

 Copy code hover
[image]

Application.WindowsForPens Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the computer is running under Microsoft Windows for Pen Computing. Read-only Boolean.

Syntax

expression .WindowsForPens

expression A variable that represents an Application object.

Example

This example shows how to limit handwriting recognition to numbers and punctuation only if Microsoft Windows for Pen Computing is running.

VBA Copy code Copy code
If Application.WindowsForPens Then
 Application.ConstrainNumeric = True
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowState Property (Excel)

 Copy code hover
[image]

Application.WindowState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the window. Read/write XlWindowState.

Syntax

expression .WindowState

expression A variable that represents an Application object.

Example

This example maximizes the application window in Microsoft Excel.

VBA Copy code Copy code
Application.WindowState = xlMaximized

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Workbooks Property (Excel)

 Copy code hover
[image]

Application.Workbooks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Workbooks collection that represents all the open workbooks. Read-only.

Syntax

expression .Workbooks

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using Application.Workbooks .

The collection returned by the Workbooks property doesn't include open add-ins, which are a special kind of hidden workbook. You can, however, return a single open add-in if you know the file name. For example, Workbooks("Oscar.xla") will return the open add-in named "Oscar.xla" as a Workbook object.

Note Note

A workbook displayed in a protected view window is not a member of the Workbooks collection. Instead, use the Workbook property of the ProtectedViewWindow object to access a workbook that is displayed in a protected view window.

Example

This example activates the workbook Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1").Activate

This example opens the workbook Large.xls.

VBA Copy code Copy code
Workbooks.Open filename:="LARGE.XLS"

This example saves changes to and closes all workbooks except the one that's running the example.

VBA Copy code Copy code
For Each w In Workbooks
    If w.Name <> ThisWorkbook.Name Then
        w.Close savechanges:=True
    End If
Next w

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorksheetFunction Property (Excel)

 Copy code hover
[image]

Application.WorksheetFunction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the WorksheetFunction object. Read-only.

Syntax

expression .WorksheetFunction

expression A variable that represents an Application object.

Example

This example displays the result of applying the Min worksheet function to the range A1:A10.

VBA Copy code Copy code
Set myRange = Worksheets("Sheet1").Range("A1:C10")
answer = Application.WorksheetFunction.Min(myRange)
MsgBox answer

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Worksheets Property (Excel)

 Copy code hover
[image]

Application.Worksheets Property (Excel)
See also Send feedback

Published: July 16, 2012

For an Application object, returns a Sheets collection that represents all the worksheets in the active workbook. For a Workbook object, returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.

Syntax

expression .Worksheets

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier returns all the worksheets in the active workbook.

This property doesn't return macro sheets; use the Excel4MacroSheets property or the Excel4IntlMacroSheets property to return those sheets.

Example

This example displays the value in cell A1 on Sheet1 in the active workbook.

VBA Copy code Copy code
MsgBox Worksheets("Sheet1").Range("A1").Value

This example displays the name of each worksheet in the active workbook.

VBA Copy code Copy code
For Each ws In Worksheets
 MsgBox ws.Name
Next ws

This example adds a new worksheet to the active workbook and then sets the name of the worksheet.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
newSheet.Name = "current Budget"

See also

Concepts

Application Object

Other resources

Application Object Members


Application Methods (Excel)

 Copy code hover
[image]

Application Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ActivateMicrosoftApp | Activates a Microsoft application. If the application is already running, this method activates the running application. If the application isn't running, this method starts a new instance of the application.
AddCustomList | Adds a custom list for custom autofill and/or custom sort.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
CalculateFull | Forces a full calculation of the data in all open workbooks.
CalculateFullRebuild | For all open workbooks, forces a full calculation of the data and rebuilds the dependencies.
CalculateUntilAsyncQueriesDone | Runs all pending queries to OLEDB and OLAP data sources.
CentimetersToPoints | Converts a measurement from centimeters to points (one point equals 0.035 centimeters).
CheckAbort | Stops recalculation in a Microsoft Excel application.
CheckSpelling | Checks the spelling of a single word.
ConvertFormula | Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both. Variant.
DDEExecute | Runs a command or performs some other action or actions in another application by way of the specified DDE channel.
DDEInitiate | Opens a DDE channel to an application.
DDEPoke | Sends data to an application.
DDERequest | Requests information from the specified application. This method always returns an array.
DDETerminate | Closes a channel to another application.
DeleteCustomList | Deletes a custom list.
DisplayXMLSourcePane | Opens the XML Source task pane and displays the XML map specified by the XmlMap argument.
DoubleClick | Equivalent to double-clicking the active cell.
Evaluate | Converts a Microsoft Excel name to an object or a value.
ExecuteExcel4Macro | Runs a Microsoft Excel 4.0 macro function and then returns the result of the function. The return type depends on the function.
FindFile | Displays the Open dialog box.
GetCustomListContents | Returns a custom list (an array of strings).
GetCustomListNum | Returns the custom list number for an array of strings. You can use this method to match both built-in lists and custom-defined lists.
GetOpenFilename | Displays the standard Open dialog box and gets a file name from the user without actually opening any files.
GetPhonetic | Returns the Japanese phonetic text of the specified text string. This method is available to you only if you have selected or installed Japanese language support for Microsoft Office.
GetSaveAsFilename | Displays the standard Save As dialog box and gets a file name from the user without actually saving any files.
Goto | Selects any range or Visual Basic procedure in any workbook, and activates that workbook if it's not already active.
Help | Displays a Help topic.
InchesToPoints | Converts a measurement from inches to points.
InputBox | Displays a dialog box for user input. Returns the information entered in the dialog box.
Intersect | Returns a Range object that represents the rectangular intersection of two or more ranges.
MacroOptions | Corresponds to options in the Macro Options dialog box. You can also use this method to display a user defined function (UDF) in a built-in or new category within the Insert Function dialog box.
MailLogoff | Closes a MAPI mail session established by Microsoft Excel.
MailLogon | Logs in to MAPI Mail or Microsoft Exchange and establishes a mail session. If Microsoft Mail isn't already running, you must use this method to establish a mail session before mail or document routing functions can be used.
NextLetter | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
OnKey | Runs a specified procedure when a particular key or key combination is pressed.
OnRepeat | Sets the Repeat item and the name of the procedure that will run if you choose the Repeat command after running the procedure that sets this property.
OnTime | Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).
OnUndo | Sets the text of the Undo command and the name of the procedure that's run if you choose the Undo command after running the procedure that sets this property.
Quit | Quits Microsoft Excel.
RecordMacro | Records code if the macro recorder is on.
RegisterXLL | Loads an XLL code resource and automatically registers the functions and commands contained in the resource.
Repeat | Repeats the last user-interface action.
Run | Runs a macro or calls a function. This can be used to run a macro written in Visual Basic or the Microsoft Excel macro language, or to run a function in a DLL or XLL.
SendKeys | Sends keystrokes to the active application.
SharePointVersion | Returns the version number of SharePoint Foundation instances running at site for the specified URL.
Undo | Cancels the last user-interface action.
Union | Returns the union of two or more ranges.
Volatile | Marks a user-defined function as volatile. A volatile function must be recalculated whenever calculation occurs in any cells on the worksheet. A nonvolatile function is recalculated only when the input variables change. This method has no effect if it's not inside a user-defined function used to calculate a worksheet cell.
Wait | Pauses a running macro until a specified time. Returns True if the specified time has arrived.


Application.ActivateMicrosoftApp Method (Excel)

 Copy code hover
[image]

Application.ActivateMicrosoftApp Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates a Microsoft application. If the application is already running, this method activates the running application. If the application isn't running, this method starts a new instance of the application.

Syntax

expression .ActivateMicrosoftApp(Index)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | XlMSApplication | Specifies the Microsoft application to activate.

Example

This example starts and activates Word.

VBA Copy code Copy code
Application.ActivateMicrosoftApp xlMicrosoftWord

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AddCustomList Method (Excel)

 Copy code hover
[image]

Application.AddCustomList Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a custom list for custom autofill and/or custom sort.

Syntax

expression .AddCustomList(ListArray, ByRow)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ListArray | Required | Variant | Specifies the source data, as either an array of strings or a Range object.
ByRow | Optional | Variant | Only used if ListArray is a Range object. True to create a custom list from each row in the range. False to create a custom list from each column in the range. If this argument is omitted and there are more rows than columns (or an equal number of rows and columns) in the range, Microsoft Excel creates a custom list from each column in the range. If this argument is omitted and there are more columns than rows in the range, Microsoft Excel creates a custom list from each row in the range.

Remarks

If the list you're trying to add already exists, this method does nothing.

Example

This example adds an array of strings as a custom list.

VBA Copy code Copy code
Application.AddCustomList Array("cogs", "sprockets", _
 "widgets", "gizmos")

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Calculate Method (Excel)

 Copy code hover
[image]

Application.Calculate Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.

Syntax

expression .Calculate

expression A variable that represents an Application object.

Remarks

To calculate | Follow this example
All open workbooks | Application.Calculate (or just Calculate)
A specific worksheet | Worksheets(1).Calculate
A specified range | Worksheets(1).Rows(2).Calculate

Example

This example calculates the formulas in columns A, B, and C in the used range on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").UsedRange.Columns("A:C").Calculate

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculateFull Method (Excel)

 Copy code hover
[image]

Application.CalculateFull Method (Excel)
See also Send feedback

Published: July 16, 2012

Forces a full calculation of the data in all open workbooks.

Syntax

expression .CalculateFull

expression A variable that represents an Application object.

Example

This example compares the version of Microsoft Excel with the version of Excel that the workbook was last calculated in. If the two version numbers are different, a full calculation of the data in all open workbooks is performed.

VBA Copy code Copy code
If Application.CalculationVersion <> _
 Workbooks(1).CalculationVersion Then
 Application.CalculateFull
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculateFullRebuild Method (Excel)

 Copy code hover
[image]

Application.CalculateFullRebuild Method (Excel)
See also Send feedback

Published: July 16, 2012

For all open workbooks, forces a full calculation of the data and rebuilds the dependencies.

Syntax

expression .CalculateFullRebuild

expression A variable that represents an Application object.

Remarks

Dependencies are the formulas that depend on other cells. For example, the formula "=A1" depends on cell A1. The CalculateFullRebuild method is similar to re-entering all formulas.

Example

This example compares the version of Microsoft Excel with the version of Excel in which the workbook was last calculated. If the two version numbers are different, a full calculation of the data in all open workbooks is performed and the dependencies are rebuilt.

VBA Copy code Copy code
Sub UseCalculateFullRebuild()

 If Application.CalculationVersion <> _
 Workbooks(1).CalculationVersion Then
 Application.CalculateFullRebuild
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CalculateUntilAsyncQueriesDone Method (Excel)

 Copy code hover
[image]

Application.CalculateUntilAsyncQueriesDone Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs all pending queries to OLEDB and OLAP data sources.

Version Information

Version Added: Excel 2007

Syntax

expression .CalculateUntilAsyncQueriesDone

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CentimetersToPoints Method (Excel)

 Copy code hover
[image]

Application.CentimetersToPoints Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a measurement from centimeters to points (one point equals 0.035 centimeters).

Syntax

expression .CentimetersToPoints(Centimeters)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Centimeters | Required | Double | Specifies the centimeter value to be converted to points.

Return Value

Double

Example

This example sets the left margin of Sheet1 to 5 centimeters.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.LeftMargin = _
 Application.CentimetersToPoints(5)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CheckAbort Method (Excel)

 Copy code hover
[image]

Application.CheckAbort Method (Excel)
See also Send feedback

Published: July 16, 2012

Stops recalculation in a Microsoft Excel application.

Syntax

expression .CheckAbort(KeepAbort)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeepAbort | Optional | Boolean | Allows recalculation to be performed for a Range.

Example

In this example, Excel stops recalculation in the application, except for cell A10. For you to be able to see the results of this example, other calculations should exist in the application that will allow you to see the differences between the cell designated to continue recalculating and other cells.

VBA Copy code Copy code
Sub UseCheckAbort()

 Dim rngSubtotal As Variant
 Set rngSubtotal = Application.Range("A10")

 ' Stop recalculation except for designated cell.
 Application.CheckAbort KeepAbort:=rngSubtotal

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CheckSpelling Method (Excel)

 Copy code hover
[image]

Application.CheckSpelling Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the spelling of a single word.

Syntax

expression .CheckSpelling(Word, CustomDictionary, IgnoreUppercase)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | (used only with Application object). The word you want to check.
CustomDictionary | Optional | Variant | A string that indicates the file name of the custom dictionary to be examined if the word isn't found in the main dictionary. If this argument is omitted, the currently specified dictionary is used.
IgnoreUppercase | Optional | Variant | True to have Microsoft Excel ignore words that are all uppercase. False to have Microsoft Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.

Return Value

True if the word is found in one of the dictionaries; otherwise False.

Remarks

To check headers, footers, and objects on a worksheet, use this method on a Worksheet object.

To check only cells and notes, use this method with the object returned by the Cells property.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ConvertFormula Method (Excel)

 Copy code hover
[image]

Application.ConvertFormula Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both. Variant.

Syntax

expression .ConvertFormula(Formula, FromReferenceStyle, ToReferenceStyle, ToAbsolute, RelativeTo)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Required | Variant | A string that containis the formula you want to convert. This must be a valid formula, and it must begin with an equal sign.
FromReferenceStyle | Required | XlReferenceStyle | The reference style of the formula.
ToReferenceStyle | Optional | Variant | A constant of XlReferenceStyle specifying the reference style you want returned. If this argument is omitted, the reference style isn't changed; the formula stays in the style specified by FromReferenceStyle.
ToAbsolute | Optional | Variant | A constant of XlReferenceStyle which specifies the converted reference type. If this argument is omitted, the reference type isn't changed.
RelativeTo | Optional | Variant | A Range object that contains one cell. Relative references relate to this cell.

Return Value

Variant

Remarks

There is a 255 character limit for the formula.

Example

This example converts a SUM formula that contains R1C1-style references to an equivalent formula that contains A1-style references, and then it displays the result.

VBA Copy code Copy code
inputFormula = "=SUM(R10C2:R15C2)"
MsgBox Application.ConvertFormula( _
 formula:=inputFormula, _
 fromReferenceStyle:=xlR1C1, _
 toReferenceStyle:=xlA1)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEExecute Method (Excel)

 Copy code hover
[image]

Application.DDEExecute Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs a command or performs some other action or actions in another application by way of the specified DDE channel.

Syntax

expression .DDEExecute(Channel, String)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
String | Required | String | The message defined in the receiving application.

Remarks

The DDEExecute method is designed to send commands to another application. You can also use it to send keystrokes to another application, although the SendKeys method is the preferred way to send keystrokes. The String argument can specify any single key combined with ALT, CTRL, or SHIFT, or any combination of those keys. Each key is represented by one or more characters, such as "a" for the character a, or "{ENTER}" for the ENTER key.

To specify characters that aren't displayed when you press the corresponding key (for example, ENTER or TAB), use the codes listed in the following table. Each code in the table represents one key on the keyboard.

Key | Code
BACKSPACE | {BACKSPACE} or {BS}
BREAK | {BREAK}
CAPS LOCK | {CAPSLOCK}
CLEAR | {CLEAR}
DELETE or DEL | {DELETE} or {DEL}
DOWN ARROW | {DOWN}
END | {END}
ENTER (numeric keypad) | {ENTER}
ENTER | ~ (tilde)
ESC | {ESCAPE} or {ESC}
HELP | {HELP}
HOME | {HOME}
INS | {INSERT}
LEFT ARROW | {LEFT}
NUM LOCK | {NUMLOCK}
PAGE DOWN | {PGDN}
PAGE UP | {PGUP}
RETURN | {RETURN}
RIGHT ARROW | {RIGHT}
SCROLL LOCK | {SCROLLLOCK}
TAB | {TAB}
UP ARROW | {UP}
F1 through F15 | {F1} through {F15}

You can also specify keys combined with SHIFT and/or CTRL and/or ALT. To specify a key combined with one or more of the keys just mentioned, use the following table.

To combine a key with | Precede the key code with
SHIFT | + (plus sign)
CTRL | ^ (caret)
ALT | % (percent sign)

Example

This example opens a channel to Word, opens the Word document Formletr.doc, and then sends the FilePrint command to WordBasic.

VBA Copy code Copy code
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEInitiate Method (Excel)

 Copy code hover
[image]

Application.DDEInitiate Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens a DDE channel to an application.

Syntax

expression .DDEInitiate(App, Topic)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
App | Required | String | The application name.
Topic | Required | String | Describes something in the application to which you're opening a channel — usually a document of that application.

Return Value

Long

Remarks

If successful, the DDEInitiate method returns the number of the open channel. All subsequent DDE functions use this number to specify the channel.

Example

This example opens a channel to Word, opens the Word document Formletr.doc, and then sends the FilePrint command to WordBasic.

VBA Copy code Copy code
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEPoke Method (Excel)

 Copy code hover
[image]

Application.DDEPoke Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends data to an application.

Syntax

expression .DDEPoke(Channel, Item, Data)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | Variant | The item to which the data is to be sent.
Data | Required | Variant | The data to be sent to the application.

Remarks

An error occurs if the method call doesn't succeed.

Example

This example opens a channel to Word, opens the Word document Sales.doc, and then inserts the contents of cell A1 (on Sheet1) at the beginning of the document.

VBA Copy code Copy code
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\SALES.DOC")
Set rangeToPoke = Worksheets("Sheet1").Range("A1")
Application.DDEPoke channelNumber, "\StartOfDoc", rangeToPoke
Application.DDETerminate channelNumber

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDERequest Method (Excel)

 Copy code hover
[image]

Application.DDERequest Method (Excel)
See also Send feedback

Published: July 16, 2012

Requests information from the specified application. This method always returns an array.

Syntax

expression .DDERequest(Channel, Item)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | String | The item to be requested.

Return Value

Variant

Example

This example opens a channel to the System topic in Word and then uses the Topics item to return a list of all open documents. The list is returned in column A on Sheet1.

VBA Copy code Copy code
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="System")
returnList = Application.DDERequest(channelNumber, "Topics")
For i = LBound(returnList) To UBound(returnList)
 Worksheets("Sheet1").Cells(i, 1).Formula = returnList(i)
Next i
Application.DDETerminate channelNumber

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDETerminate Method (Excel)

 Copy code hover
[image]

Application.DDETerminate Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes a channel to another application.

Syntax

expression .DDETerminate(Channel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.

Example

This example opens a channel to Word, opens the Word document Formletr.doc, and then sends the FilePrint command to WordBasic.

VBA Copy code Copy code
channelNumber = Application.DDEInitiate( _
 app:="WinWord", _
 topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DeleteCustomList Method (Excel)

 Copy code hover
[image]

Application.DeleteCustomList Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes a custom list.

Syntax

expression .DeleteCustomList(ListNum)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ListNum | Required | Long | The custom list number. This number must be greater than or equal to 5 (Microsoft Excel has four built-in custom lists that cannot be deleted).

Remarks

This method generates an error if the list number is less than 5 or if there's no matching custom list.

Example

This example deletes a custom list.

VBA Copy code Copy code
n = Application.GetCustomListNum(Array("cogs", "sprockets", _
 "widgets", "gizmos"))
Application.DeleteCustomList n

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayXMLSourcePane Method (Excel)

 Copy code hover
[image]

Application.DisplayXMLSourcePane Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens the XML Source task pane and displays the XML map specified by the XmlMap argument.

Syntax

expression .DisplayXMLSourcePane(XmlMap)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
XmlMap | Optional | Variant | The XML map to display in the task pane.

Remarks

You can use the following code to hide the XML Source task pane.

VBA Copy code Copy code
Application.CommandBars("XML Source").Visible = False

Example

The following example adds an XML map named Customers to the active workbook, and then displays the XML map in the XML Source task pane.

VBA Copy code Copy code
Sub DisplayXMLMap()
 Dim objCustomer As XmlMap

 Set objCustomer = ActiveWorkbook.XmlMaps.Add( _
 "Customers.xsd", "Root")

 objCustomer.Name = "Customers"

 Application.DisplayXMLSourcePane
 objCustomer
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DoubleClick Method (Excel)

 Copy code hover
[image]

Application.DoubleClick Method (Excel)
See also Send feedback

Equivalent to double-clicking the active cell.

Syntax

expression .DoubleClick

expression A variable that represents an Application object.

Example

This example double-clicks the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Application.DoubleClick

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Evaluate Method (Excel)

 Copy code hover
[image]

Application.Evaluate Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a Microsoft Excel name to an object or a value.

Syntax

expression .Evaluate(Name)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Variant | A formula or the name of the object, using the naming convention of Microsoft Excel. The length of the name must be less than or equal to 255 characters.

Return Value

Variant

Remarks

The following types of names in Microsoft Excel can be used with this method:

  • Formulas.

  • A1-style references. You can use any reference to a single cell in A1-style notation. All references are considered to be absolute references.

  • Ranges. You can use the range, intersect, and union operators (colon, space, and comma, respectively) with references.

  • Defined names. You can specify any name in the language of the macro.

  • External references. You can use the ! operator to refer to a cell or to a name defined in another workbook — for example, Evaluate("[BOOK1.XLS]Sheet1!A1").

  • Chart Objects. You can specify any chart object name, such as "Legend", "Plot Area", or "Series 1", to access the properties and methods of that object. For example, Charts("Chart1").Evaluate("Legend").Font.Name returns the name of the font used in the legend.

Note Note

Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument. For example, the following expression pairs are equivalent.

VBA Copy code Copy code
[a1].Value = 25
Evaluate("A1").Value = 25

trigVariable = [SIN(45)]
trigVariable = Evaluate("SIN(45)")

Set firstCellInSheet = Workbooks("BOOK1.XLS").Sheets(4).[A1]
Set firstCellInSheet = _
    Workbooks("BOOK1.XLS").Sheets(4).Evaluate("A1")

The advantage of using square brackets is that the code is shorter. The advantage of using Evaluate is that the argument is a string, so you can either construct the string in your code or use a Visual Basic variable.

Example

This example turns on bold formatting in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
boldCell = "A1"
Application.Evaluate(boldCell).Font.Bold = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ExecuteExcel4Macro Method (Excel)

 Copy code hover
[image]

Application.ExecuteExcel4Macro Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs a Microsoft Excel 4.0 macro function and then returns the result of the function. The return type depends on the function.

Syntax

expression .ExecuteExcel4Macro(String)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | A Microsoft Excel 4.0 macro language function without the equal sign. All references must be given as R1C1 strings. If String contains embedded double quotation marks, you must double them. For example, to run the macro function =MID("sometext",1,4), String would have to be "MID(""sometext"",1,4)".

Return Value

Variant

Remarks

The Microsoft Excel 4.0 macro isn't evaluated in the context of the current workbook or sheet. This means that any references should be external and should specify an explicit workbook name. For example, to run the Microsoft Excel 4.0 macro "My_Macro" in Book1 you must use "Book1!My_Macro()". If you don't specify the workbook name, this method fails.

Example

This example runs the GET.CELL(42) macro function on cell C3 on Sheet1 and then displays the result in a message box. The GET.CELL(42) macro function returns the horizontal distance from the left edge of the active window to the left edge of the active cell. This macro function has no direct Visual Basic equivalent.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("C3").Select
MsgBox ExecuteExcel4Macro("GET.CELL(42)")

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FindFile Method (Excel)

 Copy code hover
[image]

Application.FindFile Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the Open dialog box.

Syntax

expression .FindFile

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

This method displays the Open dialog box and allows the user to open a file. If a new file is opened successfully, this method returns True. If the user cancels the dialog box, this method returns False.

Example

This example displays the Open dialog box.

VBA Copy code Copy code
Application.FindFile

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetCustomListContents Method (Excel)

 Copy code hover
[image]

Application.GetCustomListContents Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a custom list (an array of strings).

Syntax

expression .GetCustomListContents(ListNum)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ListNum | Required | Long | The list number.

Return Value

Variant

Example

This example writes the elements of the first custom list in column one on Sheet1.

VBA Copy code Copy code
listArray = Application.GetCustomListContents(1)
For i = LBound(listArray, 1) To UBound(listArray, 1)
 Worksheets("sheet1").Cells(i, 1).Value = listArray(i)
Next i

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetCustomListNum Method (Excel)

 Copy code hover
[image]

Application.GetCustomListNum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the custom list number for an array of strings. You can use this method to match both built-in lists and custom-defined lists.

Syntax

expression .GetCustomListNum(ListArray)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ListArray | Required | Variant | An array of strings.

Return Value

Long

Remarks

This method generates an error if there's no corresponding list.

Example

This example deletes a custom list.

VBA Copy code Copy code
n = Application.GetCustomListNum(Array("cogs", "sprockets", _
 "widgets", "gizmos"))
Application.DeleteCustomList n

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetOpenFilename Method (Excel)

 Copy code hover
[image]

Application.GetOpenFilename Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the standard Open dialog box and gets a file name from the user without actually opening any files.

Syntax

expression .GetOpenFilename(FileFilter, FilterIndex, Title, ButtonText, MultiSelect)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
FileFilter | Optional | Variant | A string specifying file filtering criteria.
FilterIndex | Optional | Variant | Specifies the index numbers of the default file filtering criteria, from 1 to the number of filters specified in FileFilter. If this argument is omitted or greater than the number of filters present, the first file filter is used.
Title | Optional | Variant | Specifies the title of the dialog box. If this argument is omitted, the title is "Open."
ButtonText | Optional | Variant | Macintosh only.
MultiSelect | Optional | Variant | True to allow multiple file names to be selected. False to allow only one file name to be selected. The default value is False.

Return Value

Variant

Remarks

This string passed in the FileFilter argument consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. Each separate pair is listed in the Files of type drop-down list box. For example, the following string specifies two file filters—text and addin: "Text Files (*.txt),*.txt,Add-In Files (*.xla),*.xla".

To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons; for example, "Visual Basic Files (*.bas; *.txt),*.bas;*.txt".

If FileFilter is omitted, this argument defaults to "All Files (*.*),*.*".

This method returns the selected file name or the name entered by the user. The returned name may include a path specification. If MultiSelect is True, the return value is an array of the selected file names (even if only one filename is selected). Returns False if the user cancels the dialog box.

This method may change the current drive or folder.

Example

This example displays the Open dialog box, with the file filter set to text files. If the user chooses a file name, the code displays that file name in a message box.

VBA Copy code Copy code
fileToOpen = Application _
 .GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen <> False Then
 MsgBox "Open " & fileToOpen
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetPhonetic Method (Excel)

 Copy code hover
[image]

Application.GetPhonetic Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Japanese phonetic text of the specified text string. This method is available to you only if you have selected or installed Japanese language support for Microsoft Office.

Syntax

expression .GetPhonetic(Text)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Optional | Variant | Specifies the text to be converted to phonetic text. If you omit this argument, the next possible phonetic text string (if any) of the previously specified Text is returned. If there are no more possible phonetic text strings, an empty string is returned.

Return Value

String

Example

This example displays all of the possible phonetic text strings from the specified string.

VBA Copy code Copy code
strPhoText = Application.GetPhonetic("純子")
While strPhoText <> ""
    MsgBox strPhoText
    strPhoText = Application.GetPhonetic()
Wend

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetSaveAsFilename Method (Excel)

 Copy code hover
[image]

Application.GetSaveAsFilename Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the standard Save As dialog box and gets a file name from the user without actually saving any files.

Syntax

expression .GetSaveAsFilename(InitialFilename, FileFilter, FilterIndex, Title, ButtonText)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
InitialFilename | Optional | Variant | Specifies the suggested file name. If this argument is omitted, Microsoft Excel uses the active workbook's name.
FileFilter | Optional | Variant | A string specifying file filtering criteria.
FilterIndex | Optional | Variant | Specifies the index number of the default file filtering criteria, from 1 to the number of filters specified in FileFilter. If this argument is omitted or greater than the number of filters present, the first file filter is used.
Title | Optional | Variant | Specifies the title of the dialog box. If this argument is omitted, the default title is used.
ButtonText | Optional | Variant | Macintosh only.

Return Value

Variant

Remarks

This string passed in the FileFilter argument consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. Each separate pair is listed in the Files of type drop-down list box. For example, the following string specifies two file filters, text and addin: "Text Files (*.txt), *.txt, Add-In Files (*.xla), *.xla".

To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons; for example, "Visual Basic Files (*.bas; *.txt),*.bas;*.txt".

This method returns the selected file name or the name entered by the user. The returned name may include a path specification. Returns False if the user cancels the dialog box.

This method may change the current drive or folder.

Example

This example displays the Save As dialog box, with the file filter set to text files. If the user chooses a file name, the example displays that file name in a message box.

VBA Copy code Copy code
fileSaveName = Application.GetSaveAsFilename( _
 fileFilter:="Text Files (*.txt), *.txt")
If fileSaveName <> False Then
 MsgBox "Save as " & fileSaveName
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Goto Method (Excel)

 Copy code hover
[image]

Application.Goto Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects any range or Visual Basic procedure in any workbook, and activates that workbook if it's not already active.

Syntax

expression .Goto(Reference, Scroll)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Reference | Optional | Variant | The destination. Can be a Range object, a string that contains a cell reference in R1C1-style notation, or a string that contains a Visual Basic procedure name. If this argument is omitted, the destination is the last range you used the Goto method to select.
Scroll | Optional | Variant | True to scroll through the window so that the upper-left corner of the range appears in the upper-left corner of the window. False to not scroll through the window. The default is False.

Remarks

This method differs from the Select method in the following ways:

  • If you specify a range on a sheet that's not on top, Microsoft Excel will switch to that sheet before selecting. (If you use Select with a range on a sheet that's not on top, the range will be selected but the sheet won't be activated).

  • This method has a Scroll argument that lets you scroll through the destination window.

  • When you use the Goto method, the previous selection (before the Goto method runs) is added to the array of previous selections (for more information, see the PreviousSelections property). You can use this feature to quickly jump between as many as four selections.

  • The Select method has a Replace argument; the Goto method doesn't.

Example

This example selects cell A154 on Sheet1 and then scrolls through the worksheet to display the range.

VBA Copy code Copy code
Application.Goto Reference:=Worksheets("Sheet1").Range("A154"), _
 scroll:=True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Help Method (Excel)

 Copy code hover
[image]

Application.Help Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays a Help topic.

Syntax

expression .Help(HelpFile, HelpContextID)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
HelpFile | Optional | Variant | The name of the online Help file you want to display. If this argument isn't specified, Microsoft Excel Help is used.
HelpContextID | Optional | Variant | Specifies the context ID number for the Help topic. If this argument isn't specified, the Help Topics dialog box is displayed.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.InchesToPoints Method (Excel)

 Copy code hover
[image]

Application.InchesToPoints Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a measurement from inches to points.

Syntax

expression .InchesToPoints(Inches)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Inches | Required | Double | Specifies the inch value to be converted to points.

Return Value

Double

Example

This example sets the left margin of Sheet1 to 2.5 inches.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.LeftMargin = _
 Application.InchesToPoints(2.5)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.InputBox Method (Excel)

 Copy code hover
[image]

Application.InputBox Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays a dialog box for user input. Returns the information entered in the dialog box.

Syntax

expression .InputBox(Prompt, Title, Default, Left, Top, HelpFile, HelpContextID, Type)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Prompt | Required | String | The message to be displayed in the dialog box. This can be a string, a number, a date, or a Boolean value (Microsoft Excel automatically coerces the value to a String before it is displayed).
Title | Optional | Variant | The title for the input box. If this argument is omitted, the default title is "Input."
Default | Optional | Variant | Specifies a value that will appear in the text box when the dialog box is initially displayed. If this argument is omitted, the text box is left empty. This value can be a Range object.
Left | Optional | Variant | Specifies an x position for the dialog box in relation to the upper-left corner of the screen, in points.
Top | Optional | Variant | Specifies a y position for the dialog box in relation to the upper-left corner of the screen, in points.
HelpFile | Optional | Variant | The name of the Help file for this input box. If the HelpFile and HelpContextID arguments are present, a Help button will appear in the dialog box.
HelpContextID | Optional | Variant | The context ID number of the Help topic in HelpFile.
Type | Optional | Variant | Specifies the return data type. If this argument is omitted, the dialog box returns text.

Return Value

Variant

Remarks

The following table lists the values that can be passed in the Type argument. Can be one or a sum of the values. For example, for an input box that can accept both text and numbers, set Type to 1 + 2.

Value | Meaning
0 | A formula
1 | A number
2 | Text (a string)
4 | A logical value (True or False)
8 | A cell reference, as a Range object
16 | An error value, such as #N/A
64 | An array of values

Use InputBox to display a simple dialog box so that you can enter information to be used in a macro. The dialog box has an OK button and a Cancel button. If you choose the OK button, InputBox returns the value entered in the dialog box. If you click the Cancel button, InputBox returns False.

If Type is 0, InputBox returns the formula in the form of text — for example, "=2*PI()/360". If there are any references in the formula, they are returned as A1-style references. (Use ConvertFormula to convert between reference styles.)

If Type is 8, InputBox returns a Range object. You must use the Set statement to assign the result to a Range object, as shown in the following example.

VBA Copy code Copy code
Set myRange = Application.InputBox(prompt := "Sample", type := 8)

If you do not use the Set statement, the variable is set to the value in the range, rather than the Range object itself.

If you use the InputBox method to ask the user for a formula, you must use the FormulaLocal property to assign the formula to a Range object. The input formula will be in the user's language.

The InputBox method differs from the InputBox function in that it allows selective validation of the user's input, and it can be used with Microsoft Excel objects, error values, and formulas. Notice that Application.InputBox calls the InputBox method; InputBox with no object qualifier calls the InputBox function.

Example

This example prompts the user for a number.

VBA Copy code Copy code
myNum = Application.InputBox("Enter a number")

This example prompts the user to select a cell on Sheet1. The example uses the Type argument to ensure that the return value is a valid cell reference (a Range object).

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set myCell = Application.InputBox( _
    prompt:="Select a cell", Type:=8)

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example uses an InputBox for the user to select a range to pass to the user-defined function "MyFunction", which multiplies three values in a range together and returns the result.

Copy code Copy code
Sub Cbm_Value_Select()
   'Set up the variables.
   Dim rng As Range

   'Use the InputBox dialog to set the range for MyFunction, with some simple error handling.
   Set rng = Application.InputBox("Range:", Type:=8)
   If rng.Cells.Count <> 3 Then
     MsgBox "Length, width and height are needed -" & _
         vbLf & "please select three cells!"
      Exit Sub
   End If

   'Call MyFunction by value using the active cell.
   ActiveCell.Value = MyFunction(rng)
End Sub

Function MyFunction(rng As Range) As Double
   MyFunction = rng(1) * rng(2) * rng(3)
End Function

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Intersect Method (Excel)

 Copy code hover
[image]

Application.Intersect Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the rectangular intersection of two or more ranges.

Syntax

expression .Intersect(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | The intersecting ranges. At least two Range objects must be specified.
Arg2 | Required | Range | The intersecting ranges. At least two Range objects must be specified.
Arg3 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg4 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg5 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg6 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg7 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg8 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg9 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg10 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg11 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg12 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg13 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg14 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg15 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg16 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg17 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg18 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg19 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg20 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg21 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg22 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg23 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg24 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg25 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg26 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg27 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg28 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg29 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.
Arg30 | Optional | Variant | The intersecting ranges. At least two Range objects must be specified.

Return Value

Range

Example

This example selects the intersection of two named ranges, rg1 and rg2, on Sheet1. If the ranges don't intersect, the example displays a message.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set isect = Application.Intersect(Range("rg1"), Range("rg2"))
If isect Is Nothing Then
 MsgBox "Ranges do not intersect"
Else
 isect.Select
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MacroOptions Method (Excel)

 Copy code hover
[image]

Application.MacroOptions Method (Excel)
See also Send feedback

Published: July 16, 2012

Corresponds to options in the Macro Options dialog box. You can also use this method to display a user defined function (UDF) in a built-in or new category within the Insert Function dialog box.

Syntax

expression .MacroOptions(Macro, Description, HasMenu, MenuText, HasShortcutKey, ShortcutKey, Category, StatusBar, HelpContextID, HelpFile, ArgumentDescriptions)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Macro | Optional | Variant | The macro name or the name of a user defined function (UDF).
Description | Optional | Variant | The macro description.
HasMenu | Optional | Variant | This argument is ignored.
MenuText | Optional | Variant | This argument is ignored.
HasShortcutKey | Optional | Variant | True to assign a shortcut key to the macro (ShortcutKey must also be specified). If this argument is False, no shortcut key is assigned to the macro. If the macro already has a shortcut key, setting this argument to False removes the shortcut key. The default value is False.
ShortcutKey | Optional | Variant | Required if HasShortcutKey is True; ignored otherwise. The shortcut key.
Category | Optional | Variant | An integer that specifies an existing macro function category (Financial, Date & Time, or User Defined, for example). See the Remarks section to determine the integers that are mapped to the built-in categories. You can also specify a string for a custom category. If you provide a string it will be treated as the category name that is displayed in the Insert Function dialog box. If the category name has never been used, a new category is defined with that name. If you use a category name that is the same as a built-in name (see list in Remarks section), Microsoft Excel will map the user defined function to that built-in category.
StatusBar | Optional | Variant | The status bar text for the macro.
HelpContextID | Optional | Variant | An integer that specifies the context ID for the Help topic assigned to the macro.
HelpFile | Optional | Variant | The name of the Help file that contains the Help topic defined by HelpContextId.
ArgumentDescriptions | Optional | Array | A one-dimensional array that contains the descriptions for the arguments to a UDF that are displayed in the Function Arguments dialog box.

Remarks

The following table lists which integers are mapped to the built-in categories that can be used in the Category parameter.

Integer | Category
1 | Financial
2 | Date & Time
3 | Math & Trig
4 | Statistical
5 | Lookup & Reference
6 | Database
7 | Text
8 | Logical
9 | Information
10 | Commands
11 | Customizing
12 | Macro Control
13 | DDE/External
14 | User Defined
15 | First custom category
16 | Second custom category
17 | Third custom category
18 | Fourth custom category
19 | Fifth custom category
20 | Sixth custom category
21 | Seventh custom category
22 | Eighth custom category
23 | Ninth custom category
24 | Tenth custom category
25 | Eleventh custom category
26 | Twelfth custom category
27 | Thirteenth custom category
28 | Fourteenth custom category
29 | Fifteenth custom category
30 | Sixteenth custom category
31 | Seventeenth custom category
32 | Eighteenth custom category

Example

This example adds a user-defined macro called "TestMacro" to a custom category named "My Custom Category". After you run this example, you should see "My Custom Category" which contains the "TestMacro" user-defined function in the Or select a category drop-down list in the Insert Function dialog box.

VBA Copy code Copy code
Function TestMacro()
    MsgBox ActiveWorkbook.Name
End Function

Sub AddUDFToCustomCategory()
    Application.MacroOptions Macro:="TestMacro", Category:="My Custom Category"
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailLogoff Method (Excel)

 Copy code hover
[image]

Application.MailLogoff Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes a MAPI mail session established by Microsoft Excel.

Syntax

expression .MailLogoff

expression A variable that represents an Application object.

Remarks

You cannot use this method to close or log off Microsoft Mail.

Example

This example closes the established mail session, if there is one.

VBA Copy code Copy code
If Not IsNull(Application.MailSession) Then Application.MailLogoff

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailLogon Method (Excel)

 Copy code hover
[image]

Application.MailLogon Method (Excel)
See also Send feedback

Published: July 16, 2012

Logs in to MAPI Mail or Microsoft Exchange and establishes a mail session. If Microsoft Mail isn't already running, you must use this method to establish a mail session before mail or document routing functions can be used.

Syntax

expression .MailLogon(Name, Password, DownloadNewMail)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Optional | Variant | The mail account name or Microsoft Exchange profile name. If this argument is omitted, the default mail account name is used.
Password | Optional | Variant | The mail account password. This argument is ignored in Microsoft Exchange.
DownloadNewMail | Optional | Variant | True to download new mail immediately.

Remarks

Microsoft Excel logs off any mail sessions it previously established before attempting to establish the new session.

To piggyback on the system default mail session, omit both the name and password parameters.

Example

This example logs in to the default mail account.

VBA Copy code Copy code
If IsNull(Application.MailSession) Then
 Application.MailLogon
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NextLetter Method (Excel)

 Copy code hover
[image]

Application.NextLetter Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .NextLetter

expression A variable that represents an Application object.

Return Value

Workbook

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnKey Method (Excel)

 Copy code hover
[image]

Application.OnKey Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs a specified procedure when a particular key or key combination is pressed.

Syntax

expression .OnKey(Key, Procedure)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Key | Required | String | A string indicating the key to be pressed.
Procedure | Optional | Variant | A string indicating the name of the procedure to be run. If Procedure is "" (empty text), nothing happens when Key is pressed. This form of OnKey changes the normal result of keystrokes in Microsoft Excel. If Procedure is omitted, Key reverts to its normal result in Microsoft Excel, and any special key assignments made with previous OnKey methods are cleared.

Remarks

The Key argument can specify any single key combined with ALT, CTRL, or SHIFT, or any combination of these keys. Each key is represented by one or more characters, such as "a" for the character a, or "{ENTER}" for the ENTER key.

To specify characters that aren't displayed when you press the corresponding key (ENTER or TAB, for example), use the codes listed in the following table. Each code in the table represents one key on the keyboard.

Key | Code
BACKSPACE | {BACKSPACE} or {BS}
BREAK | {BREAK}
CAPS LOCK | {CAPSLOCK}
CLEAR | {CLEAR}
DELETE or DEL | {DELETE} or {DEL}
DOWN ARROW | {DOWN}
END | {END}
ENTER (numeric keypad) | {ENTER}
ENTER | ~ (tilde)
ESC | {ESCAPE} or {ESC}
HELP | {HELP}
HOME | {HOME}
INS | {INSERT}
LEFT ARROW | {LEFT}
NUM LOCK | {NUMLOCK}
PAGE DOWN | {PGDN}
PAGE UP | {PGUP}
RETURN | {RETURN}
RIGHT ARROW | {RIGHT}
SCROLL LOCK | {SCROLLLOCK}
TAB | {TAB}
UP ARROW | {UP}
F1 through F15 | {F1} through {F15}

You can also specify keys combined with SHIFT and/or CTRL and/or ALT. To specify a key combined with another key or keys, use the following table.

To combine keys with | Precede the key code by
SHIFT | + (plus sign)
CTRL | ^ (caret)
ALT | % (percent sign)

To assign a procedure to one of the special characters (+, ^, %, and so on), enclose the character in braces. For details, see the example.

Example

This example assigns "InsertProc" to the key sequence CTRL+PLUS SIGN and assigns "SpecialPrintProc" to the key sequence SHIFT+CTRL+RIGHT ARROW.

VBA Copy code Copy code
Application.OnKey "^{+}", "InsertProc"
Application.OnKey "+^{RIGHT}", "SpecialPrintProc"

This example returns SHIFT+CTRL+RIGHT ARROW to its normal meaning.

VBA Copy code Copy code
Application.OnKey "+^{RIGHT}"

This example disables the SHIFT+CTRL+RIGHT ARROW key sequence.

VBA Copy code Copy code
Application.OnKey "+^{RIGHT}", ""

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnRepeat Method (Excel)

 Copy code hover
[image]

Application.OnRepeat Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the Repeat item and the name of the procedure that will run if you choose the Repeat command after running the procedure that sets this property.

Syntax

expression .OnRepeat(Text, Procedure)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text that appears with the Repeat command.
Procedure | Required | String | The name of the procedure that will be run when you choose the Repeat command.

Remarks

If a procedure doesn't use the OnRepeat method, the Repeat command repeats procedure that was run most recently.

The procedure must use the OnRepeat and OnUndo methods last, to prevent the repeat and undo procedures from being overwritten by subsequent actions in the procedure.

Example

This example sets the repeat and undo procedures.

VBA Copy code Copy code
Application.OnRepeat "Repeat VB Procedure", _
 "Book1.xls!My_Repeat_Sub"
Application.OnUndo "Undo VB Procedure", _
 "Book1.xls!My_Undo_Sub"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnTime Method (Excel)

 Copy code hover
[image]

Application.OnTime Method (Excel)
See also Send feedback

Published: July 16, 2012

Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).

Syntax

expression .OnTime(EarliestTime, Procedure, LatestTime, Schedule)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
EarliestTime | Required | Variant | The time when you want this procedure to be run.
Procedure | Required | String | The name of the procedure to be run.
LatestTime | Optional | Variant | The latest time at which the procedure can be run. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won't be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run.
Schedule | Optional | Variant | True to schedule a new OnTime procedure. False to clear a previously set procedure. The default value is True.

Remarks

Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.

Example

This example runs my_Procedure 15 seconds from now.

VBA Copy code Copy code
Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"

This example runs my_Procedure at 5 P.M.

VBA Copy code Copy code
Application.OnTime TimeValue("17:00:00"), "my_Procedure"

This example cancels the OnTime setting from the previous example.

VBA Copy code Copy code
Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
 Procedure:="my_Procedure", Schedule:=False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnUndo Method (Excel)

 Copy code hover
[image]

Application.OnUndo Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the text of the Undo command and the name of the procedure that's run if you choose the Undo command after running the procedure that sets this property.

Syntax

expression .OnUndo(Text, Procedure)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text that appears with the Undo command.
Procedure | Required | String | The name of the procedure that's run when you choose the Undo command.

Remarks

If a procedure doesn't use the OnUndo method, the Undo command is disabled.

The procedure must use the OnRepeat and OnUndo methods last, to prevent the repeat and undo procedures from being overwritten by subsequent actions in the procedure.

Example

This example sets the repeat and undo procedures.

VBA Copy code Copy code
Application.OnRepeat "Repeat VB Procedure", _
 "Book1.xls!My_Repeat_Sub"
Application.OnUndo "Undo VB Procedure", _
 "Book1.xls!My_Undo_Sub"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Quit Method (Excel)

 Copy code hover
[image]

Application.Quit Method (Excel)
See also Send feedback

Published: July 16, 2012

Quits Microsoft Excel.

Syntax

expression .Quit

expression A variable that represents an Application object.

Remarks

If unsaved workbooks are open when you use this method, Microsoft Excel displays a dialog box asking whether you want to save the changes. You can prevent this by saving all workbooks before using the Quit method or by setting the DisplayAlerts property to False. When this property is False, Microsoft Excel doesn't display the dialog box when you quit with unsaved workbooks; it quits without saving them.

If you set the Saved property for a workbook to True without saving the workbook to the disk, Microsoft Excel will quit without asking you to save the workbook.

Example

This example saves all open workbooks and then quits Microsoft Excel.

VBA Copy code Copy code
For Each w In Application.Workbooks
 w.Save
Next w
Application.Quit

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RecordMacro Method (Excel)

 Copy code hover
[image]

Application.RecordMacro Method (Excel)
See also Send feedback

Published: July 16, 2012

Records code if the macro recorder is on.

Syntax

expression .RecordMacro(BasicCode, XlmCode)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
BasicCode | Optional | Variant | A string that specifies the Visual Basic code that will be recorded if the macro recorder is recording into a Visual Basic module. The string will be recorded on one line. If the string contains a carriage return (ASCII character 10, or Chr$(10) in code), it will be recorded on more than one line.
XlmCode | Optional | Variant | This argument is ignored.

Remarks

The RecordMacro method cannot record into the active module (the module in which the RecordMacro method exists).

If BasicCode is omitted and the application is recording into Visual Basic, Microsoft Excel will record a suitable Application.Run statement.

To prevent recording (for example, if the user cancels your dialog box), call this function with two empty strings.

Example

This example records Visual Basic code.

VBA Copy code Copy code
Application.RecordMacro BasicCode:="Application.Run ""MySub"" "

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RegisterXLL Method (Excel)

 Copy code hover
[image]

Application.RegisterXLL Method (Excel)
See also Send feedback

Published: July 16, 2012

Loads an XLL code resource and automatically registers the functions and commands contained in the resource.

Syntax

expression .RegisterXLL(Filename)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Specifies the name of the XLL to be loaded.

Return Value

Boolean

Remarks

This method returns True if the code resource is successfully loaded; otherwise, the method returns False.

Example

This example loads an XLL file and registers the functions and commands in the file.

VBA Copy code Copy code
Application.RegisterXLL "XLMAPI.XLL"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Repeat Method (Excel)

 Copy code hover
[image]

Application.Repeat Method (Excel)
See also Send feedback

Published: July 16, 2012

Repeats the last user-interface action.

Syntax

expression .Repeat

expression A variable that represents an Application object.

Remarks

This method repeats only the last action taken by the user before running the macro, and it must be the first line in the macro. It cannot be used to repeat Visual Basic commands.

Example

This example repeats the last user-interface command. The example must be the first line in a macro.

VBA Copy code Copy code
Application.Repeat

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Run Method (Excel)

 Copy code hover
[image]

Application.Run Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs a macro or calls a function. This can be used to run a macro written in Visual Basic or the Microsoft Excel macro language, or to run a function in a DLL or XLL.

Syntax

expression .Run(Macro, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Macro | Optional | Variant | The macro to run. This can be either a string with the macro name, a Range object indicating where the function is, or a register ID for a registered DLL (XLL) function. If a string is used, the string will be evaluated in the context of the active sheet.
Arg1-Arg30 | Optional | Variant | An argument that should be passed to the function.

Return Value

Variant

Remarks

You cannot use named arguments with this method. Arguments must be passed by position.

The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SaveWorkspace Method (Excel)

 Copy code hover
[image]

Application.SaveWorkspace Method (Excel)
See also Send feedback

Published: July 16, 2012

This object, member, or enumeration is deprecated and is not intended to be used in your code.

Syntax

expression .SaveWorkspace(Filename)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Optional | Variant |

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SendKeys Method (Excel)

 Copy code hover
[image]

Application.SendKeys Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends keystrokes to the active application.

Syntax

expression .SendKeys(Keys, Wait)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Keys | Required | Variant | The key or key combination you want to send to the application, as text.
Wait | Optional | Variant | True to have Microsoft Excel wait for the keys to be processed before returning control to the macro. False (or omitted) to continue running the macro without waiting for the keys to be processed.

Remarks

This method places keystrokes in a key buffer. In some cases, you must call this method before you call the method that will use the keystrokes. For example, to send a password to a dialog box, you must call the SendKeys method before you display the dialog box.

The Keys argument can specify any single key or any key combined with ALT, CTRL, or SHIFT (or any combination of those keys). Each key is represented by one or more characters, such as "a" for the character a, or "{ENTER}" for the ENTER key.

To specify characters that aren't displayed when you press the corresponding key (for example, ENTER or TAB), use the codes listed in the following table. Each code in the table represents one key on the keyboard.

Key | Code
BACKSPACE | {BACKSPACE} or {BS}
BREAK | {BREAK}
CAPS LOCK | {CAPSLOCK}
CLEAR | {CLEAR}
DELETE or DEL | {DELETE} or {DEL}
DOWN ARROW | {DOWN}
END | {END}
ENTER (numeric keypad) | {ENTER}
ENTER | ~ (tilde)
ESC | {ESCAPE} or {ESC}
HELP | {HELP}
HOME | {HOME}
INS | {INSERT}
LEFT ARROW | {LEFT}
NUM LOCK | {NUMLOCK}
PAGE DOWN | {PGDN}
PAGE UP | {PGUP}
RETURN | {RETURN}
RIGHT ARROW | {RIGHT}
SCROLL LOCK | {SCROLLLOCK}
TAB | {TAB}
UP ARROW | {UP}
F1 through F15 | {F1} through {F15}

You can also specify keys combined with SHIFT and/or CTRL and/or ALT. To specify a key combined with another key or keys, use the following table.

To combine a key with | Precede the key code with
SHIFT | + (plus sign)
CTRL | ^ (caret)
ALT | % (percent sign)

Example

This example uses the SendKeys method to quit Microsoft Excel.

VBA Copy code Copy code
Application.SendKeys("%fx")

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SharePointVersion Method (Excel)

 Copy code hover
[image]

Application.SharePointVersion Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the version number of SharePoint Foundation instances running at site for the specified URL.

Version Information

Version Added: Excel 2007

Syntax

expression .SharePointVersion(bstrUrl)

expression A variable that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
bstrUrl | Required | String | The URL of site to check.

Return Value

Long

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Undo Method (Excel)

 Copy code hover
[image]

Application.Undo Method (Excel)
See also Send feedback

Published: July 16, 2012

Cancels the last user-interface action.

Syntax

expression .Undo

expression A variable that represents an Application object.

Remarks

This method undoes only the last action taken by the user before running the macro, and it must be the first line in the macro. It cannot be used to undo Visual Basic commands.

Example

This example cancels the last user-interface action. The example must be the first line in a macro.

VBA Copy code Copy code
Application.Undo

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Union Method (Excel)

 Copy code hover
[image]

Application.Union Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the union of two or more ranges.

Syntax

expression .Union(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | At least two Range objects must be specified.
Arg2 | Required | Range | At least two Range objects must be specified.
Arg3 | Optional | Variant | At least two Range objects must be specified.
Arg4 | Optional | Variant | At least two Range objects must be specified.
Arg5 | Optional | Variant | At least two Range objects must be specified.
Arg6 | Optional | Variant | At least two Range objects must be specified.
Arg7 | Optional | Variant | At least two Range objects must be specified.
Arg8 | Optional | Variant | At least two Range objects must be specified.
Arg9 | Optional | Variant | At least two Range objects must be specified.
Arg10 | Optional | Variant | At least two Range objects must be specified.
Arg11 | Optional | Variant | At least two Range objects must be specified.
Arg12 | Optional | Variant | At least two Range objects must be specified.
Arg13 | Optional | Variant | At least two Range objects must be specified.
Arg14 | Optional | Variant | At least two Range objects must be specified.
Arg15 | Optional | Variant | At least two Range objects must be specified.
Arg16 | Optional | Variant | At least two Range objects must be specified.
Arg17 | Optional | Variant | At least two Range objects must be specified.
Arg18 | Optional | Variant | At least two Range objects must be specified.
Arg19 | Optional | Variant | At least two Range objects must be specified.
Arg20 | Optional | Variant | At least two Range objects must be specified.
Arg21 | Optional | Variant | At least two Range objects must be specified.
Arg22 | Optional | Variant | At least two Range objects must be specified.
Arg23 | Optional | Variant | At least two Range objects must be specified.
Arg24 | Optional | Variant | At least two Range objects must be specified.
Arg25 | Optional | Variant | At least two Range objects must be specified.
Arg26 | Optional | Variant | At least two Range objects must be specified.
Arg27 | Optional | Variant | At least two Range objects must be specified.
Arg28 | Optional | Variant | At least two Range objects must be specified.
Arg29 | Optional | Variant | At least two Range objects must be specified.
Arg30 | Optional | Variant | At least two Range objects must be specified.

Return Value

Range

Example

This example fills the union of two named ranges, Range1 and Range2, with the formula =RAND().

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set bigRange = Application.Union(Range("Range1"), Range("Range2"))
bigRange.Formula = "=RAND()"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Volatile Method (Excel)

 Copy code hover
[image]

Application.Volatile Method (Excel)
See also Send feedback

Marks a user-defined function as volatile. A volatile function must be recalculated whenever calculation occurs in any cells on the worksheet. A nonvolatile function is recalculated only when the input variables change. This method has no effect if it's not inside a user-defined function used to calculate a worksheet cell.

Syntax

expression .Volatile(Volatile)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Volatile | Optional | Variant | True to mark the function as volatile. False to mark the function as nonvolatile. The default value is True

Example

This example marks the user-defined function "My_Func" as volatile. The function will be recalculated whenever calculation occurs in any cells on the worksheet on which this function appears.

VBA Copy code Copy code
Function My_Func()
 Application.Volatile
 '
 ' Remainder of the function
 ">
End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Wait Method (Excel)

 Copy code hover
[image]

Application.Wait Method (Excel)
See also Send feedback

Published: July 16, 2012

Pauses a running macro until a specified time. Returns True if the specified time has arrived.

Syntax

expression .Wait(Time)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Time | Required | Variant | The time at which you want the macro to resume, in Microsoft Excel date format.

Return Value

Boolean

Remarks

The Wait method suspends all Microsoft Excel activity and may prevent you from performing other operations on your computer while Wait is in effect. However, background processes such as printing and recalculation continue.

Example

This example pauses a running macro until 6:23 P.M. today.

VBA Copy code Copy code
Application.Wait "18:23:00"

This example pauses a running macro for approximately 10 seconds.

VBA Copy code Copy code
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

This example displays a message indicating whether 10 seconds have passed.

VBA Copy code Copy code
If Application.Wait(Now + TimeValue("0:00:10")) Then
 MsgBox "Time expired"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application Events (Excel)

 Copy code hover
[image]

Application Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterCalculate | The AfterCalculate event occurs when all pending refresh activity (both synchronous and asynchronous) and all of the resultant calculation activities have been completed.
NewWorkbook | Occurs when a new workbook is created.
ProtectedViewWindowActivate | Occurs when a Protected View window is activated.
ProtectedViewWindowBeforeClose | Occurs immediately before a Protected View window or a workbook in a Protected View window closes.
ProtectedViewWindowBeforeEdit | Occurs immediately before editing is enabled on the workbook in the specified Protected View window.
ProtectedViewWindowDeactivate | Occurs when a Protected View window is deactivated.
ProtectedViewWindowOpen | Occurs when a workbook is opened in a Protected View window.
ProtectedViewWindowResize | Occurs when any Protected View window is resized.
SheetActivate | Occurs when any sheet is activated.
SheetBeforeDelete |
SheetBeforeDoubleClick | Occurs when any worksheet is double-clicked, before the default double-click action.
SheetBeforeRightClick | Occurs when any worksheet is right-clicked, before the default right-click action.
SheetCalculate | Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.
SheetChange | Occurs when cells in any worksheet are changed by the user or by an external link.
SheetDeactivate | Occurs when any sheet is deactivated.
SheetFollowHyperlink | Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.
SheetLensGalleryRenderComplete | Occurs after a callout gallery's icons (dynamic & static) have finished rendering.
SheetPivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
SheetPivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
SheetPivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
SheetPivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
SheetPivotTableUpdate | Occurs after the sheet of the PivotTable report has been updated.
SheetSelectionChange | Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).
SheetTableUpdate | Occurs when a table on a worksheet is updated.
WindowActivate | Occurs when any workbook window is activated.
WindowDeactivate | Occurs when any workbook window is deactivated.
WindowResize | Occurs when any workbook window is resized.
WorkbookActivate | Occurs when any workbook is activated.
WorkbookAddinInstall | Occurs when a workbook is installed as an add-in.
WorkbookAddinUninstall | Occurs when any add-in workbook is uninstalled.
WorkbookAfterSave | Occurs after the workbook is saved.
WorkbookAfterXmlExport | Occurs after Microsoft Excel saves or exports XML data from the specified workbook.
WorkbookAfterXmlImport | Occurs after an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.
WorkbookBeforeClose | Occurs immediately before any open workbook closes.
WorkbookBeforePrint | Occurs before any open workbook is printed.
WorkbookBeforeSave | Occurs before any open workbook is saved.
WorkbookBeforeXmlExport | Occurs before Microsoft Excel saves or exports XML data from the specified workbook.
WorkbookBeforeXmlImport | Occurs before an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.
WorkbookDeactivate | Occurs when any open workbook is deactivated.
WorkbookModelChange | Occurs when the data model is updated.
WorkbookNewChart | Occurs when a new chart is created in any open workbook.
WorkbookNewSheet | Occurs when a new sheet is created in any open workbook.
WorkbookOpen | Occurs when a workbook is opened.
WorkbookPivotTableCloseConnection | Occurs after a PivotTable report connection has been closed.
WorkbookPivotTableOpenConnection | Occurs after a PivotTable report connection has been opened.
WorkbookRowsetComplete | The WorkbookRowsetComplete event occurs when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.
WorkbookSync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


Application.AfterCalculate Event (Excel)

 Copy code hover
[image]

Application.AfterCalculate Event (Excel)
See also Send feedback

Published: July 16, 2012

The AfterCalculate event occurs when all pending refresh activity (both synchronous and asynchronous) and all of the resultant calculation activities have been completed.

Version Information

Version Added: Excel 2007

Syntax

expression .AfterCalculate

expression A variable that represents an Application object.

Remarks

This event occurs whenever calculation is completed and there are no outstanding queries. It is mandatory for both conditions to be met before the event occurs. The event can be raised even when there is no sheet data in the workbook, such as whenever calculation finishes for the entire workbook and there are no queries running.

Add-in developers use the AfterCalculate event to know when all the data in the workbook has been fully updated by any queries and/or calculations that may have been in progress.

This event occurs after all Worksheet.Calculate, Chart.Calculate, AfterRefresh, and SheetChange events. It is the last event to occur after all refresh processing and all calc processing have completed, and it occurs after Application.CalculationState is set to xlDone.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NewWorkbook Event (Excel)

 Copy code hover
[image]

Application.NewWorkbook Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a new workbook is created.

Syntax

expression .NewWorkbook(Wb)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The new workbook.

Example

This example arranges open windows when a new workbook is created.

VBA Copy code Copy code
Private Sub App_NewWorkbook(ByVal Wb As Workbook)
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowActivate Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a Protected View window is activated.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowActivate(Pvw, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | The activated Protected View window.

Return Value

Nothing

Remarks

For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowBeforeClose Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowBeforeClose Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs immediately before a Protected View window or a workbook in a Protected View window closes.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowBeforeClose(Pvw, Reason, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | An object that represents the Protected View window that is closed.
Reason | Required | XlProtectedViewCloseReason | A constant that specifies the reason the Protected View window is closed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the window does not close when the procedure is finished.

Return Value

Nothing

Example

The following code example prompts the user for a yes or no response before closing the Protected View window. This code must be placed in a class module and an instance of that class must be correctly initialized. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowBeforeClose(ByVal Pvw as ProtectedViewWindow, _
 Reason as XlProtectedViewCloseReason, Cancel as Boolean)
 a = MsgBox("Do you really want to close the Protected View window?", _
 vbYesNo)
 If a = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowBeforeEdit Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowBeforeEdit Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs immediately before editing is enabled on the workbook in the specified Protected View window.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowBeforeEdit(Pvw, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | The Protected View window that contains the workbook that is enabled for editing.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, editing is not enabled on the workbook.

Return Value

Nothing

Example

The following code example prompts the user for a yes or no response before enabling editing on a workbook in a Protected View window. This code must be placed in a class module, and an instance of the class must be correctly initialized. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowBeforeEdit(ByVal Pvw As ProtectedViewWindow, Cancel As Boolean)
 Dim intResponse As Integer

 intResponse = MsgBox("Do you really " _
 & "want to edit the workbook?", _
 vbYesNo)

 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowDeactivate Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a Protected View window is deactivated.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowDeactivate(Pvw )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | An object that represents the deactivated Protected View window.

Return Value

Nothing

Example

The following code example minimizes any Protected View window when it is deactivated. This code must be placed in a class module and an instance of that class must be correctly initialized. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowDeactivate(ByVal Pvw As ProtectedViewWindow)
 Pvw.WindowState = xlProtectedViewWindowMinimized
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowOpen Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowOpen Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook is opened in a Protected View window.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowOpen(Pvw, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | An object that represents the Protected View window that is opened.

Return Value

Nothing

Example

The following code example informs the user that the workbook will be opened in a Protected View window. This code must be placed in a class module and an instance of that class must be correctly initialized. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowOpen(ByVal Pvw As ProtectedViewWindow)
 MsgBox "You are opening the following workbook in Protected View: " _
 & Pvw.Caption
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowResize Event (Excel)

 Copy code hover
[image]

Application.ProtectedViewWindowResize Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any Protected View window is resized.

Version Information

Version Added: Excel 2010

Syntax

expression .ProtectedViewWindowResize(Pvw, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pvw | Required | ProtectedViewWindow | An object that represents the resized Protected View window.

Return Value

Nothing

Remarks

For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetActivate Event (Excel)

 Copy code hover
[image]

Application.SheetActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any sheet is activated.

Syntax

expression .SheetActivate(Sh, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The activated sheet. Can be a Chart or Worksheet object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetBeforeDelete Event (Excel)

 Copy code hover
[image]

Application.SheetBeforeDelete Event (Excel)
See also Send feedback

Occurs before any sheet is deleted.

Syntax

expression .SheetBeforeDelete(Sh, )

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The sheet. Can be a Chart or Worksheet object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetBeforeDoubleClick Event (Excel)

 Copy code hover
[image]

Application.SheetBeforeDoubleClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any worksheet is double-clicked, before the default double-click action.

Syntax

expression .SheetBeforeDoubleClick(Sh, Target, Cancel)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The cell nearest to the mouse pointer when the double-click occurred.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default double-click action isn't performed when the procedure is finished.

Remarks

This event doesn't occur on chart sheets.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetBeforeRightClick Event (Excel)

 Copy code hover
[image]

Application.SheetBeforeRightClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any worksheet is right-clicked, before the default right-click action.

Syntax

expression .SheetBeforeRightClick(Sh, Target, Cancel)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The cell nearest to the mouse pointer when the right-click occurred.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default right-click action isn't performed when the procedure is finished.

Remarks

This event doesn't occur on chart sheets.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetCalculate Event (Excel)

 Copy code hover
[image]

Application.SheetCalculate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.

Syntax

expression .SheetCalculate(Sh, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | Can be a Chart or Worksheet object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetChange Event (Excel)

 Copy code hover
[image]

Application.SheetChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when cells in any worksheet are changed by the user or by an external link.

Syntax

expression .SheetChange(Sh, Target)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The changed range.

Remarks

This event doesn't occur on chart sheets.

Example

This example runs when any worksheet is changed.

VBA Copy code Copy code
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
 ByVal Source As Range)
 ' runs when a sheet is changed
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetDeactivate Event (Excel)

 Copy code hover
[image]

Application.SheetDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any sheet is deactivated.

Syntax

expression .SheetDeactivate(Sh, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The sheet. Can be a Chart or Worksheet object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetFollowHyperlink Event (Excel)

 Copy code hover
[image]

Application.SheetFollowHyperlink Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.

Syntax

expression .SheetFollowHyperlink(Sh, Target)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The Worksheet object that contains the hyperlink.
Target | Required | Hyperlink | The Hyperlink object that represents the destination of the hyperlink.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetLensGalleryRenderComplete Event (Excel)

 Copy code hover
[image]

Application.SheetLensGalleryRenderComplete Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a callout gallery's icons (dynamic & static) have finished rendering.

Version information

Version Added: Excel 2013

Syntax

expression .SheetLensGalleryRenderComplete(Sh)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data type | Description
Sh | Required | OBJECT | Name of a worksheet.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetPivotTableAfterValueChange Event (Excel)

 Copy code hover
[image]

Application.SheetPivotTableAfterValueChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableAfterValueChange(Sh, TargetPivotTable, TargetRange)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable
TargetPivotTable | Required | PivotTable | The PivotTable that contains the edited or recalculated cells.
TargetRange | Required | Range | The range that contains all the edited or recalcuated cells.

Return Value

Nothing

Remarks

The PivotTableAfterValueChange event does not occur under any conditions other than editing or recalculating cells. For example, it will not occur when the PivotTable is refreshed, sorted, filtered, or drilled down on, even though those operations move cells and potentially retrieve new values from the OLAP data source.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetPivotTableBeforeAllocateChanges Event (Excel)

 Copy code hover
[image]

Application.SheetPivotTableBeforeAllocateChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are applied to a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeAllocateChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to apply.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not applied to the PivotTable and all edits are lost.

Return Value

Nothing

Remarks

The SheetPivotTableBeforeAllocateChanges event occurs immediately before Excel executes an UPDATE CUBE statement to apply all changes to the PivotTable's OLAP data source, and immediately after the user has chosen to apply changes in the user interface.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetPivotTableBeforeCommitChanges Event (Excel)

 Copy code hover
[image]

Application.SheetPivotTableBeforeCommitChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are committed against the OLAP data source for a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeCommitChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to commit.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not committed against the OLAP data source of the PivotTable.

Return Value

Nothing

Remarks

The SheetPivotTableBeforeCommitChanges event occurs immediately before Excel executes a COMMIT TRANSACTION against the PivotTable's OLAP data source, and immediately after the user has chosen to save changes for the whole PivotTable.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetPivotTableBeforeDiscardChanges Event (Excel)

 Copy code hover
[image]

Application.SheetPivotTableBeforeDiscardChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes to a PivotTable are discarded.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeDiscardChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object |
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to discard.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.

Return Value

Nothing

Remarks

Occurs immediately before Excel executes a ROLLBACK TRANSACTION statement against the OLAP data source, if a transaction is still active, and then discards all edited values in the PivotTable, after the user has chosen to discard changes.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetPivotTableUpdate Event (Excel)

 Copy code hover
[image]

Application.SheetPivotTableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the sheet of the PivotTable report has been updated.

Syntax

expression .SheetPivotTableUpdate(Sh, Target)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The selected sheet.
Target | Required | PivotTable | The selected PivotTable report.

Example

This example displays a message stating that the sheet of the PivotTable report has been updated. This example assumes you have declared an object of type Application or Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_SheetPivotTableUpdate(ByVal shOne As Object, Target As PivotTable)

 MsgBox "The SheetPivotTable connection has been updated."

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetSelectionChange Event (Excel)

 Copy code hover
[image]

Application.SheetSelectionChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).

Syntax

expression .SheetSelectionChange(Sh, Target)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the new selection.
Target | Required | Range | The new selected range.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SheetTableUpdate Event (Excel)

 Copy code hover
[image]

Application.SheetTableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a table on a worksheet is updated.

Version information

Version Added: Excel 2013

Syntax

expression .SheetTableUpdate(Sh,Target)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data type | Description
Sh | Required | OBJECT | The worksheet.
Target | Required | TABLEOBJECT | The table.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowActivate Event (Excel)

 Copy code hover
[image]

Application.WindowActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is activated.

Syntax

expression .WindowActivate(Wb, Wn)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Window | The workbook displayed in the activated window.
Wn | Required | Window | The activated window.

Remarks

For information about how to use event procedures with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowDeactivate Event (Excel)

 Copy code hover
[image]

Application.WindowDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is deactivated.

Syntax

expression .WindowDeactivate(Wb, Wn)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook displayed in the deactivated window.
Wn | Required | Window | The deactivated window.

Example

This example minimizes any workbook window when it's deactivated.

VBA Copy code Copy code
Private Sub Workbook_WindowDeactivate(ByVal Wn As Excel.Window)
 Wn.WindowState = xlMinimized
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowResize Event (Excel)

 Copy code hover
[image]

Application.WindowResize Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is resized.

Syntax

expression .WindowResize(Wb, Wn)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Window | The workbook displayed in the resized window.
Wn | Required | Window | The resized window.

Remarks

For information about how to use event procedures with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookActivate Event (Excel)

 Copy code hover
[image]

Application.WorkbookActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook is activated.

Syntax

expression .WorkbookActivate(Wb)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The activated workbook.

Return Value

Nothing

Example

This example arranges open windows when a workbook is activated.

VBA Copy code Copy code
Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookAddinInstall Event (Excel)

 Copy code hover
[image]

Application.WorkbookAddinInstall Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook is installed as an add-in.

Syntax

expression .WorkbookAddinInstall(Wb)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The installed workbook.

Return Value

Nothing

Example

This example maximizes the Microsoft Excel window when a workbook is installed as an add-in.

VBA Copy code Copy code
Private Sub App_WorkbookAddinInstall(ByVal Wb As Workbook)
 Application.WindowState = xlMaximized
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookAddinUninstall Event (Excel)

 Copy code hover
[image]

Application.WorkbookAddinUninstall Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any add-in workbook is uninstalled.

Syntax

expression .WorkbookAddinUninstall(Wb)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The uninstalled workbook.

Return Value

Nothing

Example

This example minimizes the Microsoft Excel window when a workbook is installed as an add-in.

VBA Copy code Copy code
Private Sub App_WorkbookAddinUninstall(ByVal Wb As Workbook)
 Application.WindowState = xlMinimized
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookAfterSave Event (Excel)

 Copy code hover
[image]

Application.WorkbookAfterSave Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the workbook is saved.

Version Information

Version Added: Excel 2010

Syntax

expression .WorkbookAfterSave(Wb, Success)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook being saved.
Success | Required | Boolean | Returns True if the save operation was successful; otherwise False.

Return Value

Nothing

Example

The following code example displays a message box if the workbook was successfully saved. This code must be placed in a class module and an instance of that class must be correctly initialized. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_WorkbookAfterSave(ByVal Wb As Workbook, _
 ByVal Success As Boolean)
If Success Then
 MsgBox ("The " & Wb.Name & " workbook was successfully saved.")
End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookAfterXmlExport Event (Excel)

 Copy code hover
[image]

Application.WorkbookAfterXmlExport Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after Microsoft Excel saves or exports XML data from the specified workbook.

Syntax

expression .WorkbookAfterXmlExport(Wb, Map, Url, Result)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The target workbook.
Map | Required | XmlMap | The XML map that was used to save or export data.
Url | Required | String | The location of the XML file that was exported.
Result | Required | XlXmlExportResult | Indicates the results of the save or export operation.

Return Value

Nothing

Remarks

XlXmlExportResult can be one of the following XlXmlExportResult constants

xlXmlExportSuccess . The XML data file was successfully exported.

xlXmlExportValidationFailed. The contents of the XML data file do not match the specified schema map.

Use the AfterXmlExport event if you want to perform an operation after XML data has been exported from a particular workbook.

See also

Concepts

Workbook Object
Application Object

Other resources

Workbook Object Members
Application Object Members


Application.WorkbookAfterXmlImport Event (Excel)

 Copy code hover
[image]

Application.WorkbookAfterXmlImport Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.

Syntax

expression .WorkbookAfterXmlImport(Wb, Map, IsRefresh, Result)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The target workbook.
Map | Required | XmlMap | The XML map that was used to import data.
IsRefresh | Required | Boolean | True if the event was triggered by refreshing an existing connection to XML data, False if a new mapping was created.
Result | Required | XlXmlImportResult | Indicates the results of the refresh or import operation.

Return Value

Nothing

Remarks

XlXmlImportResult can be one of the following XlXmlImportResult constants

xlXmlImportElementsTruncated. The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess. The XML data file was successfully imported.

xlXmlImportValidationFailed. The contents of the XML data file do not match the specified schema map.

Use the AfterXmlImport event if you want to perform an operation after XML data has been imported into a particular workbook.

See also

Concepts

Workbook Object
Application Object

Other resources

Workbook Object Members
Application Object Members


Application.WorkbookBeforeClose Event (Excel)

 Copy code hover
[image]

Application.WorkbookBeforeClose Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs immediately before any open workbook closes.

Syntax

expression .WorkbookBeforeClose(Wb, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook that's being closed
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the workbook doesn't close when the procedure is finished.

Return Value

Nothing

Example

This example prompts the user for a yes or no response before closing any workbook. For more information about how to use event procedures with the Application object, see Using Events with the Application Object.

VBA Copy code Copy code
Private Sub App_WorkbookBeforeClose(ByVal Wb as Workbook, _
 Cancel as Boolean)
 a = MsgBox("Do you really want to close the workbook?", _
 vbYesNo)
 If a = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookBeforePrint Event (Excel)

 Copy code hover
[image]

Application.WorkbookBeforePrint Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before any open workbook is printed.

Syntax

expression .WorkbookBeforePrint(Wb, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the workbook isn't printed when the procedure is finished.

Return Value

Nothing

Example

This example recalculates all worksheets in the workbook before printing anything.

VBA Copy code Copy code
Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, _
 Cancel As Boolean)
 For Each wk in Wb.Worksheets
 wk.Calculate
 Next
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookBeforeSave Event (Excel)

 Copy code hover
[image]

Application.WorkbookBeforeSave Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before any open workbook is saved.

Syntax

expression .WorkbookBeforeSave(Wb, SaveAsUI, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.
SaveAsUI | Required | Boolean | True if the Save As dialog box will be displayed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the workbook isn't saved when the procedure is finished.

Return Value

Nothing

Example

This example prompts the user for a yes or no response before saving any workbook.

VBA Copy code Copy code
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, _
 ByVal SaveAsUI As Boolean, Cancel as Boolean)
 a = MsgBox("Do you really want to save the workbook?", vbYesNo)
 If a = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookBeforeXmlExport Event (Excel)

 Copy code hover
[image]

Application.WorkbookBeforeXmlExport Event (Excel)
See also Send feedback

Occurs before Microsoft Excel saves or exports XML data from the specified workbook.

Syntax

expression .WorkbookBeforeXmlExport(Wb, Map, Url, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The target workbook.
Map | Required | XmlMap | The XML map that will be used to save or export data.
Url | Required | String | The location of the XML file to be exported.
Cancel | Required | Boolean | Set to True to cancel the save or export operation.

Return Value

Nothing

Remarks

Use the BeforeXmlExport event if you want to capture XML data that is being exported or saved from a particular workbook.

See also

Concepts

Workbook Object
Application Object

Other resources

Workbook Object Members
Application Object Members


Application.WorkbookBeforeXmlImport Event (Excel)

 Copy code hover
[image]

Application.WorkbookBeforeXmlImport Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before an existing XML data connection is refreshed, or new XML data is imported into any open Microsoft Excel workbook.

Syntax

expression .WorkbookBeforeXmlImport(Wb, Map, Url, IsRefresh, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The target workbook.
Map | Required | XmlMap | The XML map that will be used to import data.
Url | Required | String | The location of the XML file to be imported.
IsRefresh | Required | Boolean | True if the event was triggered by refreshing an existing connection to XML data, False if a new mapping will be created.
Cancel | Required | Boolean | Set to True to cancel the import or refresh operation.

Return Value

Nothing

Remarks

Use the BeforeXmlImport event if you want to capture XML data that is being imported or refreshed to a particular workbook.

See also

Concepts

Workbook Object
Application Object

Other resources

Application Object Members
Workbook Object Members


Application.WorkbookDeactivate Event (Excel)

 Copy code hover
[image]

Application.WorkbookDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any open workbook is deactivated.

Syntax

expression .WorkbookDeactivate(Wb)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.

Return Value

Nothing

Example

This example arranges all open windows when a workbook is deactivated.

VBA Copy code Copy code
Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookModelChange Event (Excel)

 Copy code hover
[image]

Application.WorkbookModelChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the data model is updated.

Version information

Version Added: Excel 2013

Syntax

expression .WorkbookModelChange(Wb,Changes)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data type | Description
Wb | Required | WORKBOOK | The workbook
Changes | Required | MODELCHANGES | The changes to the data model.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookNewChart Event (Excel)

 Copy code hover
[image]

Application.WorkbookNewChart Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a new chart is created in any open workbook.

Version Information

Version Added: Excel 2010

Syntax

expression .WorkbookNewChart(Wb, Ch)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.
Ch | Required | Chart | The new chart.

Return Value

Nothing

Remarks

The WorkbookNewChart event occurs when a new chart is inserted or pasted in a worksheet, a chart sheet, or other sheet types. If multiple charts are inserted or pasted, the event will occur for each chart in the order they are inserted or pasted. If a chart object or chart sheet is moved from one location to another, the event will not occur. However, if the chart is moved between a chart object and a chart sheet, the event will occur because a new chart must be created.

The WorkbookNewChart event will not occur in the following scenarios: copying or pasting a chart sheet, changing a chart type, changing a chart data source, undoing or redoing inserting or pasting a chart, and loading a workbook that contains a chart.

Example

The following code example displays a message box when a new chart is added to a workbook.

VBA Copy code Copy code
Private Sub App_NewChart(ByVal Wb As Workbook, _
 ByVal Ch As Chart)
 MsgBox ("A new chart was added to: " & Wb.Name & " of type: " & Ch.Type)
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookNewSheet Event (Excel)

 Copy code hover
[image]

Application.WorkbookNewSheet Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a new sheet is created in any open workbook.

Syntax

expression .WorkbookNewSheet(Wb, Sh)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.
Sh | Required | Object | The new sheet.

Return Value

Nothing

Example

This example moves the new sheet to the end of the workbook.

VBA Copy code Copy code
Private Sub App_WorkbookNewSheet(ByVal Wb As Workbook, _
 ByVal Sh As Object)
 Sh.Move After:=Wb.Sheets(Wb.Sheets.Count)
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookOpen Event (Excel)

 Copy code hover
[image]

Application.WorkbookOpen Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook is opened.

Syntax

expression .WorkbookOpen(Wb)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook.

Return Value

Nothing

Example

This example arranges all open windows when a workbook is opened.

VBA Copy code Copy code
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookPivotTableCloseConnection Event (Excel)

 Copy code hover
[image]

Application.WorkbookPivotTableCloseConnection Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a PivotTable report connection has been closed.

Syntax

expression .WorkbookPivotTableCloseConnection(Wb, Target)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The selected workbook.
Target | Required | PivotTable | The selected PivotTable report.

Return Value

Nothing

Example

This example displays a message stating that the PivotTable report's connection to its source has been closed. This example assumes you have declared an object of type Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_WorkbookPivotTableCloseConnection(ByVal wbOne As Workbook, Target As PivotTable)

 MsgBox "The PivotTable connection has been closed."

End Sub

See also

Concepts

Application Object
Workbook Object

Other resources

Workbook Object Members
Application Object Members


Application.WorkbookPivotTableOpenConnection Event (Excel)

 Copy code hover
[image]

Application.WorkbookPivotTableOpenConnection Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a PivotTable report connection has been opened.

Syntax

expression .WorkbookPivotTableOpenConnection(Wb, Target)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The selected workbook.
Target | Required | PivotTable | The selected PivotTable report.

Return Value

Nothing

Example

This example displays a message stating that the PivotTable report's connection to its source has been opened. This example assumes you have declared an object of type Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_WorkbookPivotTableOpenConnection(ByVal wbOne As Workbook, Target As PivotTable)

 MsgBox "The PivotTable connection has been opened."

End Sub

See also

Concepts

Application Object
Workbook Object

Other resources

Application Object Members
Workbook Object Members


Application.WorkbookRowsetComplete Event (Excel)

 Copy code hover
[image]

Application.WorkbookRowsetComplete Event (Excel)
See also Send feedback

Published: July 16, 2012

The WorkbookRowsetComplete event occurs when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .WorkbookRowsetComplete(Wb, Description, Sheet, Success)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wb | Required | Workbook | The workbook for which the event occurs.
Description | Required | String | A brief description of the event.
Sheet | Required | String | The worksheet on which the recordset is created.
Success | Required | Boolean | Contains a Boolean value to indicate success or failure.

Remarks

Because the recordset is created asynchronously, the event allows automation to determine when the action has been completed. Additionally, because the recordset is created on a separate sheet, the event needs to be on the workbook level.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WorkbookSync Event (Excel)

 Copy code hover
[image]

Application.WorkbookSync Event (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

Workbook Object
Application Object

Other resources

Workbook Object Members
Application Object Members


Areas Object (Excel)

 Copy code hover
[image]

Areas Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of the areas, or contiguous blocks of cells, within a selection.

Remarks

There's no singular Area object; individual members of the Areas collection are Range objects. The Areas collection contains one Range object for each discrete, contiguous range of cells within the selection. If the selection contains only one area, the Areas collection contains a single Range object that corresponds to that selection.

Example

Use the Areas property to return the Areas collection. The following example clears the current selection if it contains more than one area.

VBA Copy code Copy code
If Selection.Areas.Count <> 1 Then Selection.Clear

Use Areas(index), where index is the area index number, to return a single Range object from the collection. The index numbers correspond to the order in which the areas were selected. The following example clears the first area in the current selection if the selection contains more than one area.

VBA Copy code Copy code
If Selection.Areas.Count <> 1 Then
 Selection.Areas(1).Clear
End If

Some operations cannot be performed on more than one area in a selection at the same time; you must loop through the individual areas in the selection and perform the operations on each area separately. The following example performs the operation named "myOperation" on the selected range if the selection contains only one area; if the selection contains multiple areas, the example performs myOperation on each individual area in the selection.

VBA Copy code Copy code
Set rangeToUse = Selection
If rangeToUse.Areas.Count = 1 Then
 myOperation rangeToUse
Else
 For Each singleArea in rangeToUse.Areas
 myOperation singleArea
 Next
End If

See also

Concepts

Excel Object Model Reference

Other resources

Areas Object Members


Areas Members (Excel)

 Copy code hover
[image]

Areas Members (Excel)
Send feedback

Published: July 16, 2012

A collection of the areas, or contiguous blocks of cells, within a selection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Areas Properties (Excel)

 Copy code hover
[image]

Areas Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Areas.Application Property (Excel)

 Copy code hover
[image]

Areas.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Areas object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Areas Collection

Other resources

Areas Object Members


Areas.Count Property (Excel)

 Copy code hover
[image]

Areas.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an Areas object.

Example

This example displays the number of columns in the selection on Sheet1. The code also tests for a multiple-area selection; if one exists, the code loops on the areas of the multiple-area selection.

VBA Copy code Copy code
Sub DisplayColumnCount()
 Dim iAreaCount As Integer
 Dim i As Integer

 Worksheets("Sheet1").Activate
 iAreaCount = Selection.Areas.Count

 If iAreaCount <= 1 Then
 MsgBox "The selection contains " & Selection.Columns.Count & " columns."
 Else
 For i = 1 To iAreaCount
 MsgBox "Area " & i & " of the selection contains " & _
 Selection.Areas(i).Columns.Count & " columns."
 Next i
 End If
End Sub

See also

Concepts

Areas Collection

Other resources

Areas Object Members


Areas.Creator Property (Excel)

 Copy code hover
[image]

Areas.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Areas object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Areas Collection

Other resources

Areas Object Members


Areas.Item Property (Excel)

 Copy code hover
[image]

Areas.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an Areas object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example clears the first area in the current selection if the selection contains more than one area.

VBA Copy code Copy code
If Selection.Areas.Count <> 1 Then
 Selection.Areas.Item(1).Clear
End If

See also

Concepts

Areas Collection

Other resources

Areas Object Members


Areas.Parent Property (Excel)

 Copy code hover
[image]

Areas.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Areas object.

See also

Concepts

Areas Collection

Other resources

Areas Object Members


AutoCorrect Object (Excel)

 Copy code hover
[image]

AutoCorrect Object (Excel)
See also Send feedback

Contains Microsoft Excel AutoCorrect attributes (capitalization of names of days, correction of two initial capital letters, automatic correction list, and so on).

Example

Use the AutoCorrect property to return the AutoCorrect object. The following example sets Microsoft Excel to correct words that begin with two initial capital letters.

VBA Copy code Copy code
With Application.AutoCorrect
 .TwoInitialCapitals = True
 .ReplaceText = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

AutoCorrect Object Members


AutoCorrect Members (Excel)

 Copy code hover
[image]

AutoCorrect Members (Excel)
Send feedback

Published: July 16, 2012

Contains Microsoft Excel AutoCorrect attributes (capitalization of names of days, correction of two initial capital letters, automatic correction list, and so on).

Methods

Name | Description
AddReplacement | Adds an entry to the array of AutoCorrect replacements.
DeleteReplacement | Deletes an entry from the array of AutoCorrect replacements.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoExpandListRange | A Boolean value indicating whether automatic expansion is enabled for lists. When you type in a cell of an empty row or column next to a list, the list will expand to include that row or column if automatic expansion is enabled. Read/write Boolean.
AutoFillFormulasInLists | Affects the creation of calculated columns created by automatic fill-down lists. Read/write Boolean.
CapitalizeNamesOfDays | True if the first letter of day names is capitalized automatically. Read/write Boolean.
CorrectCapsLock | True if Microsoft Excel automatically corrects accidental use of the CAPS LOCK key. Read/write Boolean.
CorrectSentenceCap | True if Microsoft Excel automatically corrects sentence (first word) capitalization. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayAutoCorrectOptions | Allows the user to display or hide the AutoCorrect Options button. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
ReplacementList | Returns the array of AutoCorrect replacements.
ReplaceText | True if text in the list of AutoCorrect replacements is replaced automatically. Read/write Boolean.
TwoInitialCapitals | True if words that begin with two capital letters are corrected automatically. Read/write Boolean.


AutoCorrect Properties (Excel)

 Copy code hover
[image]

AutoCorrect Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoExpandListRange | A Boolean value indicating whether automatic expansion is enabled for lists. When you type in a cell of an empty row or column next to a list, the list will expand to include that row or column if automatic expansion is enabled. Read/write Boolean.
AutoFillFormulasInLists | Affects the creation of calculated columns created by automatic fill-down lists. Read/write Boolean.
CapitalizeNamesOfDays | True if the first letter of day names is capitalized automatically. Read/write Boolean.
CorrectCapsLock | True if Microsoft Excel automatically corrects accidental use of the CAPS LOCK key. Read/write Boolean.
CorrectSentenceCap | True if Microsoft Excel automatically corrects sentence (first word) capitalization. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayAutoCorrectOptions | Allows the user to display or hide the AutoCorrect Options button. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
ReplacementList | Returns the array of AutoCorrect replacements.
ReplaceText | True if text in the list of AutoCorrect replacements is replaced automatically. Read/write Boolean.
TwoInitialCapitals | True if words that begin with two capital letters are corrected automatically. Read/write Boolean.


AutoCorrect.Application Property (Excel)

 Copy code hover
[image]

AutoCorrect.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AutoCorrect object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.AutoExpandListRange Property (Excel)

 Copy code hover
[image]

AutoCorrect.AutoExpandListRange Property (Excel)
See also Send feedback

Published: July 16, 2012

A Boolean value indicating whether automatic expansion is enabled for lists. When you type in a cell of an empty row or column next to a list, the list will expand to include that row or column if automatic expansion is enabled. Read/write Boolean.

Syntax

expression .AutoExpandListRange

expression A variable that represents an AutoCorrect object.

Example

The following example enables automatic expansion of lists when typing in adjacent rows or columns.

VBA Copy code Copy code
Sub SetAutoExpand

 Application.AutoCorrect.AutoExpandListRange = TRUE

End Sub

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.AutoFillFormulasInLists Property (Excel)

 Copy code hover
[image]

AutoCorrect.AutoFillFormulasInLists Property (Excel)
See also Send feedback

Published: July 16, 2012

Affects the creation of calculated columns created by automatic fill-down lists. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoFillFormulasInLists

expression A variable that represents an AutoCorrect object.

Remarks

The property does not affect existing calculated columns or calculated columns created where auto-fill did not occur.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CapitalizeNamesOfDays Property (Excel)

 Copy code hover
[image]

AutoCorrect.CapitalizeNamesOfDays Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the first letter of day names is capitalized automatically. Read/write Boolean.

Syntax

expression .CapitalizeNamesOfDays

expression A variable that represents an AutoCorrect object.

Example

This example sets Microsoft Excel to capitalize the first letter of the names of days.

VBA Copy code Copy code
With Application.AutoCorrect
 .CapitalizeNamesOfDays = True
 .ReplaceText = True
End With

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectCapsLock Property (Excel)

 Copy code hover
[image]

AutoCorrect.CorrectCapsLock Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel automatically corrects accidental use of the CAPS LOCK key. Read/write Boolean.

Syntax

expression .CorrectCapsLock

expression A variable that represents an AutoCorrect object.

Example

This example enables Microsoft Excel to automatically correct accidental use of the CAPS LOCK key.

VBA Copy code Copy code
Application.AutoCorrect.CorrectCapsLock = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectSentenceCap Property (Excel)

 Copy code hover
[image]

AutoCorrect.CorrectSentenceCap Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel automatically corrects sentence (first word) capitalization. Read/write Boolean.

Syntax

expression .CorrectSentenceCap

expression A variable that represents an AutoCorrect object.

Example

This example enables Microsoft Excel to automatically correct sentence capitalization.

VBA Copy code Copy code
Application.AutoCorrect.CorrectSentenceCap = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.Creator Property (Excel)

 Copy code hover
[image]

AutoCorrect.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCorrect object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.DisplayAutoCorrectOptions Property (Excel)

 Copy code hover
[image]

AutoCorrect.DisplayAutoCorrectOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows the user to display or hide the AutoCorrect Options button. The default value is True. Read/write Boolean.

Syntax

expression .DisplayAutoCorrectOptions

expression A variable that represents an AutoCorrect object.

Remarks

The DisplayAutoCorrectOptions property is a Microsoft Office-wide setting. Changing this property in Microsoft Excel will affect the other Office applications also.

In Excel the AutoCorrect Options button only appears when a hyperlink is automatically created.

Example

This example determines if the AutoCorrect Options button can be displayed and notifies the user.

VBA Copy code Copy code
Sub CheckDisplaySetting()

 'Determine setting and notify user.
 If Application.AutoCorrect.DisplayAutoCorrectOptions = True Then
 MsgBox "The AutoCorrect Options button can be displayed."
 Else
 MsgBox "The AutoCorrect Options button cannot be displayed."
 End If

End Sub

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.Parent Property (Excel)

 Copy code hover
[image]

AutoCorrect.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AutoCorrect object.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.ReplacementList Property (Excel)

 Copy code hover
[image]

AutoCorrect.ReplacementList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the array of AutoCorrect replacements.

Syntax

expression .ReplacementList(Index)

expression A variable that represents an AutoCorrect object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The row index of the array of AutoCorrect replacements to be returned. The row is returned as a one-dimensional array with two elements: The first element is the text in column 1, and the second element is the text in column 2.

Remarks

If Index is not specified, this method returns a two-dimensional array. Each row in the array contains one replacement, as shown in the following table.

Column | Contents
1 | The text to be replaced
2 | The replacement text

Use the AddReplacement method to add an entry to the replacement list.

Example

This example searches the replacement list for "Temperature" and displays the replacement entry if it exists.

VBA Copy code Copy code
repl = Application.AutoCorrect.ReplacementList
For x = 1 To UBound(repl)
 If repl(x, 1) = "Temperature" Then MsgBox repl(x, 2)
Next

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.ReplaceText Property (Excel)

 Copy code hover
[image]

AutoCorrect.ReplaceText Property (Excel)
See also Send feedback

Published: July 16, 2012

True if text in the list of AutoCorrect replacements is replaced automatically. Read/write Boolean.

Syntax

expression .ReplaceText

expression A variable that represents an AutoCorrect object.

Example

This example turns off automatic text replacement.

VBA Copy code Copy code
With Application.AutoCorrect
 .CapitalizeNamesOfDays = True
 .ReplaceText = False
End With

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.TwoInitialCapitals Property (Excel)

 Copy code hover
[image]

AutoCorrect.TwoInitialCapitals Property (Excel)
See also Send feedback

Published: July 16, 2012

True if words that begin with two capital letters are corrected automatically. Read/write Boolean.

Syntax

expression .TwoInitialCapitals

expression A variable that represents an AutoCorrect object.

Example

This example sets Microsoft Excel to correct words that begin with two capital letters.

VBA Copy code Copy code
With Application.AutoCorrect
 .TwoInitialCapitals = True
 .ReplaceText = True
End With

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect Methods (Excel)

 Copy code hover
[image]

AutoCorrect Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddReplacement | Adds an entry to the array of AutoCorrect replacements.
DeleteReplacement | Deletes an entry from the array of AutoCorrect replacements.


AutoCorrect.AddReplacement Method (Excel)

 Copy code hover
[image]

AutoCorrect.AddReplacement Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds an entry to the array of AutoCorrect replacements.

Syntax

expression .AddReplacement(What, Replacement)

expression A variable that represents an AutoCorrect object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | String | The text to be replaced. If this string already exists in the array of AutoCorrect replacements, the existing substitute text is replaced by the new text.
Replacement | Required | String | The replacement text.

Return Value

Variant

Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

VBA Copy code Copy code
With Application.AutoCorrect
 .AddReplacement "Temperature", "Temp."
End With

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.DeleteReplacement Method (Excel)

 Copy code hover
[image]

AutoCorrect.DeleteReplacement Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes an entry from the array of AutoCorrect replacements.

Syntax

expression .DeleteReplacement(What)

expression A variable that represents an AutoCorrect object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | String | The text to be replaced, as it appears in the row to be deleted from the array of AutoCorrect replacements. If this string doesn't exist in the array of AutoCorrect replacements, this method fails.

Return Value

Variant

Example

This example removes the word "Temperature" from the array of AutoCorrect replacements.

VBA Copy code Copy code
With Application.AutoCorrect
 .DeleteReplacement "Temperature"
End With

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoFilter Object (Excel)

 Copy code hover
[image]

AutoFilter Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents autofiltering for the specified worksheet.

Note Note

When using AutoFilter with dates, the format should be consistent with English date separators ("/") instead of local settings ("."). A valid date would be "2/2/2007", whereas "2.2.2007" is invalid.

Example

Use the AutoFilter property to return the AutoFilter object. Use the Filters property to return a collection of individual column filters. Use the Range property to return the Range object that represents the entire filtered range. The following example stores the address and filtering criteria for the current filtering and then applies new filters.

VBA Copy code Copy code
Dim w As Worksheet
Dim filterArray()
Dim currentFiltRange As String

Sub ChangeFilters()

Set w = Worksheets("Crew")
With w.AutoFilter
 currentFiltRange = .Range.Address
 With .Filters
 ReDim filterArray(1 To .Count, 1 To 3)
 For f = 1 To .Count
 With .Item(f)
 If .On Then
 filterArray(f, 1) = .Criteria1
 If .Operator Then
 filterArray(f, 2) = .Operator
 filterArray(f, 3) = .Criteria2
 End If
 End If
 End With
 Next
 End With
End With

w.AutoFilterMode = False
w.Range("A1").AutoFilter field:=1, Criteria1:="S"

End Sub

To create an AutoFilter object for a worksheet, you must turn autofiltering on for a range on the worksheet either manually or using the AutoFilter method of the Range object. The following example uses the values stored in module-level variables in the previous example to restore the original autofiltering to the Crew worksheet.

VBA Copy code Copy code
Sub RestoreFilters()
Set w = Worksheets("Crew")
w.AutoFilterMode = False
For col = 1 To UBound(filterArray(), 1)
 If Not IsEmpty(filterArray(col, 1)) Then
 If filterArray(col, 2) Then
 w.Range(currentFiltRange).AutoFilter field:=col, _
 Criteria1:=filterArray(col, 1), _
 Operator:=filterArray(col, 2), _
 Criteria2:=filterArray(col, 3)
 Else
 w.Range(currentFiltRange).AutoFilter field:=col, _
 Criteria1:=filterArray(col, 1)
 End If
 End If
Next
End Sub
Note Note

When using AutoFilter with dates, the format should be consistent with English date separators ("/") instead of local settings ("."). A valid date would be "2/2/2007", whereas "2.2.2007" is invalid.

See also

Concepts

Excel Object Model Reference

Other resources

AutoFilter Object Members


AutoFilter Members (Excel)

 Copy code hover
[image]

AutoFilter Members (Excel)
Send feedback

Published: July 16, 2012

Represents autofiltering for the specified worksheet.

Methods

Name | Description
ApplyFilter | Applies the specified Autofilter object.
ShowAllData | Displays all the data returned by the AutoFilter object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FilterMode | Returns True if the worksheet is in the AutoFilter filter mode. Read-only Boolean.
Filters | Returns a Filters collection that represents all the filters in an autofiltered range. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified AutoFilter applies.
Sort | Gets the sort column or columns, and sort order for the AutoFilter collection.


AutoFilter Properties (Excel)

 Copy code hover
[image]

AutoFilter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FilterMode | Returns True if the worksheet is in the AutoFilter filter mode. Read-only Boolean.
Filters | Returns a Filters collection that represents all the filters in an autofiltered range. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified AutoFilter applies.
Sort | Gets the sort column or columns, and sort order for the AutoFilter collection.


AutoFilter.Application Property (Excel)

 Copy code hover
[image]

AutoFilter.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AutoFilter object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.Creator Property (Excel)

 Copy code hover
[image]

AutoFilter.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoFilter object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.FilterMode Property (Excel)

 Copy code hover
[image]

AutoFilter.FilterMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the worksheet is in the AutoFilter filter mode. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .FilterMode

expression A variable that represents an AutoFilter object.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.Filters Property (Excel)

 Copy code hover
[image]

AutoFilter.Filters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Filters collection that represents all the filters in an autofiltered range. Read-only.

Syntax

expression .Filters

expression A variable that represents an AutoFilter object.

Example

The following example sets a variable to the value of the Criteria1 property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
With Worksheets("Crew")
 If .AutoFilterMode Then
 With .AutoFilter.Filters(1)
 If .On Then c1 = .Criteria1
 End With
 End If
End With

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.Parent Property (Excel)

 Copy code hover
[image]

AutoFilter.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AutoFilter object.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.Range Property (Excel)

 Copy code hover
[image]

AutoFilter.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range to which the specified AutoFilter applies.

Syntax

expression .Range

expression A variable that represents an AutoFilter object.

Example

The following example stores in a variable the address for the AutoFilter applied to the Crew worksheet.

VBA Copy code Copy code
rAddress = Worksheets("Crew").AutoFilter.Range.Address

This example scrolls through the workbook window until the hyperlink range is in the upper-left corner of the active window.

VBA Copy code Copy code
Workbooks(1).Activate
Set hr = ActiveSheet.Hyperlinks(1).Range
ActiveWindow.ScrollRow = hr.Row
ActiveWindow.ScrollColumn = hr.Column

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.Sort Property (Excel)

 Copy code hover
[image]

AutoFilter.Sort Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets the sort column or columns, and sort order for the AutoFilter collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Sort

expression A variable that represents an AutoFilter object.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter Methods (Excel)

 Copy code hover
[image]

AutoFilter Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyFilter | Applies the specified Autofilter object.
ShowAllData | Displays all the data returned by the AutoFilter object.


AutoFilter.ApplyFilter Method (Excel)

 Copy code hover
[image]

AutoFilter.ApplyFilter Method (Excel)
See also Send feedback

Applies the specified Autofilter object.

Version Information

Version Added: Excel 2007

Syntax

expression .ApplyFilter

expression A variable that represents an AutoFilter object.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoFilter.ShowAllData Method (Excel)

 Copy code hover
[image]

AutoFilter.ShowAllData Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays all the data returned by the AutoFilter object.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowAllData

expression A variable that represents an AutoFilter object.

See also

Concepts

AutoFilter Object

Other resources

AutoFilter Object Members


AutoRecover Object (Excel)

 Copy code hover
[image]

AutoRecover Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the automatic recovery features of a workbook.

Remarks

Properties for the AutoRecover object determine the path and time interval for backing up all files.

Use the AutoRecover property of the Application object to return an AutoRecover object.

Use the Path property of the AutoRecover object to set the path for where the AutoRecover file will be saved.

Example

The following example sets the path of the AutoRecover file to drive C.

VBA Copy code Copy code
Sub SetPath()

 Application.AutoRecover.Path = "C:\"

End Sub

Use the Time property of the AutoRecover object to set the time interval for backing up all files.

Note Note

Units for the Time property are in minutes.

VBA Copy code Copy code
Sub SetTime()

 Application.AutoRecover.Time = 5

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

AutoRecover Object Members


AutoRecover Members (Excel)

 Copy code hover
[image]

AutoRecover Members (Excel)
Send feedback

Represents the automatic recovery features of a workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns or sets a String value that represents the complete path to where Microsoft Excel will store the AutoRecover temporary files.
Time | Sets or returns the time interval for the AutoRecover object. Permissible values are integers from 1 to 120 minutes. The default value is 10 minutes. Read/write Long.


AutoRecover Properties (Excel)

 Copy code hover
[image]

AutoRecover Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns or sets a String value that represents the complete path to where Microsoft Excel will store the AutoRecover temporary files.
Time | Sets or returns the time interval for the AutoRecover object. Permissible values are integers from 1 to 120 minutes. The default value is 10 minutes. Read/write Long.


AutoRecover.Application Property (Excel)

 Copy code hover
[image]

AutoRecover.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AutoRecover object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


AutoRecover.Creator Property (Excel)

 Copy code hover
[image]

AutoRecover.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoRecover object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


AutoRecover.Enabled Property (Excel)

 Copy code hover
[image]

AutoRecover.Enabled Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object is enabled. Read/write Boolean.

Syntax

expression .Enabled

expression A variable that represents an AutoRecover object.

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


AutoRecover.Parent Property (Excel)

 Copy code hover
[image]

AutoRecover.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AutoRecover object.

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


AutoRecover.Path Property (Excel)

 Copy code hover
[image]

AutoRecover.Path Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the complete path to where Microsoft Excel will store the AutoRecover temporary files.

Syntax

expression .Path

expression A variable that represents an AutoRecover object.

Example

This example sets the path of the AutoRecover file to drive C.

VBA Copy code Copy code
Sub SetPath()

 Application.AutoRecover.Path = "C:\"

End Sub

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


AutoRecover.Time Property (Excel)

 Copy code hover
[image]

AutoRecover.Time Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns the time interval for the AutoRecover object. Permissible values are integers from 1 to 120 minutes. The default value is 10 minutes. Read/write Long.

Syntax

expression .Time

expression A variable that represents an AutoRecover object.

Remarks

Entering a decimal value will round to the nearest whole number. For example, entering a value of 5.5 is the equivalent of 6.

If time values outside the valid range are entered, Microsoft Excel will revert to the previous time value used.

Example

The following example sets the AutoRecover time interval to 5 minutes and notifies the user.

VBA Copy code Copy code
Sub SetTimeValue()

 Application.AutoRecover.Time = 5
 MsgBox "The AutoRecover time interval is set at " & _
 Application.AutoRecover.Time & " minutes."

End Sub

See also

Concepts

AutoRecover Object

Other resources

AutoRecover Object Members


Axes Object (Excel)

 Copy code hover
[image]

Axes Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Axis objects in the specified chart.

Remarks

Use the Axes method to return the Axes collection.

Use Axes(type, group), where type is the axis type and group is the axis group, to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. Group can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

Example

The following example displays the number of axes on embedded chart one on worksheet one.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 MsgBox.Axes.Count
End With

The following example sets the category axis title text on the chart sheet named "Chart1."

VBA Copy code Copy code
With Charts("chart1").Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With

See also

Concepts

Excel Object Model Reference

Other resources

Axes Object Members


Axes Members (Excel)

 Copy code hover
[image]

Axes Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Axis objects in the specified chart.

Methods

Name | Description
Item | Returns a single Axis object from an Axes collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Axes Properties (Excel)

 Copy code hover
[image]

Axes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Axes.Application Property (Excel)

 Copy code hover
[image]

Axes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Axes object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Axes Collection

Other resources

Axes Object Members


Axes.Count Property (Excel)

 Copy code hover
[image]

Axes.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an Axes object.

See also

Concepts

Axes Collection

Other resources

Axes Object Members


Axes.Creator Property (Excel)

 Copy code hover
[image]

Axes.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Axes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Axes Collection

Other resources

Axes Object Members


Axes.Parent Property (Excel)

 Copy code hover
[image]

Axes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Axes object.

Example

This example displays the name of the chart that contains myAxis.

VBA Copy code Copy code
Sub DisplayParentName()

 Set myAxis = Charts(1).Axes(xlValue)
 MsgBox myAxis.Parent.Name

End Sub

See also

Concepts

Axes Collection

Other resources

Axes Object Members


Axes Methods (Excel)

 Copy code hover
[image]

Axes Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single Axis object from an Axes collection.


Axes.Item Method (Excel)

 Copy code hover
[image]

Axes.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single Axis object from an Axes collection.

Syntax

expression .Item(Type, AxisGroup)

expression A variable that represents an Axes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlAxisType | The axis type.
AxisGroup | Optional | XlAxisGroup | The axis.

Return Value

Axis

Example

This example sets the title text for the category axis on Chart1.

VBA Copy code Copy code
With Charts("chart1").Axes.Item(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With

See also

Concepts

Axes Collection

Other resources

Axes Object Members


Axis Object (Excel)

 Copy code hover
[image]

Axis Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single axis in a chart.

Remarks

The Axis object is a member of the Axes collection.

Use Axes(type, group) where type is the axis type and group is the axis group to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. Group can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

Example

The following example sets the category axis title text on the chart sheet named "Chart1."

VBA Copy code Copy code
With Charts("chart1").Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With

See also

Concepts

Excel Object Model Reference

Other resources

Axis Object Members


Axis Members (Excel)

 Copy code hover
[image]

Axis Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single axis in a chart.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AxisBetweenCategories | True if the value axis crosses the category axis between categories. Read/write Boolean.
AxisGroup | Returns the group for the specified axis. Read-only
AxisTitle | Returns an AxisTitle object that represents the title of the specified axis. Read-only.
BaseUnit | Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.
BaseUnitIsAuto | True if Microsoft Excel chooses appropriate base units for the specified category axis. The default value is True. Read/write Boolean.
Border | Returns a Border object that represents the border of the object.
CategoryNames | Returns or sets all the category names for the specified axis, as a text array. When you set this property, you can set it to either an array or a Range object that contains the category names. Read/write Variant.
CategoryType | Returns or sets the category axis type. Read/write XlCategoryType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Crosses | Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.
CrossesAt | Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.
DisplayUnit | Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.
DisplayUnitCustom | If the value of the DisplayUnit property is xlCustom, the DisplayUnitCustom property returns or sets the value of the displayed units. The value must be from 0 through 10E307. Read/write Double.
DisplayUnitLabel | Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.
Format | Returns the ChartFormat object. Read-only.
HasDisplayUnitLabel | True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default value is True. Read/write Boolean.
HasMajorGridlines | True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.
HasMinorGridlines | True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
Height | Returns a Double value that represents the height, in points, of the object.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
LogBase | Returns or sets the base of the logarithm when you are using log scales. Read/write Double.
MajorGridlines | Returns a Gridlines object that represents the major gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.
MajorTickMark | Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.
MajorUnit | Returns or sets the major units for the value axis. Read/write Double.
MajorUnitIsAuto | True if Microsoft Excel calculates the major units for the value axis. Read/write Boolean.
MajorUnitScale | Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
MaximumScale | Returns or sets the maximum value on the value axis. Read/write Double.
MaximumScaleIsAuto | True if Microsoft Excel calculates the maximum value for the value axis. Read/write Boolean.
MinimumScale | Returns or sets the minimum value on the value axis. Read/write Double.
MinimumScaleIsAuto | True if Microsoft Excel calculates the minimum value for the value axis. Read/write Boolean.
MinorGridlines | Returns a Gridlines object that represents the minor gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.
MinorTickMark | Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.
MinorUnit | Returns or sets the minor units on the value axis. Read/write Double.
MinorUnitIsAuto | True if Microsoft Excel calculates minor units for the value axis. Read/write Boolean.
MinorUnitScale | Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
Parent | Returns the parent object for the specified object. Read-only.
ReversePlotOrder | True if Microsoft Excel plots data points from last to first. Read/write Boolean.
ScaleType | Returns or sets the value axis scale type. Read/write XlScaleType.
TickLabelPosition | Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.
TickLabels | Returns a TickLabels object that represents the tick-mark labels for the specified axis. Read-only.
TickLabelSpacing | Returns or sets the number of categories or series between tick-mark labels. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.
TickLabelSpacingIsAuto | Returns or sets whether or not the tick label spacing is automatic. Read/write Boolean.
TickMarkSpacing | Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Type | Returns an XlAxisType value that represents the Axis type.
Width | Returns a Double value that represents the width, in points, of the object.


Axis Properties (Excel)

 Copy code hover
[image]

Axis Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AxisBetweenCategories | True if the value axis crosses the category axis between categories. Read/write Boolean.
AxisGroup | Returns the group for the specified axis. Read-only
AxisTitle | Returns an AxisTitle object that represents the title of the specified axis. Read-only.
BaseUnit | Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.
BaseUnitIsAuto | True if Microsoft Excel chooses appropriate base units for the specified category axis. The default value is True. Read/write Boolean.
Border | Returns a Border object that represents the border of the object.
CategoryNames | Returns or sets all the category names for the specified axis, as a text array. When you set this property, you can set it to either an array or a Range object that contains the category names. Read/write Variant.
CategoryType | Returns or sets the category axis type. Read/write XlCategoryType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Crosses | Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.
CrossesAt | Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.
DisplayUnit | Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.
DisplayUnitCustom | If the value of the DisplayUnit property is xlCustom, the DisplayUnitCustom property returns or sets the value of the displayed units. The value must be from 0 through 10E307. Read/write Double.
DisplayUnitLabel | Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.
Format | Returns the ChartFormat object. Read-only.
HasDisplayUnitLabel | True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default value is True. Read/write Boolean.
HasMajorGridlines | True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.
HasMinorGridlines | True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
Height | Returns a Double value that represents the height, in points, of the object.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
LogBase | Returns or sets the base of the logarithm when you are using log scales. Read/write Double.
MajorGridlines | Returns a Gridlines object that represents the major gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.
MajorTickMark | Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.
MajorUnit | Returns or sets the major units for the value axis. Read/write Double.
MajorUnitIsAuto | True if Microsoft Excel calculates the major units for the value axis. Read/write Boolean.
MajorUnitScale | Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
MaximumScale | Returns or sets the maximum value on the value axis. Read/write Double.
MaximumScaleIsAuto | True if Microsoft Excel calculates the maximum value for the value axis. Read/write Boolean.
MinimumScale | Returns or sets the minimum value on the value axis. Read/write Double.
MinimumScaleIsAuto | True if Microsoft Excel calculates the minimum value for the value axis. Read/write Boolean.
MinorGridlines | Returns a Gridlines object that represents the minor gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.
MinorTickMark | Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.
MinorUnit | Returns or sets the minor units on the value axis. Read/write Double.
MinorUnitIsAuto | True if Microsoft Excel calculates minor units for the value axis. Read/write Boolean.
MinorUnitScale | Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
Parent | Returns the parent object for the specified object. Read-only.
ReversePlotOrder | True if Microsoft Excel plots data points from last to first. Read/write Boolean.
ScaleType | Returns or sets the value axis scale type. Read/write XlScaleType.
TickLabelPosition | Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.
TickLabels | Returns a TickLabels object that represents the tick-mark labels for the specified axis. Read-only.
TickLabelSpacing | Returns or sets the number of categories or series between tick-mark labels. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.
TickLabelSpacingIsAuto | Returns or sets whether or not the tick label spacing is automatic. Read/write Boolean.
TickMarkSpacing | Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Type | Returns an XlAxisType value that represents the Axis type.
Width | Returns a Double value that represents the width, in points, of the object.


Axis.Application Property (Excel)

 Copy code hover
[image]

Axis.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Axis object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisBetweenCategories Property (Excel)

 Copy code hover
[image]

Axis.AxisBetweenCategories Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the value axis crosses the category axis between categories. Read/write Boolean.

Syntax

expression .AxisBetweenCategories

expression A variable that represents an Axis object.

Remarks

This property applies only to category axes, and it doesn't apply to 3-D charts.

Example

This example causes the value axis in Chart1 to cross the category axis between categories.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).AxisBetweenCategories = True

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisGroup Property (Excel)

 Copy code hover
[image]

Axis.AxisGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the group for the specified axis. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AxisGroup

expression A variable that represents an Axis object.

Return Value

XlAxisGroup

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisTitle Property (Excel)

 Copy code hover
[image]

Axis.AxisTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AxisTitle object that represents the title of the specified axis. Read-only.

Syntax

expression .AxisTitle

expression A variable that represents an Axis object.

Remarks

This example adds an axis label to the category axis in Chart1.

Example

VBA Copy code Copy code
With Charts("Chart1").Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.BaseUnit Property (Excel)

 Copy code hover
[image]

Axis.BaseUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.

Syntax

expression .BaseUnit

expression A variable that represents an Axis object.

Remarks

Setting this property has no visible effect if the CategoryType property for the specified axis is set to xlCategoryScale. The set value is retained, however, and takes effect when the CategoryType property is set to xlTimeScale.

You cannot set this property for a value axis.

Example

This example sets the category axis in embedded chart one on worksheet one to use a time scale, with months as the base unit.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnit = xlMonths
 End With
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.BaseUnitIsAuto Property (Excel)

 Copy code hover
[image]

Axis.BaseUnitIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel chooses appropriate base units for the specified category axis. The default value is True. Read/write Boolean.

Syntax

expression .BaseUnitIsAuto

expression A variable that represents an Axis object.

Remarks

You cannot set this property for a value axis.

Example

This example sets the category axis in embedded chart one on worksheet one to use a time scale with automatic base units.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnitIsAuto = True
 End With
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Border Property (Excel)

 Copy code hover
[image]

Axis.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CategoryNames Property (Excel)

 Copy code hover
[image]

Axis.CategoryNames Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets all the category names for the specified axis, as a text array. When you set this property, you can set it to either an array or a Range object that contains the category names. Read/write Variant.

Syntax

expression .CategoryNames

expression A variable that represents an Axis object.

Remarks

This property applies only to category axes.

Example

This example sets the category names for Chart1 to the values in cells B1:B5 on Sheet1.

VBA Copy code Copy code
Set Charts("Chart1").Axes(xlCategory).CategoryNames = _
 Worksheets("Sheet1").Range("B1:B5")

This example uses an array to set individual category names for Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).CategoryNames = _
 Array ("1985", "1986", "1987", "1988", "1989")

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CategoryType Property (Excel)

 Copy code hover
[image]

Axis.CategoryType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the category axis type. Read/write XlCategoryType.

Syntax

expression .CategoryType

expression A variable that represents an Axis object.

Remarks

You cannot set this property for a value axis.

Example

This example sets the category axis in embedded chart one on worksheet one to use a time scale, with months as the base unit.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnit = xlMonths
 End With
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Creator Property (Excel)

 Copy code hover
[image]

Axis.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Axis object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Crosses Property (Excel)

 Copy code hover
[image]

Axis.Crosses Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.

Syntax

expression .Crosses

expression A variable that represents an Axis object.

Remarks

Can be one of the XlAxisCrosses constants listed in the following table.

Constant | Meaning
xlAxisCrossesAutomatic | Microsoft Excel sets the axis crossing point.
xlMinimum | The axis crosses at the minimum value.
xlMaximum | The axis crosses at the maximum value.
xlAxisCrossesCustom | The CrossesAt property specifies the axis crossing point.

This property isn't available for radar charts. For 3-D charts, this property can only be applied to the value axis and indicates where the plane defined by the category axes crosses the value axis.

This property can be used for both category and value axes. On the category axis, xlMinimum sets the value axis to cross at the first category, and xlMaximum sets the value axis to cross at the last category.

Note that xlMinimum and xlMaximum can have different meanings, depending on the axis.

Example

This example sets the value axis in Chart1 to cross the category axis at the maximum x value.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).Crosses = xlMaximum

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CrossesAt Property (Excel)

 Copy code hover
[image]

Axis.CrossesAt Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.

Syntax

expression .CrossesAt

expression A variable that represents an Axis object.

Remarks

Setting this property causes the Crosses property to change to xlAxisCrossesCustom.

This property cannot be used on radar charts. For 3-D charts, this property indicates where the plane defined by the category axes crosses the value axis.

Example

This example sets the category axis in the active chart to cross the value axis at value 3.

VBA Copy code Copy code
Sub Chart()

 ' Create a sample source of data.
 Range("A1") = "2"
 Range("A2") = "4"
 Range("A3") = "6"
 Range("A4") = "3"

 ' Create a chart based on the sample source of data.
 Charts.Add

 With ActiveChart
 .ChartType = xlLineMarkersStacked
 .SetSourceData Source:=Sheets("Sheet1").Range("A1:A4"), PlotBy:= xlColumns
 .Location Where:=xlLocationAsObject, Name:="Sheet1"
 End With

 ' Set the category axis to cross the value axis at value 3.
 ActiveChart.Axes(xlValue).Select
 Selection.CrossesAt = 3

End Sub

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnit Property (Excel)

 Copy code hover
[image]

Axis.DisplayUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.

Syntax

expression .DisplayUnit

expression A variable that represents an Axis object.

Remarks

XlDisplayUnit can be one of these XlDisplayUnit constants.

xlHundredMillions

xlHundredThousands

xlMillions

xlTenThousands

xlThousands

xlHundreds

xlMillionMillions

xlTenMillions

xlThousandMillions

The unit label can also be one of the following constants

xlCustom

xlNone

Using unit labels when charting large values makes your tick mark labels easier to read. For example, if you label your value axis in units of hundreds, thousands, or millions, you can use smaller numeric values at the tick marks on the axis.

Example

This example sets the units displayed on the value axis in Chart1 to hundreds.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .DisplayUnit = xlHundreds
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnitCustom Property (Excel)

 Copy code hover
[image]

Axis.DisplayUnitCustom Property (Excel)
See also Send feedback

Published: July 16, 2012

If the value of the DisplayUnit property is xlCustom, the DisplayUnitCustom property returns or sets the value of the displayed units. The value must be from 0 through 10E307. Read/write Double.

Syntax

expression .DisplayUnitCustom

expression A variable that represents an Axis object.

Remarks

Using unit labels when charting large values makes your tick mark labels easier to read. For example, if you label your value axis in units of hundreds, thousands, or millions, you can use smaller numeric values at the tick marks on the axis.

Example

This example sets the units displayed on the value axis in Chart1 to increments of 500.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnitLabel Property (Excel)

 Copy code hover
[image]

Axis.DisplayUnitLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.

Syntax

expression .DisplayUnitLabel

expression A variable that represents an Axis object.

Example

This example sets the label caption to "Millions" for the value axis in Chart1, and then it turns off automatic font scaling.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue).DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Format Property (Excel)

 Copy code hover
[image]

Axis.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasDisplayUnitLabel Property (Excel)

 Copy code hover
[image]

Axis.HasDisplayUnitLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default value is True. Read/write Boolean.

Syntax

expression .HasDisplayUnitLabel

expression A variable that represents an Axis object.

Example

This example sets the units on the value axis in Chart1 to increments of 500 but keeps the unit label hidden.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .AxisTitle.Caption = "Rebate Amounts"
 .HasDisplayUnitLabel = False
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasMajorGridlines Property (Excel)

 Copy code hover
[image]

Axis.HasMajorGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.

Syntax

expression .HasMajorGridlines

expression A variable that represents an Axis object.

Example

This example sets the color of the major gridlines for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 If .HasMajorGridlines Then
 .MajorGridlines.Border.ColorIndex = 3 'set color to red
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasMinorGridlines Property (Excel)

 Copy code hover
[image]

Axis.HasMinorGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.

Syntax

expression .HasMinorGridlines

expression A variable that represents an Axis object.

Example

This example sets the color of the minor gridlines for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 If .HasMinorGridlines Then
 .MinorGridlines.Border.ColorIndex = 4
 'set color to green
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasTitle Property (Excel)

 Copy code hover
[image]

Axis.HasTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the axis or chart has a visible title. Read/write Boolean.

Syntax

expression .HasTitle

expression A variable that represents an Axis object.

Remarks

An axis title is represented by an AxisTitle object.

Example

This example adds an axis label to the category axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axis(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Height Property (Excel)

 Copy code hover
[image]

Axis.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Left Property (Excel)

 Copy code hover
[image]

Axis.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.

Syntax

expression .Left

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.LogBase Property (Excel)

 Copy code hover
[image]

Axis.LogBase Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the base of the logarithm when you are using log scales. Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .LogBase

expression A variable that represents an Axis object.

Remarks

Attempting to set this property to a value less than or equal to zero (0) causes an error. The default value is 10.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorGridlines Property (Excel)

 Copy code hover
[image]

Axis.MajorGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Gridlines object that represents the major gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.

Syntax

expression .MajorGridlines

expression A variable that represents an Axis object.

Example

This example sets the color of the major gridlines for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 If .HasMajorGridlines Then
 .MajorGridlines.Border.ColorIndex = 5 'set color to blue
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorTickMark Property (Excel)

 Copy code hover
[image]

Axis.MajorTickMark Property (Excel)
See also Send feedback

Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.

Syntax

expression .MajorTickMark

expression A variable that represents an Axis object.

Remarks

XlTickMark can be one of these XlTickMark constants.

xlTickMarkInside

xlTickMarkOutside

xlTickMarkCross

xlTickMarkNone

Example

This example sets the major tick marks for the value axis in Chart1 to be outside the axis.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).MajorTickMark = xlTickMarkOutside

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnit Property (Excel)

 Copy code hover
[image]

Axis.MajorUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the major units for the value axis. Read/write Double.

Syntax

expression .MajorUnit

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MajorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick mark spacing on the category axis.

Example

This example sets the major and minor units for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnitIsAuto Property (Excel)

 Copy code hover
[image]

Axis.MajorUnitIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel calculates the major units for the value axis. Read/write Boolean.

Syntax

expression .MajorUnitIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MajorUnit property sets this property to False.

Example

This example automatically sets the major and minor units for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnitScale Property (Excel)

 Copy code hover
[image]

Axis.MajorUnitScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.

Syntax

expression .MajorUnitScale

expression A variable that represents an Axis object.

Remarks

XlTimeUnit can be one of these XlTimeUnit constants.

xlMonths

xlDays

xlYears

Example

This example sets the category axis to use a time scale and sets the major and minor units.

VBA Copy code Copy code
With Charts(1).Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MaximumScale Property (Excel)

 Copy code hover
[image]

Axis.MaximumScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum value on the value axis. Read/write Double.

Syntax

expression .MaximumScale

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MaximumScaleIsAuto property to False.

Example

This example sets the minimum and maximum values for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MaximumScaleIsAuto Property (Excel)

 Copy code hover
[image]

Axis.MaximumScaleIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel calculates the maximum value for the value axis. Read/write Boolean.

Syntax

expression .MaximumScaleIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MaximumScale property sets this property to False.

Example

This example automatically calculates the minimum scale and the maximum scale for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinimumScale Property (Excel)

 Copy code hover
[image]

Axis.MinimumScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum value on the value axis. Read/write Double.

Syntax

expression .MinimumScale

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MinimumScaleIsAuto property to False.

Example

This example sets the minimum and maximum values for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinimumScaleIsAuto Property (Excel)

 Copy code hover
[image]

Axis.MinimumScaleIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel calculates the minimum value for the value axis. Read/write Boolean.

Syntax

expression .MinimumScaleIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MinimumScale property sets this property to False.

Example

This example automatically calculates the minimum scale and the maximum scale for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorGridlines Property (Excel)

 Copy code hover
[image]

Axis.MinorGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Gridlines object that represents the minor gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.

Syntax

expression .MinorGridlines

expression A variable that represents an Axis object.

Example

This example sets the color of the minor gridlines for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 If .HasMinorGridlines Then
 .MinorGridlines.Border.ColorIndex = 5 'set color to blue
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorTickMark Property (Excel)

 Copy code hover
[image]

Axis.MinorTickMark Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.

Syntax

expression .MinorTickMark

expression A variable that represents an Axis object.

Remarks

XlTickMark can be one of these XlTickMark constants.

xlTickMarkInside

xlTickMarkOutside

xlTickMarkCross

xlTickMarkNone

Example

This example sets the minor tick marks for the value axis in Chart1 to be inside the axis.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).MinorTickMark = xlTickMarkInside

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnit Property (Excel)

 Copy code hover
[image]

Axis.MinorUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the minor units on the value axis. Read/write Double.

Syntax

expression .MinorUnit

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MinorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick mark spacing on the category axis.

Example

This example sets the major and minor units for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnitIsAuto Property (Excel)

 Copy code hover
[image]

Axis.MinorUnitIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel calculates minor units for the value axis. Read/write Boolean.

Syntax

expression .MinorUnitIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MinorUnit property sets this property to False.

Example

This example automatically calculates major and minor units for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnitScale Property (Excel)

 Copy code hover
[image]

Axis.MinorUnitScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.

Syntax

expression .MinorUnitScale

expression A variable that represents an Axis object.

Remarks

XlTimeUnit can be one of these XlTimeUnit constants.

xlMonths

xlDays

xlYears

Example

This example sets the category axis to use a time scale and sets the major and minor units.

VBA Copy code Copy code
With Charts(1).Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Parent Property (Excel)

 Copy code hover
[image]

Axis.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.ReversePlotOrder Property (Excel)

 Copy code hover
[image]

Axis.ReversePlotOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel plots data points from last to first. Read/write Boolean.

Syntax

expression .ReversePlotOrder

expression A variable that represents an Axis object.

Remarks

This property cannot be used on radar charts.

Example

This example plots data points from last to first on the value axis on Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).ReversePlotOrder = True

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.ScaleType Property (Excel)

 Copy code hover
[image]

Axis.ScaleType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the value axis scale type. Read/write XlScaleType.

Syntax

expression .ScaleType

expression A variable that represents an Axis object.

Remarks

XlScaleType can be one of these XlScaleType constants.

xlScaleLinear

xlScaleLogarithmic

A logarithmic scale uses base 10 logarithms.

Example

This example sets the value axis in Chart1 to use a logarithmic scale.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).ScaleType = xlScaleLogarithmic

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelPosition Property (Excel)

 Copy code hover
[image]

Axis.TickLabelPosition Property (Excel)
See also Send feedback

Published: July 16, 2012

Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.

Syntax

expression .TickLabelPosition

expression A variable that represents an Axis object.

Remarks

XlTickLabelPosition can be one of these XlTickLabelPosition constants.

xlTickLabelPositionLow

xlTickLabelPositionNone

xlTickLabelPositionHigh

xlTickLabelPositionNextToAxis

Example

This example sets tick-mark labels on the category axis in Chart1 to the high position (above the chart).

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory) _
 .TickLabelPosition = xlTickLabelPositionHigh

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabels Property (Excel)

 Copy code hover
[image]

Axis.TickLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TickLabels object that represents the tick-mark labels for the specified axis. Read-only.

Syntax

expression .TickLabels

expression A variable that represents an Axis object.

Example

This example sets the color of the tick-mark label font for the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.ColorIndex = 3

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelSpacing Property (Excel)

 Copy code hover
[image]

Axis.TickLabelSpacing Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick-mark labels. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.

Syntax

expression .TickLabelSpacing

expression A variable that represents an Axis object.

Remarks

Tick-mark label spacing on the value axis is always calculated by Microsoft Excel.

Example

This example sets the number of categories between tick-mark labels on the category axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).TickLabelSpacing = 10

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelSpacingIsAuto Property (Excel)

 Copy code hover
[image]

Axis.TickLabelSpacingIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether or not the tick label spacing is automatic. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .TickLabelSpacingIsAuto

expression A variable that represents an Axis object.

Remarks

The TickLabelSpacing property returns the current tick label spacing, whether or not the setting is automatic.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickMarkSpacing Property (Excel)

 Copy code hover
[image]

Axis.TickMarkSpacing Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. Can be a value from 1 through 31999. Read/write Long.

Syntax

expression .TickMarkSpacing

expression A variable that represents an Axis object.

Remarks

Use the MajorUnit and MinorUnit properties to set tick-mark spacing on the value axis.

Example

This example sets the number of categories between tick marks on the category axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).TickMarkSpacing = 10

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Top Property (Excel)

 Copy code hover
[image]

Axis.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Type Property (Excel)

 Copy code hover
[image]

Axis.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlAxisType value that represents the Axis type.

Syntax

expression .Type

expression A variable that represents an Axis object.

Remarks

When using this property for the horizontal axis of scatter charts, xlCategory will be returned as the Axis type.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Width Property (Excel)

 Copy code hover
[image]

Axis.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis Methods (Excel)

 Copy code hover
[image]

Axis Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


Axis.Delete Method (Excel)

 Copy code hover
[image]

Axis.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an Axis object.

Return Value

Variant

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Select Method (Excel)

 Copy code hover
[image]

Axis.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents an Axis object.

Return Value

A Variant value that represents the selected object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


AxisTitle Object (Excel)

 Copy code hover
[image]

AxisTitle Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a chart axis title.

Remarks

Use the AxisTitle property to return an AxisTitle object.

The AxisTitle object doesn't exist and cannot be used unless the HasTitle property for the axis is True.

Example

The following example activates embedded chart one, sets the value axis title text, sets the font to Bookman 10 point, and formats the word millions as italic.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Activate
With ActiveChart.Axes(xlValue)
 .HasTitle = True
 With .AxisTitle
 .Caption = "Revenue (millions)"
 .Font.Name = "bookman"
 .Font.Size = 10
 .Characters(10, 8).Font.Italic = True
 End With
End With

See also

Concepts

Excel Object Model Reference

Other resources

AxisTitle Object Members


AxisTitle Members (Excel)

 Copy code hover
[image]

AxisTitle Members (Excel)
Send feedback

Published: July 16, 2012

Represents a chart axis title.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the axis title text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IncludeInLayout | True if an axis title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


AxisTitle Properties (Excel)

 Copy code hover
[image]

AxisTitle Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the axis title text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IncludeInLayout | True if an axis title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


AxisTitle.Application Property (Excel)

 Copy code hover
[image]

AxisTitle.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an AxisTitle object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Caption Property (Excel)

 Copy code hover
[image]

AxisTitle.Caption Property (Excel)
See also Send feedback

Returns or sets a String value that represents the axis title text.

Syntax

expression .Caption

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Characters Property (Excel)

 Copy code hover
[image]

AxisTitle.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Syntax

expression .Characters(Start, Length)

expression A variable that represents an AxisTitle object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The Characters object isn't a collection.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Creator Property (Excel)

 Copy code hover
[image]

AxisTitle.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AxisTitle object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Format Property (Excel)

 Copy code hover
[image]

AxisTitle.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Formula Property (Excel)

 Copy code hover
[image]

AxisTitle.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Formula

expression A variable that represents an AxisTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaLocal Property (Excel)

 Copy code hover
[image]

AxisTitle.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaLocal

expression A variable that represents an AxisTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

AxisTitle.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1

expression A variable that represents an AxisTitle object.

Return Value

String

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

AxisTitle.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents an AxisTitle object.

Return Value

String

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Height Property (Excel)

 Copy code hover
[image]

AxisTitle.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents an AxisTitle object.

Return Value

Double

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

AxisTitle.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.IncludeInLayout Property (Excel)

 Copy code hover
[image]

AxisTitle.IncludeInLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

True if an axis title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IncludeInLayout

expression A variable that represents an AxisTitle object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title using the Above Chart command, the chart will resize smaller, as in Microsoft Office Excel 2003. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Left Property (Excel)

 Copy code hover
[image]

AxisTitle.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Name Property (Excel)

 Copy code hover
[image]

AxisTitle.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Orientation Property (Excel)

 Copy code hover
[image]

AxisTitle.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Parent Property (Excel)

 Copy code hover
[image]

AxisTitle.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Position Property (Excel)

 Copy code hover
[image]

AxisTitle.Position Property (Excel)
See also Send feedback

Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.ReadingOrder Property (Excel)

 Copy code hover
[image]

AxisTitle.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Shadow Property (Excel)

 Copy code hover
[image]

AxisTitle.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Text Property (Excel)

 Copy code hover
[image]

AxisTitle.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents an AxisTitle object.

Example

This example sets the axis title text for the category axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "Month"
End With

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Top Property (Excel)

 Copy code hover
[image]

AxisTitle.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.VerticalAlignment Property (Excel)

 Copy code hover
[image]

AxisTitle.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Width Property (Excel)

 Copy code hover
[image]

AxisTitle.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents an AxisTitle object.

Return Value

Double

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle Methods (Excel)

 Copy code hover
[image]

AxisTitle Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


AxisTitle.Delete Method (Excel)

 Copy code hover
[image]

AxisTitle.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an AxisTitle object.

Return Value

Variant

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Select Method (Excel)

 Copy code hover
[image]

AxisTitle.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents an AxisTitle object.

Return Value

A Variant value representing the selected object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


Border Object (Excel)

 Copy code hover
[image]

Border Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the border of an object.

Remarks

Most bordered objects (all except for the Range and Style objects) have a border that's treated as a single entity, regardless of how many sides it has. The entire border must be returned as a unit. Use the Border property, such as from a TrendLine object, to return the Border object for this kind of object.

Example

The following example changes the type and line style of a trend line on the active chart.

VBA Copy code Copy code
With ActiveChart.SeriesCollection(1).Trendlines(1)
 .Type = xlLinear
 .Border.LineStyle = xlDash
End With

Range and Style objects have four discrete borders — left, right, top, and bottom — which can be returned individually or as a group. Use the Borders property to return the Borders collection, which contains all four borders and treats the borders as a unit. The following example adds a double border to cell A1 on worksheet one.

VBA Copy code Copy code
Worksheets(1).Range("A1").Borders.LineStyle = xlDouble

Use Borders(index), where index identifies the border, to return a single Border object. The following example sets the color of the bottom border of cells A1:G1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G1"). _
 Borders(xlEdgeBottom).Color = RGB(255, 0, 0)

Index can be one of the following XlBordersIndex constants: xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlInsideHorizontal, or xlInsideVertical.

See also

Concepts

Excel Object Model Reference

Other resources

Border Object Members


Border Members (Excel)

 Copy code hover
[image]

Border Members (Excel)
Send feedback

Published: July 16, 2012

Represents the border of an object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the border.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Weight | Returns or sets a XlBorderWeight value that represents the weight of the border.


Border Properties (Excel)

 Copy code hover
[image]

Border Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the border.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Weight | Returns or sets a XlBorderWeight value that represents the weight of the border.


Border.Application Property (Excel)

 Copy code hover
[image]

Border.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Border object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Color Property (Excel)

 Copy code hover
[image]

Border.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.

Syntax

expression .Color

expression An expression that returns a Border object.

Remarks

Object | Color
Border | The color of the border.
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero).
Font | The color of the font.
Interior | The cell shading color or the drawing object fill color.
Tab | The color of the tab.

Example

This example sets the color of the tick-mark labels on the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)

See also

Concepts

Border Object

Other resources

Border Object Members


Border.ColorIndex Property (Excel)

 Copy code hover
[image]

Border.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the color of the border.

Syntax

expression .ColorIndex

expression A variable that represents a Border object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

Example

This example sets the color of the major gridlines for the value axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 If .HasMajorGridlines Then
 .MajorGridlines.Border.ColorIndex = 5 'set color to blue
 End If
End With

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Creator Property (Excel)

 Copy code hover
[image]

Border.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Border object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.LineStyle Property (Excel)

 Copy code hover
[image]

Border.LineStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

Syntax

expression .LineStyle

expression A variable that represents a Border object.

Remarks

xlDouble and xlSlantDashDot do not apply to charts.

Example

This example puts a border around the chart area and the plot area of Chart1.

VBA Copy code Copy code
With Charts("Chart1")
 .ChartArea.Border.LineStyle = xlDashDot
 With .PlotArea.Border
 .LineStyle = xlDashDotDot
 .Weight = xlThick
 End With
End With

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Parent Property (Excel)

 Copy code hover
[image]

Border.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Border object.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.ThemeColor Property (Excel)

 Copy code hover
[image]

Border.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a Border object.

Remarks

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.TintAndShade Property (Excel)

 Copy code hover
[image]

Border.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens a color.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a Border object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1 results in a run-time error: "The specified value is out of range." This property works for both theme colors and nontheme colors.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Weight Property (Excel)

 Copy code hover
[image]

Border.Weight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlBorderWeight value that represents the weight of the border.

Syntax

expression .Weight

expression A variable that represents a Border object.

Example

This example sets the border weight for oval one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Ovals(1).Border.Weight = xlMedium

See also

Concepts

Border Object

Other resources

Border Object Members


Borders Object (Excel)

 Copy code hover
[image]

Borders Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of four Border objects that represent the four borders of a Range or Style object.

Remarks

Use the Borders property to return the Borders collection, which contains all four borders.

You can set border properties for an individual border only with Range and Style objects. Other bordered objects, such as error bars and series lines, have a border that's treated as a single entity, regardless of how many sides it has. For these objects, you must return and set properties for the entire border as a unit. For more information, see the Border object.

Example

The following example adds a double border to cell A1 on worksheet one.

VBA Copy code Copy code
Worksheets(1).Range("A1").Borders.LineStyle = xlDouble

Use Borders(index), where index identifies the border, to return a single Border object. The following example sets the color of the bottom border of cells A1:G1 to red.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G1"). _
 Borders(xlEdgeBottom).Color = RGB(255, 0, 0)

Index can be one of the following xlBordersIndex constants: xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, or xlEdgeTop, xlInsideHorizontal, or xlInsideVertical.

See also

Concepts

Excel Object Model Reference

Other resources

Borders Object Members


Borders Members (Excel)

 Copy code hover
[image]

Borders Members (Excel)
Send feedback

Published: July 16, 2012

A collection of four Border objects that represent the four borders of a Range or Style object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of all four borders.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Border object that represents one of the borders of either a range of cells or a style.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Value | Synonym for Borders.LineStyle.
Weight | Returns or sets a XlBorderWeight value that represents the weight of the border.


Borders Properties (Excel)

 Copy code hover
[image]

Borders Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of all four borders.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Border object that represents one of the borders of either a range of cells or a style.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Value | Synonym for Borders.LineStyle.
Weight | Returns or sets a XlBorderWeight value that represents the weight of the border.


Borders.Application Property (Excel)

 Copy code hover
[image]

Borders.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Borders object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Color Property (Excel)

 Copy code hover
[image]

Borders.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.

Syntax

expression .Color

expression An expression that returns a Borders object.

Remarks

Object | Color
Border | The color of the border.
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero).
Font | The color of the font.
Interior | The cell shading color or the drawing object fill color.
Tab | The color of the tab.

Example

This example sets the color of the tick-mark labels on the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.ColorIndex Property (Excel)

 Copy code hover
[image]

Borders.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the color of all four borders.

Syntax

expression .ColorIndex

expression A variable that represents a Borders object.

Remarks

This property returns Null if all four borders aren't the same color.

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Count Property (Excel)

 Copy code hover
[image]

Borders.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Borders object.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Creator Property (Excel)

 Copy code hover
[image]

Borders.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Borders object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Item Property (Excel)

 Copy code hover
[image]

Borders.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents one of the borders of either a range of cells or a style.

Syntax

expression .Item(Index)

expression A variable that represents a Borders object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | XlBordersIndex | One of the constants of XlBordersIndex.

Remarks

XlBordersIndex can be one of these XlBordersIndex constants.

xlDiagonalDown

xlDiagonalUp

xlEdgeBottom

xlEdgeLeft

xlEdgeRight

xlEdgeTop

xlInsideHorizontal

xlInsideVertical

Example

This following example sets the color of the bottom border of cells A1:G1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("a1:g1"). _
 Borders.Item(xlEdgeBottom).Color = RGB(255, 0, 0)

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.LineStyle Property (Excel)

 Copy code hover
[image]

Borders.LineStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

Syntax

expression .LineStyle

expression A variable that represents a Borders object.

Example

This example puts a border around the chart area and the plot area of Chart1.

VBA Copy code Copy code
With Charts("Chart1")
 .ChartArea.Border.LineStyle = xlDashDot
 With .PlotArea.Border
 .LineStyle = xlDashDotDot
 .Weight = xlThick
 End With
End With

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Parent Property (Excel)

 Copy code hover
[image]

Borders.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Borders object.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.ThemeColor Property (Excel)

 Copy code hover
[image]

Borders.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a Borders object.

Remarks

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.TintAndShade Property (Excel)

 Copy code hover
[image]

Borders.TintAndShade Property (Excel)
See also Send feedback

Returns or sets a Single that lightens or darkens a color.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a Borders object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1 results in a run-time error: "The specified value is out of range." This property works for both theme colors and nontheme colors.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Value Property (Excel)

 Copy code hover
[image]

Borders.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Synonym for Borders.LineStyle.

Syntax

expression .Value

expression A variable that represents a Borders object.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


Borders.Weight Property (Excel)

 Copy code hover
[image]

Borders.Weight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlBorderWeight value that represents the weight of the border.

Syntax

expression .Weight

expression A variable that represents a Borders object.

See also

Concepts

Borders Collection

Other resources

Borders Object Members


CalculatedFields Object (Excel)

 Copy code hover
[image]

CalculatedFields Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of PivotField objects that represents all the calculated fields in the specified PivotTable report.

Remarks

A report that contains Revenue and Expense fields could have a calculated field named "Profit" defined as the amount in the Revenue field minus the amount in the Expense field.

For OLAP data sources, you cannot set this collection, and it always returns Nothing.

Use the CalculatedFields method to return the CalculatedFields collection .

Use CalculatedFields(index), where index is specified field's name or index number, to return a single PivotField object from the CalculatedFields collection.

Example

The following example deletes the calculated fields from the PivotTable report named "Pivot1"

VBA Copy code Copy code
For Each fld in _
 Worksheets(1).PivotTables("Pivot1").CalculatedFields
 fld.Delete
Next

See also

Concepts

Excel Object Model Reference

Other resources

CalculatedFields Object Members


CalculatedFields Members (Excel)

 Copy code hover
[image]

CalculatedFields Members (Excel)
Send feedback

Published: July 16, 2012

A collection of PivotField objects that represents all the calculated fields in the specified PivotTable report.

Methods

Name | Description
Add | Creates a new calculated field. Returns a PivotField object.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedFields Properties (Excel)

 Copy code hover
[image]

CalculatedFields Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedFields.Application Property (Excel)

 Copy code hover
[image]

CalculatedFields.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CalculatedFields object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedFields.Count Property (Excel)

 Copy code hover
[image]

CalculatedFields.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CalculatedFields object.

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedFields.Creator Property (Excel)

 Copy code hover
[image]

CalculatedFields.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CalculatedFields object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedFields.Parent Property (Excel)

 Copy code hover
[image]

CalculatedFields.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalculatedFields object.

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedFields Methods (Excel)

 Copy code hover
[image]

CalculatedFields Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new calculated field. Returns a PivotField object.
Item | Returns a single object from a collection.


CalculatedFields.Add Method (Excel)

 Copy code hover
[image]

CalculatedFields.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new calculated field. Returns a PivotField object.

Syntax

expression .Add(Name, Formula, UseStandardFormula)

expression A variable that represents a CalculatedFields object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the field.
Formula | Required | String | The formula for the field.
UseStandardFormula | Optional | Variant | False (default) for upward compatibility. True for strings contained in any arguments that are field names, will be interpreted as having been formatted in standard U.S. English instead of local settings.

Return Value

A PivotField that represents the new calculated field.

Example

This example adds a calculated field to the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).CalculatedFields.Add "PxS", _
 "= Product * Sales"

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedFields.Item Method (Excel)

 Copy code hover
[image]

CalculatedFields.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CalculatedFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotField object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example sets the formula for calculated field one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).CalculatedFields.Item(1) _
 .Formula = "=Revenue - Cost"

See also

Concepts

CalculatedFields Collection

Other resources

CalculatedFields Object Members


CalculatedItems Object (Excel)

 Copy code hover
[image]

CalculatedItems Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of PivotItem objects that represent all the calculated items in the specified PivotTable report.

Remarks

A PivotTable report that contains January, February, and March items could have a calculated item named "FirstQuarter" defined as the sum of the amounts in January, February, and March.

Use the CalculatedItems method to return the CalculatedItems collection.

Use CalculatedFields(index), where index is the name or index number of the field, to return a single PivotField object from the CalculatedFields collection.

Example

The following example creates a list of the calculated items in the first PivotTable report on worksheet one, along with their formulas.

VBA Copy code Copy code
Set pt = Worksheets(1).PivotTables(1)
For Each ci In pt.PivotFields("Sales").CalculatedItems
 r = r + 1
 With Worksheets(2)
 .Cells(r, 1).Value = ci.Name
 .Cells(r, 2).Value = ci.Formula
 End With
Next

See also

Concepts

Excel Object Model Reference

Other resources

CalculatedItems Object Members


CalculatedItems Members (Excel)

 Copy code hover
[image]

CalculatedItems Members (Excel)
Send feedback

Published: July 16, 2012

A collection of PivotItem objects that represent all the calculated items in the specified PivotTable report.

Methods

Name | Description
Add | Creates a new calculated item. Returns a PivotItem object.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedItems Properties (Excel)

 Copy code hover
[image]

CalculatedItems Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedItems.Application Property (Excel)

 Copy code hover
[image]

CalculatedItems.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CalculatedItems object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedItems.Count Property (Excel)

 Copy code hover
[image]

CalculatedItems.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CalculatedItems object.

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedItems.Creator Property (Excel)

 Copy code hover
[image]

CalculatedItems.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CalculatedItems object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedItems.Parent Property (Excel)

 Copy code hover
[image]

CalculatedItems.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalculatedItems object.

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedItems Methods (Excel)

 Copy code hover
[image]

CalculatedItems Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new calculated item. Returns a PivotItem object.
Item | Returns a single object from a collection.


CalculatedItems.Add Method (Excel)

 Copy code hover
[image]

CalculatedItems.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new calculated item. Returns a PivotItem object.

Syntax

expression .Add(Name, Formula, UseStandardFormula)

expression A variable that represents a CalculatedItems object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the item.
Formula | Required | String | The formula for the item.
UseStandardFormula | Optional | Variant | False (default) for upward compatibility. True for strings contained in any arguments that are item names, will be interpreted as having been formatted in standard U.S. English instead of local settings.

Return Value

A PivotItem object that represents the new calculated item.

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedItems.Item Method (Excel)

 Copy code hover
[image]

CalculatedItems.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CalculatedItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotItem object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example hides calculated item one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotFields("year") _
 .CalculatedItems.Item(1).Visible = False

See also

Concepts

CalculatedItems Collection

Other resources

CalculatedItems Object Members


CalculatedMember Object (Excel)

 Copy code hover
[image]

CalculatedMember Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the calculated fields, calculated items, and named sets for PivotTables with Online Analytical Processing (OLAP) data sources.

Remarks

Use the Add method or the Item property of the CalculatedMembers collection to return a CalculatedMember object.

With a CalculatedMember object you can check the validity of a calculated field or item in a PivotTable using the IsValid property.

Note Note

The IsValid property will return True if the PivotTable is not currently connected to the data source. Use the MakeConnection method before testing the IsValid property.

Example

The following example notifies the user if the calculated member is valid or not. This example assumes a PivotTable exists on the active worksheet that contains either a valid or invalid calculated member.

VBA Copy code Copy code
Sub CheckValidity()

 Dim pvtTable As PivotTable
 Dim pvtCache As PivotCache

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 ' Handle run-time error if external source is not an OLEDB data source.
 On Error GoTo Not_OLEDB

 ' Check connection setting and make connection if necessary.
 If pvtCache.IsConnected = False Then
 pvtCache.MakeConnection
 End If

 ' Check if calculated member is valid.
 If pvtTable.CalculatedMembers.Item(1).IsValid = True Then
 MsgBox "The calculated member is valid."
 Else
 MsgBox "The calculated member is not valid."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

CalculatedMember Object Members


CalculatedMember Members (Excel)

 Copy code hover
[image]

CalculatedMember Members (Excel)
Send feedback

Published: July 16, 2012

Represents the calculated fields, calculated items, and named sets for PivotTables with Online Analytical Processing (OLAP) data sources.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFolder | Returns the display folder name for a named set. Read-only
Dynamic | Returns whether the specified named set is recalculated with every update. Read-only
FlattenHierarchies | Returns or sets whether items from all levels of the hierarchy of the specified named set are displayed in the same field of a PivotTable report based on an OLAP cube. Boolean Read/write
Formula | Returns a String value that represents the member's formula in multidimensional expressions (MDX) syntax.
HierarchizeDistinct | Returns or sets whether to order and remove duplicates when displaying the hierarchy of the specified named set in a PivotTable report based on an OLAP cube. Read/write
IsValid | Returns a Boolean that indicates whether the specified calculated member has been successfully instantiated with the OLAP provider during the current session.
MeasureGroup | Returns the associated measure group. String Read-only
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns a XlCalcMemNumberFormatType value that represents the number format of the calculated member. The default value is xlNumberFormatTypeDefault. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
ParentHierarchy | Returns the name of the current parent hierarchy from the hierarchies that are available on the cube. String Read-only
ParentMember | Returns the name of the parent member for the parent hierarchy. String Read-only
SolveOrder | Returns a Long specifying the value of the calculated member's solve order MDX (Mulitdimensional Expression) argument. The default value is zero. Read-only.
SourceName | Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
Type | Returns a XlCalculatedMemberType value that represents the calculated member type.


CalculatedMember Properties (Excel)

 Copy code hover
[image]

CalculatedMember Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFolder | Returns the display folder name for a named set. Read-only
Dynamic | Returns whether the specified named set is recalculated with every update. Read-only
FlattenHierarchies | Returns or sets whether items from all levels of the hierarchy of the specified named set are displayed in the same field of a PivotTable report based on an OLAP cube. Boolean Read/write
Formula | Returns a String value that represents the member's formula in multidimensional expressions (MDX) syntax.
HierarchizeDistinct | Returns or sets whether to order and remove duplicates when displaying the hierarchy of the specified named set in a PivotTable report based on an OLAP cube. Read/write
IsValid | Returns a Boolean that indicates whether the specified calculated member has been successfully instantiated with the OLAP provider during the current session.
MeasureGroup | Returns the associated measure group. String Read-only
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns a XlCalcMemNumberFormatType value that represents the number format of the calculated member. The default value is xlNumberFormatTypeDefault. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
ParentHierarchy | Returns the name of the current parent hierarchy from the hierarchies that are available on the cube. String Read-only
ParentMember | Returns the name of the parent member for the parent hierarchy. String Read-only
SolveOrder | Returns a Long specifying the value of the calculated member's solve order MDX (Mulitdimensional Expression) argument. The default value is zero. Read-only.
SourceName | Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
Type | Returns a XlCalculatedMemberType value that represents the calculated member type.


CalculatedMember.Application Property (Excel)

 Copy code hover
[image]

CalculatedMember.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CalculatedMember object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Creator Property (Excel)

 Copy code hover
[image]

CalculatedMember.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CalculatedMember object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.DisplayFolder Property (Excel)

 Copy code hover
[image]

CalculatedMember.DisplayFolder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the display folder name for a named set. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .DisplayFolder

expression A variable that returns a CalculatedMember object.

Return Value

String

Remarks

The value of this property corresponds to the optional value that can be entered in the Display folder text box of the New/Modify Set dialog box when a named set is created or edited. To create a new named set from data in a PivotTable based on an OLAP data source, click the PivotTable, click Field, Items, & Sets on the PivotTable Tools Options tab on the ribbon, click Manage Sets, click New in the Set Manager dialog box, and then click Create Set using MDX. This will display the New Set dialog box, which contains the Display folder text box. Similarly, if you select an existing named set in the Set Manager dialog box, and then click Edit, the Modify Set dialog box is displayed.

This property along with the Dynamic and HierarchizeDistinct properties can only be read for named sets (which are represented by CalculatedMember objects where the Type property equals xlCalculatedSet). These properties for cannot be read for calculated members or measures (which are represented by CalculatedMember objects where the Type property equals xlCalculatedMember). If you attempt to read these properties for calculated members or measures, a run-time error is raised.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Dynamic Property (Excel)

 Copy code hover
[image]

CalculatedMember.Dynamic Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the specified named set is recalculated with every update. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Dynamic

expression A variable that returns a CalculatedMember object.

Return Value

Boolean

Remarks

True if the named set is recalculated with every update; otherwise False.

The value of this property corresponds to the setting of the Recalculate set with every update check box in the New/Modify Set dialog box that is available when a named set is created or edited. To create a new named set from data in a PivotTable based on an OLAP data source, click the PivotTable, click Field, Items, & Sets on the PivotTable Tools Options tab on the ribbon, click Manage Sets, click New in the Set Manager dialog box, and then click Create Set using MDX. This will display the New Set dialog box, which contains the Recalculate set with every update check box. Similarly, if you select an existing named set in the Set Manager dialog box, and then click Edit, the Modify Set dialog box is displayed.

This property along with the DisplayFolder and HierarchizeDistinct properties can only be read for named sets (which are represented by CalculatedMember objects where the Type property equals xlCalculatedSet). These properties for cannot be read for calculated members or measures (which are represented by CalculatedMember objects where the Type property equals xlCalculatedMember). If you attempt to read these properties for calculated members or measures, a run-time error is raised.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.FlattenHierarchies Property (Excel)

 Copy code hover
[image]

CalculatedMember.FlattenHierarchies Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether items from all levels of the hierarchy of the specified named set are displayed in the same field of a PivotTable report based on an OLAP cube. Boolean Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .FlattenHierarchies

expression A variable that represents a CalculatedMember object.

Return Value

Boolean

Remarks

True if items from all levels of the hierarchy of the named set are displayed in the same field; otherwise False.

The value of this property corresponds to the setting of the Display items from different levels in separate fields check box in the New/Modify Set dialog box when a named set is created or edited. To create a new named set from data in a PivotTable based on an OLAP data source, click the PivotTable, click Field, Items, & Sets on the PivotTable Tools Options tab on the ribbon, click Manage Sets, click New in the Set Manager dialog box, and then click Create Set using MDX. This will display the New Set dialog box, which contains the Display items from different levels in separate fields check box. Similarly, if you select an existing named set in the Set Manager dialog box, and then click Edit, the Modify Set dialog box is displayed.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Formula Property (Excel)

 Copy code hover
[image]

CalculatedMember.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the member's formula in multidimensional expressions (MDX) syntax.

Syntax

expression .Formula

expression A variable that represents a CalculatedMember object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.HierarchizeDistinct Property (Excel)

 Copy code hover
[image]

CalculatedMember.HierarchizeDistinct Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to order and remove duplicates when displaying the hierarchy of the specified named set in a PivotTable report based on an OLAP cube. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .HierarchizeDistinct

expression A variable that returns a CalculatedMember object.

Return Value

Boolean

Remarks

True if the hierarchy of the named set is displayed as ordered with duplicates removed; otherwise False.

The value of this property corresponds to the Automatically order and remove duplicates from the set check box in the New/Modify Set dialog box when a named set is created or edited. To create a new named set from data in a PivotTable based on an OLAP data source, click the PivotTable, click Field, Items, & Sets on the PivotTable Tools Options tab on the ribbon, click Manage Sets, click New in the Set Manager dialog box, and then click Create Set using MDX. This will display the New Set dialog box, which contains the Automatically order and remove duplicates from the set check box. Similarly, if you select an existing named set in the Set Manager dialog box, and then click Edit, the Modify Set dialog box is displayed.

This property along with the DisplayFolder and Dynamic properties can only be read for named sets (which are represented by CalculatedMember objects where the Type property equals xlCalculatedSet). These properties for cannot be read for calculated members or measures (which are represented by CalculatedMember objects where the Type property equals xlCalculatedMember). If you attempt to read these properties for calculated members or measures, a run-time error is raised.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.IsValid Property (Excel)

 Copy code hover
[image]

CalculatedMember.IsValid Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that indicates whether the specified calculated member has been successfully instantiated with the OLAP provider during the current session.

Syntax

expression .IsValid

expression A variable that represents a CalculatedMember object.

Remarks

This property returns True even if the PivotTable is not connected to its data source. Make sure that the PivotTable is connected before querying the value of the IsValid property.

Example

This example notifies the user about whether the calculated member is valid or not. It assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckValidity()

 Dim pvtTable As PivotTable
 Dim pvtCache As PivotCache

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 ' Make connection for PivotTable before testing IsValid property.
 pvtCache.MakeConnection

 ' Check if calculated member is valid.
 If pvtTable.CalculatedMembers.Item(1).IsValid = True Then
 MsgBox "The calculated member is valid."
 Else
 MsgBox "The calculated member is not valid."
 End If

End Sub

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.MeasureGroup Property (Excel)

 Copy code hover
[image]

CalculatedMember.MeasureGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the associated measure group. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .MeasureGroup

expression A variable that represents a CalculatedMember object.

Property value

STRING

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Name Property (Excel)

 Copy code hover
[image]

CalculatedMember.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a CalculatedMember object.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.NumberFormat Property (Excel)

 Copy code hover
[image]

CalculatedMember.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlCalcMemNumberFormatType value that represents the number format of the calculated member. The default value is xlNumberFormatTypeDefault. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .NumberFormat

expression A variable that represents a CalculatedMember object.

Property value

XLCALCMEMNUMBERFORMATTYPE

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Parent Property (Excel)

 Copy code hover
[image]

CalculatedMember.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalculatedMember object.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.ParentHierarchy Property (Excel)

 Copy code hover
[image]

CalculatedMember.ParentHierarchy Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the current parent hierarchy from the hierarchies that are available on the cube. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ParentHierarchy

expression A variable that represents a CalculatedMember object.

Property value

STRING

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.ParentMember Property (Excel)

 Copy code hover
[image]

CalculatedMember.ParentMember Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the parent member for the parent hierarchy. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ParentMember

expression A variable that represents a CalculatedMember object.

Remarks

The default parent member is determined by whatever has been defined by the cube designer or Analysis Services as the default member of the selected hierarchy. For example, if an "All" member exists for the selected hierarchy, then this is typically the default parent member on the cube.

If the selected parent hierarchy does not have an "All" parent member, another default parent member is defined, either by the cube designer or programmatically by Analysis Services. (If a default member is not specified by the cube designer, the Analysis Services engine automatically defines one.)

Property value

STRING

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.SolveOrder Property (Excel)

 Copy code hover
[image]

CalculatedMember.SolveOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long specifying the value of the calculated member's solve order MDX (Mulitdimensional Expression) argument. The default value is zero. Read-only.

Syntax

expression .SolveOrder

expression A variable that represents a CalculatedMember object.

Example

This example determines the solve order for a calculated member and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckSolveOrder()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine solve order and notify user.
 If pvtTable.CalculatedMembers.Item(1).SolveOrder = 0 Then
 MsgBox "The solve order is set to the default value."
 Else
 MsgBox "The solve order is not set to the default value."
 End If

End Sub

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.SourceName Property (Excel)

 Copy code hover
[image]

CalculatedMember.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.

Syntax

expression .SourceName

expression A variable that represents a CalculatedMember object.

Remarks

The value of this property might be different from the current item name if the user renamed the item after creating the PivotTable report.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember.Type Property (Excel)

 Copy code hover
[image]

CalculatedMember.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlCalculatedMemberType value that represents the calculated member type.

Syntax

expression .Type

expression A variable that represents a CalculatedMember object.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMember Methods (Excel)

 Copy code hover
[image]

CalculatedMember Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


CalculatedMember.Delete Method (Excel)

 Copy code hover
[image]

CalculatedMember.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a CalculatedMember object.

See also

Concepts

CalculatedMember Object

Other resources

CalculatedMember Object Members


CalculatedMembers Object (Excel)

 Copy code hover
[image]

CalculatedMembers Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the CalculatedMember objects on the specified PivotTable.

Remarks

Each CalculatedMember object represents a calculated member or calculated measure.

Use the CalculatedMembers property of the PivotTable object to return a CalculatedMembers collection.

There are three supported types of calculated members: Named Sets, Calculated Measures, and Calculated Members. Object model support has been available for all three of these types since Excel 2010. User interface support was made available for Named Sets in Excel 2010. In Excel 2013, the OLAP Calculated Members and Calculated Measures feature was created to build a user interface for the calculated members and measures object model.

Named Sets are used exactly the same as in Excel 2010. Named Sets should continue to use the method CalculatedMembers.CalculatedMembers.Add Method (Excel) and the type XlCalculatedMemberType Enumeration (Excel).

Calculated Members have the following changes for Excel 2013:

  • They now use the method called CalculatedMembers.CalculatedMembers.AddCalculatedMember Method (Excel).

  • They support the property CalculatedMember.ParentHierarchy Property (Excel).

  • They support the property CalculatedMember.ParentMember Property (Excel).

  • They support the property CalculatedMember.NumberFormat Property (Excel).

Calculated Measures have the following changes for Excel 2013:

  • They now use the method called CalculatedMembers.CalculatedMembers.AddCalculatedMember Method (Excel).

  • They now use the type XlCalculatedMemberType Enumeration (Excel).

  • They support the property CalculatedMember.DisplayFolder Property (Excel).

  • They support the property CalculatedMember.NumberFormat Property (Excel).

Example

The following example adds a set to a PivotTable, assuming a PivotTable from the FoodMart SQL database exists on the active worksheet.

VBA Copy code Copy code
Sub UseCalculatedMember()
 Dim pvtTable As PivotTable
 Set pvtTable = ActiveSheet.PivotTables(1)
 pvtTable.CalculatedMembers.Add Name:="[Beef]", _
 Formula:="'{[Product].[All Products].Children}'", _
 Type:=xlCalculatedSet

End Sub
Note Note

For the Add method in the previous example, the Formula argument must have a valid MDX syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider and the Type argument has to be defined.

See also

Concepts

Excel Object Model Reference

Other resources

CalculatedMembers Object Members


CalculatedMembers Members (Excel)

 Copy code hover
[image]

CalculatedMembers Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the CalculatedMember objects on the specified PivotTable.

Methods

Name | Description
Add | Adds a calculated field or calculated item to a PivotTable. Returns a CalculatedMember object.
AddCalculatedMember | Adds a calculated field or calculated item to a PivotTable.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedMembers Properties (Excel)

 Copy code hover
[image]

CalculatedMembers Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CalculatedMembers.Application Property (Excel)

 Copy code hover
[image]

CalculatedMembers.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CalculatedMembers object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers.Count Property (Excel)

 Copy code hover
[image]

CalculatedMembers.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CalculatedMembers object.

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers.Creator Property (Excel)

 Copy code hover
[image]

CalculatedMembers.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CalculatedMembers object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers.Item Property (Excel)

 Copy code hover
[image]

CalculatedMembers.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CalculatedMembers object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

The following example notifies the user if the calculated member is valid or not. This example assumes a PivotTable exists on the active worksheet that contains either a valid or invalid calculated member.

VBA Copy code Copy code
Sub CheckValidity()

 Dim pvtTable As PivotTable
 Dim pvtCache As PivotCache

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 ' Handle run-time error if external source is not an OLEDB data source.
 On Error GoTo Not_OLEDB

 ' Check connection setting and make connection if necessary.
 If pvtCache.IsConnected = False Then
 pvtCache.MakeConnection
 End If

 ' Check if calculated member is valid.
 If pvtTable.CalculatedMembers.Item(1).IsValid = True Then
 MsgBox "The calculated member is valid."
 Else
 MsgBox "The calculated member is not valid."
 End If

Not_OLEDB:
MsgBox "The source is not an OLEDB data source."
Exit Sub

End Sub

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers.Parent Property (Excel)

 Copy code hover
[image]

CalculatedMembers.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalculatedMembers object.

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers Methods (Excel)

 Copy code hover
[image]

CalculatedMembers Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a calculated field or calculated item to a PivotTable. Returns a CalculatedMember object.
AddCalculatedMember | Adds a calculated field or calculated item to a PivotTable.


CalculatedMembers.Add Method (Excel)

 Copy code hover
[image]

CalculatedMembers.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a calculated field or calculated item to a PivotTable. Returns a CalculatedMember object.

Syntax

expression .Add(Name, Formula, SolveOrder, Type)

expression A variable that represents a CalculatedMembers object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the calculated member.
Formula | Required | String | The formula of the calculated member.
SolveOrder | Optional | Variant | The solve order for the calculated member.
Type | Optional | Variant | The type of calculated member.
Dynamic | Optional | Boolean | Specifies if the calculated member is recalculated with every update.
DisplayFolder | Optional | String | The name of the display folder for the calculated member.
HierarchizeDistinct | Optional | Boolean | Specifies whether to order and remove duplicates when displaying the hierarchy of the calculated member in a PivotTable report based on an OLAP cube.

Return Value

A CalculatedMember object that represents the new calculated field or calculated item.

Remarks

The Formula argument must contain a valid MDX (Multidimensional Expression) syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider and the Type argument has to be defined.

If you set the Type argument of this method to xlCalculatedSet, then you must call the AddSet method to make the new field set visible in the PivotTable.

Example

The following example adds a set to a PivotTable.

Note Note

Connection to the cube and existing pivot table is necessary for the sample to run.

VBA Copy code Copy code
Sub UseAddSet()

 Dim pvtOne As PivotTable
 Dim strAdd As String
 Dim strFormula As String
 Dim cbfOne As CubeField

 Set pvtOne = ActiveSheet.PivotTables(1)

 strAdd = "[MySet]"
 strFormula = "'{[Product].[All Products].[Food].children}'"

 ' Establish connection with data source if necessary.
 If Not pvtOne.PivotCache.IsConnected Then pvtOne.PivotCache.MakeConnection

 ' Add a calculated member titled "[MySet]"
 pvtOne.CalculatedMembers.Add Name:=strAdd, _
 Formula:=strFormula, Type:=xlCalculatedSet

 ' Add a set to the CubeField object.
 Set cbfOne = pvtOne.CubeFields.AddSet(Name:="[MySet]", _
 Caption:="My Set")

End Sub

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalculatedMembers.AddCalculatedMember Method (Excel)

 Copy code hover
[image]

CalculatedMembers.AddCalculatedMember Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a calculated field or calculated item to a PivotTable.

Version information

Version Added: Excel 2013

Syntax

expression .AddCalculatedMember(Name,Formula,SolveOrder,Type,DisplayFolder,MeasureGroup,ParentHierarchy,ParentMember,NumberFormat)

expression A variable that represents a CalculatedMembers object.

Parameters

Name | Required/Optional | Data type | Description
Name | Required | STRING | The name of the calculated member.
Formula | Required | VARIANT | The formula of the calculated member.
SolveOrder | Optional | VARIANT | The solve order for the calculated member.
Type | Optional | VARIANT | The type of calculated member.
DisplayFolder | Optional | VARIANT | A folder that exists to display calculated measures.
MeasureGroup | Optional | VARIANT | The group to which the calculated belongs.
ParentHierarchy | Optional | VARIANT | The parent path of the ParentMember.
ParentMember | Optional | VARIANT | The parent of the calculated member.
NumberFormat | Optional | VARIANT | The format of numbers used for calculated members.

Return value

CALCULATEDMEMBER

Remarks

The Formula argument must have a valid MDX (multidimensional expression) syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider.

  • DisplayFolder: Display folders are only valid for calculated measures. They are not valid for calculated members. The string can have semicolons ; in it. Semicolons designate multiple display folders. For example, if you use the string my folder1;myfolder2 then the calculated measure will show in two display folders one named myfolder1 the other named 'myfolder2'. The string can have backslashes \. This designates a hierarchical path for the display folder. For example, if you use the string welcome\to\seattle there will be a display folder called welcome that contains a display folder called to which contains a display folder called seattle. Display folders are virtual folders. They do not really exist in the same sense that we think of system folders. They only exist for purposes of displaying the calculated measures.

  • NumberFormat: The number formats can only be set by macros. There is no user interface for setting them. This is the only property that cannot be set via the user interface. The type is always xlNumberFormatTypeDefault when a calculated member is created via the user interface. The number formats are only valid for calculated members. They are not valid for calculated measures.

  • ParentHierarchy: The parent hierarchy can be any valid MDX hierarchy. Parent hierarchies are only valid for calculated members. They are not valid for calculated measures. If a parent member is chosen that is in a different parent hierarchy, the parent hierarchy will be automatically changed to match the parent hierarchy of the parent member. For example, assume the following macro for a calculated member:

    T-SQL Copy code Copy code
       OLEDBConnection.CalculatedMembers.AddCalculatedMember Name:="[UK+US]", _
     Formula:= _
    "[Customer].[Customer Geography].[Country].&[United Kingdom] + [Customer].[Customer Geography].[Country].&[United States] " _
     , Type:=xlCalculatedMember, SolveOrder:=0, ParentHierarchy:= _
     "[Account].[Accounts]", ParentMember:= _
    "[Customer].[Customer Geography].[Australia]", NumberFormat:= _
     xlNumberFormatTypePercent

    In this case you have specified that the parent member is from the [Customer].[Customer Geography] hierarchy yet you have given the parent hierarchy as [Account].[Accounts]. When the member is created, it will use the parent hierarchy of the parent member which is [Customer].[Customer Geography] and when you look in the Manage Calculations dialog in the UI, it will show [Customer].[Customer Geography] as the parent hierarchy rather than the one specified in the macro, i.e. [Account].[Accounts].

Example

The following code sample adds a calculated measure to a PivotTable.

Note Note

In both of these samples, the PivotTable must be refreshed after creating the calculation in order to view it in the user interface.

VBA Copy code Copy code
Sub AddCalculatedMeasure()

Dim pvt As PivotTable
Dim strName As String
Dim strFormula As String
Dim strDisplayFolder As String
Dim strMeasureGroup As String

Set pvt = Sheet1.PivotTables("PivotTable1")
strName = "[Measures].[Internet Sales Amount 25 %]"
strFormula = "[Measures].[Internet Sales Amount]*1.25"
strDisplayFolder = "My Folder\Percent Calculations"
strMeasureGroup = "Internet Sales"

pvt.CalculatedMembers. AddCalculatedMember Name:=strName, Formula:=strFormula, Type:=xlCalculatedMeasure, DisplayFolder:=strDisplayFolder, MeasureGroup:=strMeasureGroup, NumberFormat:=xlNumberFormatTypePercent

End Sub

The following code sample adds a calculated member to a PivotTable.

VBA Copy code Copy code
Sub AddCalculatedMember()

Dim pvt As PivotTable
Dim strName As String
Dim strFormula As String
Dim strParentHierarchy As String
Dim strParentMember As String

Set pvt = Sheet1.PivotTables("PivotTable1")
strName = "[Customer].[Customer Geography].[All Customers].[North America]"
strFormula = "[Customer].[Customer Geography].[Country].&[United States] + [Customer].[Customer Geography].[Country].&[Canada]"
strParentHierarchy = "[Customer].[Customer Geography]"
strParentMember = "[Customer].[Customer Geography].[All Customers]"

pvt.CalculatedMembers. AddCalculatedMember Name:=strName, Formula:=strFormula, Type:=xlCalculatedMember, ParentHierarchy:=strParentHierarchy, ParentMember:=strParentMember, SolveOrder:=0, NumberFormat:=xlNumberFormatTypeDefault

End Sub

See also

Concepts

CalculatedMembers Collection

Other resources

CalculatedMembers Object Members


CalloutFormat Object (Excel)

 Copy code hover
[image]

CalloutFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to line callouts.

Remarks

Use the Callout property to return a CalloutFormat object.

Example

The following example specifies the following attributes of shape three (a line callout) on myDocument: the callout will have a vertical accent bar that separates the text from the callout line; the angle between the callout line and the side of the callout text box will be 30 degrees; there will be no border around the callout text; the callout line will be attached to the top of the callout text box; and the callout line will contain two segments. For this example to work, shape three must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Callout
 .Accent = True
 .Angle = msoCalloutAngle30
 .Border = False
 .PresetDrop msoCalloutDropTop
 .Type = msoCalloutThree
End With

See also

Concepts

Excel Object Model Reference

Other resources

CalloutFormat Object Members


CalloutFormat Members (Excel)

 Copy code hover
[image]

CalloutFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to line callouts.

Methods

Name | Description
AutomaticLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved. Use the CustomLength method to specify that the first segment of the callout line retain the fixed length returned by the Length property whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).
CustomDrop | Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved. Use the AutomaticLength method to specify that the first segment of the callout line be scaled automatically whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.

Properties

Name | Description
Accent | Allows the user to place a vertical accent bar to separate the callout text from the callout line. Read/write MsoTriState.
Angle | Returns or sets the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write MsoCalloutAngleType.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoAttach | True if the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points to) is to the left or right of the callout text box. Read/write MsoTriState.
AutoLength | Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read/write MsoTriState.
Border | Returns or sets a MsoTriState value that represents the visibility options for the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Drop | For callouts with an explicitly set drop value, this property returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.
DropType | Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.
Gap | Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.
Length | Returns a Single value that represents the length (in points) of the first segment of the callout line (the segment attached to the text callout box.)
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a MsoCalloutType value that represents the callout format type.


CalloutFormat Properties (Excel)

 Copy code hover
[image]

CalloutFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Accent | Allows the user to place a vertical accent bar to separate the callout text from the callout line. Read/write MsoTriState.
Angle | Returns or sets the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write MsoCalloutAngleType.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoAttach | True if the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points to) is to the left or right of the callout text box. Read/write MsoTriState.
AutoLength | Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read/write MsoTriState.
Border | Returns or sets a MsoTriState value that represents the visibility options for the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Drop | For callouts with an explicitly set drop value, this property returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.
DropType | Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.
Gap | Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.
Length | Returns a Single value that represents the length (in points) of the first segment of the callout line (the segment attached to the text callout box.)
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a MsoCalloutType value that represents the callout format type.


CalloutFormat.Accent Property (Excel)

 Copy code hover
[image]

CalloutFormat.Accent Property (Excel)
See also Send feedback

Allows the user to place a vertical accent bar to separate the callout text from the callout line. Read/write MsoTriState.

Syntax

expression .Accent

expression A variable that represents a CalloutFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue. A vertical accent bar separates the callout text from the callout line.

Example

This example adds to myDocument an oval and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
    .AddShape msoShapeOval, 180, 200, 280, 130
    With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
        .TextFrame.Characters.Text = "My oval"
        With .Callout
            .Accent = msoTrue
            .Border = False
        End With
    End With
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Angle Property (Excel)

 Copy code hover
[image]

CalloutFormat.Angle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write MsoCalloutAngleType.

Syntax

expression .Angle

expression A variable that represents a CalloutFormat object.

Remarks

If you set the value of this property to anything other than msoCalloutAngleAutomatic, the callout line maintains a fixed angle as you drag the callout.

Example

This example sets to 90 degrees the callout angle for a callout named "callout1" on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes("callout1").Callout.Angle = msoCalloutAngle90

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Application Property (Excel)

 Copy code hover
[image]

CalloutFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CalloutFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.AutoAttach Property (Excel)

 Copy code hover
[image]

CalloutFormat.AutoAttach Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points to) is to the left or right of the callout text box. Read/write MsoTriState.

Syntax

expression .AutoAttach

expression A variable that represents a CalloutFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue. The place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points to) is to the left or right of the callout text box.

When the value of this property is True, the drop value (the vertical distance from the edge of the callout text box to the place where the callout line attaches) is measured from the top of the text box when the text box is to the right of the origin, and it's measured from the bottom of the text box when the text box is to the left of the origin. When the value of this property is False, the drop value is always measured from the top of the text box, regardless of the relative positions of the text box and the origin. Use the CustomDrop method to set the drop value, and use the Drop property to return the drop value.

Setting this property affects a callout only if it has an explicitly set drop value — that is, if the value of the DropType property is msoCalloutDropCustom. By default, callouts have explicitly set drop values when they're created.

Example

This example adds two callouts to myDocument. If you drag the text box for each of these callouts to the left of the callout line origin, the place on the text box where the callout line attaches will change for the automatically attached callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
    With .AddCallout(msoCalloutTwo, 420, 170, 200, 50)
        .TextFrame.Characters.Text = "auto-attached"
        .Callout.AutoAttach = True
    End With
    With .AddCallout(msoCalloutTwo, 420, 350, 200, 50)
        .TextFrame.Characters.Text = "not auto-attached"
        .Callout.AutoAttach = False
    End With
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.AutoLength Property (Excel)

 Copy code hover
[image]

CalloutFormat.AutoLength Property (Excel)
See also Send feedback

Published: July 16, 2012

Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read/write MsoTriState.

Syntax

expression .AutoLength

expression A variable that represents a CalloutFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse. The first segment of the callout retains the fixed length specified by the Length property whenever the callout is moved.

msoTriStateMixed

msoTriStateToggle

msoTrue. The first segment of the callout line (the segment attached to the text callout box) is scaled automatically whenever the callout is moved.

This property is read-only. Use the AutomaticLength method to set this property to msoTrue, and use the CustomLength method to set this property to mosFalse.

Example

This example toggles between an automatically scaling first segment and one with a fixed length for the callout line for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
    If .AutoLength Then
        .CustomLength 50
    Else
        .AutomaticLength
    End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Border Property (Excel)

 Copy code hover
[image]

CalloutFormat.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that represents the visibility options for the border of the object.

Syntax

expression .Border

expression A variable that represents a CalloutFormat object.

Remarks

The value of this property can be set to one of the following MsoTriState constants:

msoCTrue Does not apply to this object.

msoFalse Sets the border invisible.

msoTriStateMixed Does not apply to this object.

msoTriStateToggle Allows the user to switch the border from visible to invisible and vice versa.

msoTrue default. Sets the border visible.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Creator Property (Excel)

 Copy code hover
[image]

CalloutFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CalloutFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Drop Property (Excel)

 Copy code hover
[image]

CalloutFormat.Drop Property (Excel)
See also Send feedback

Published: July 16, 2012

For callouts with an explicitly set drop value, this property returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.

Syntax

expression .Drop

expression A variable that represents a CalloutFormat object.

Remarks

This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.

Use the CustomDrop method to set the value of this property.

The value of this property accurately reflects the position of the callout line attachment to the text box only if the callout has an explicitly set drop value — that is, if the value of the DropType property is msoCalloutDropCustom.

Example

This example replaces the custom drop for shape one on myDocument with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
 If .DropType = msoCalloutDropCustom Then
 If .Drop < .Parent.Height / 2 Then
 .PresetDrop msoCalloutDropTop
 Else
 .PresetDrop msoCalloutDropBottom
 End If
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.DropType Property (Excel)

 Copy code hover
[image]

CalloutFormat.DropType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.

Syntax

expression .DropType

expression A variable that represents a CalloutFormat object.

Remarks

MsoCalloutDropType can be one of these MsoCalloutDropType constants.

msoCalloutDropCenter

msoCalloutDropMixed

msoCalloutDropBottom

msoCalloutDropCustom

msoCalloutDropTop

If the callout drop type is msoCalloutDropCustom, the values of the Drop and AutoAttach properties and the relative positions of the callout text box and callout line origin (the place that the callout points to) are used to determine where the callout line attaches to the text box.

This property is read-only. Use the PresetDrop method to set the value of this property.

Example

This example replaces the custom drop for shape one on myDocument with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
    If .DropType = msoCalloutDropCustom Then
        If .Drop < .Parent.Height / 2 Then
            .PresetDrop msoCalloutDropTop
        Else
            .PresetDrop msoCalloutDropBottom
        End If
    End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Gap Property (Excel)

 Copy code hover
[image]

CalloutFormat.Gap Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.

Syntax

expression .Gap

expression A variable that represents a CalloutFormat object.

Example

This example sets the distance between the callout line and the text bounding box to 3 points for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Callout.Gap = 3

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Length Property (Excel)

 Copy code hover
[image]

CalloutFormat.Length Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Single value that represents the length (in points) of the first segment of the callout line (the segment attached to the text callout box.)

Syntax

expression .Length

expression A variable that represents a CalloutFormat object.

Remarks

This property is read-only and applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour), and for which the AutoLength property is set to False. Use the CustomLength method to set the value of this property for a CalloutFormat object.

Example

If the first line segment in the callout named "callout1" has a fixed length, this example specifies that the length of the first line segment in the callout named "callout2" on worksheet one will also be fixed at that length. For the example to work, both callouts must have multiple-segment lines.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 With .Item("callout1").Callout
 If Not .AutoLength Then len1 = .Length
 End With
 If len1 Then .Item("callout2").Callout.CustomLength len1
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Parent Property (Excel)

 Copy code hover
[image]

CalloutFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalloutFormat object.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Type Property (Excel)

 Copy code hover
[image]

CalloutFormat.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoCalloutType value that represents the callout format type.

Syntax

expression .Type

expression A variable that represents a CalloutFormat object.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat Methods (Excel)

 Copy code hover
[image]

CalloutFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AutomaticLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved. Use the CustomLength method to specify that the first segment of the callout line retain the fixed length returned by the Length property whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).
CustomDrop | Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved. Use the AutomaticLength method to specify that the first segment of the callout line be scaled automatically whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.


CalloutFormat.AutomaticLength Method (Excel)

 Copy code hover
[image]

CalloutFormat.AutomaticLength Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved. Use the CustomLength method to specify that the first segment of the callout line retain the fixed length returned by the Length property whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Syntax

expression .AutomaticLength

expression A variable that represents a CalloutFormat object.

Remarks

Applying this method sets the AutoLength property to True.

Example

This example toggles between an automatically scaling first segment and one with a fixed length for the callout line for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
 If .AutoLength Then
 .CustomLength 50
 Else
 .AutomaticLength
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.CustomDrop Method (Excel)

 Copy code hover
[image]

CalloutFormat.CustomDrop Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.

Syntax

expression .CustomDrop(Drop)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Drop | Required | Single | The drop distance, in points.

Example

This example sets the custom drop distance to 14 points, and specifies that the drop distance always be measured from the top. For the example to work, shape three must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Callout
 .CustomDrop 14
 .AutoAttach = False
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.CustomLength Method (Excel)

 Copy code hover
[image]

CalloutFormat.CustomLength Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved. Use the AutomaticLength method to specify that the first segment of the callout line be scaled automatically whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Syntax

expression .CustomLength(Length)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Length | Required | Single | The length of the first segment of the callout, in points.

Remarks

Applying this method sets the AutoLength property to False and sets the Length property to the value specified for the Length argument.

Example

This example toggles between an automatically scaling first segment and one with a fixed length for the callout line for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
 If .AutoLength Then
 .CustomLength 50
 Else
 .AutomaticLength
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.PresetDrop Method (Excel)

 Copy code hover
[image]

CalloutFormat.PresetDrop Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.

Syntax

expression .PresetDrop(DropType)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DropType | Required | MsoCalloutDropType | The starting position of the callout line relative to the text bounding box.

Example

This example specifies that the callout line attach to the top of the text bounding box for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Callout.PresetDrop msoCalloutDropTop

This example toggles between two preset drops for shape one on myDocument. For the example to work, shape one must be a callout.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Callout
    If .DropType = msoCalloutDropTop Then
        .PresetDrop msoCalloutDropBottom
    ElseIf .DropType = msoCalloutDropBottom Then
        .PresetDrop msoCalloutDropTop
    End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CategoryCollection Object (Excel)

 Copy code hover
[image]

CategoryCollection Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of visible chart categories in the chart.

Version information

Version Added: Excel 2013

See also

Other resources

CategoryCollection Object Members


CategoryCollection Members (Excel)

 Copy code hover
[image]

CategoryCollection Members (Excel)
Send feedback

Represents the collection of visible chart categories in the chart.

Methods

Name | Description
Item | Returns a single object from the CategoryCollection object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of objects in the CategoryCollection (returns the number of categories visible in the chart). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CategoryCollection Object (Excel) object. Read-only.


CategoryCollection Properties (Excel)

 Copy code hover
[image]

CategoryCollection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of objects in the CategoryCollection (returns the number of categories visible in the chart). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CategoryCollection Object (Excel) object. Read-only.


CategoryCollection.Application Property (Excel)

 Copy code hover
[image]

CategoryCollection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a CategoryCollection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
   MsgBox "This is an Excel Application object."
Else
   MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CategoryCollection.Count Property (Excel)

 Copy code hover
[image]

CategoryCollection.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the CategoryCollection (returns the number of categories visible in the chart). Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a CategoryCollection Object (Excel) object.

Property value

INT32

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CategoryCollection.Creator Property (Excel)

 Copy code hover
[image]

CategoryCollection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a CategoryCollection Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CategoryCollection.Parent Property (Excel)

 Copy code hover
[image]

CategoryCollection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CategoryCollection Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a CategoryCollection Object (Excel) object.

Remarks

This property will return the Chart object that owns this collection of categories.

Property value

OBJECT

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CategoryCollection Methods (Excel)

 Copy code hover
[image]

CategoryCollection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the CategoryCollection object.


CategoryCollection.Item Method (Excel)

 Copy code hover
[image]

CategoryCollection.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the CategoryCollection object.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a CategoryCollection object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

ChartCategory Object (Excel)

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CellFormat Object (Excel)

 Copy code hover
[image]

CellFormat Object (Excel)
See also Send feedback

Represents the search criteria for the cell format.

Remarks

Use the FindFormat or ReplaceFormat properties of the Application object to return a CellFormat object.

With a CellFormat object, you can use the Borders , Font , or Interior properties of the CellFormat object, to define the search criteria for the cell format.

Example

The following example sets the search criteria for the interior of the cell format.

VBA Copy code Copy code
Sub ChangeCellFormat()

 ' Set the interior of cell A1 to yellow.
 Range("A1").Select
 Selection.Interior.ColorIndex = 36
 MsgBox "The cell format for cell A1 is a yellow interior."

 ' Set the CellFormat object to replace yellow with green.
 With Application
 .FindFormat.Interior.ColorIndex = 36
 .ReplaceFormat.Interior.ColorIndex = 35
 End With

 ' Find and replace cell A1's yellow interior with green.
 ActiveCell.Replace What:="", Replacement:="", LookAt:=xlPart, _
 SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=True, _
 ReplaceFormat:=True
 MsgBox "The cell format for cell A1 is replaced with a green interior."

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

CellFormat Object Members


CellFormat Members (Excel)

 Copy code hover
[image]

CellFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents the search criteria for the cell format.

Methods

Name | Description
Clear | Clears the criterias set in the FindFormat and ReplaceFormat properties.

Properties

Name | Description
AddIndent | Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Borders | Returns or sets a Borders collection that represents the search criteria based on the cell's border format.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object, allowing the user to set or return the search criteria based on the cell's font format.
FormulaHidden | Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IndentLevel | Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.
Interior | Returns an Interior object allowing the user to set or return the search criteria based on the cell's interior format.
Locked | Returns or sets a Variant value that indicates if the object is locked.
MergeCells | True if the range or style contains merged cells. Read/write Variant.
NumberFormat | Returns or sets a Variant value that represents the format code for the object.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ShrinkToFit | Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
WrapText | Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.


CellFormat Properties (Excel)

 Copy code hover
[image]

CellFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddIndent | Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Borders | Returns or sets a Borders collection that represents the search criteria based on the cell's border format.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object, allowing the user to set or return the search criteria based on the cell's font format.
FormulaHidden | Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IndentLevel | Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.
Interior | Returns an Interior object allowing the user to set or return the search criteria based on the cell's interior format.
Locked | Returns or sets a Variant value that indicates if the object is locked.
MergeCells | True if the range or style contains merged cells. Read/write Variant.
NumberFormat | Returns or sets a Variant value that represents the format code for the object.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ShrinkToFit | Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
WrapText | Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.


CellFormat.AddIndent Property (Excel)

 Copy code hover
[image]

CellFormat.AddIndent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)

Syntax

expression .AddIndent

expression A variable that represents a CellFormat object.

Remarks

Set the value of this property to True to autmatically indent text when the text alignment in the cell is set, either horizontally or vertically, to equal distribution.

To set text alignment to equal distribution, you can set the VerticalAlignment property to xlVAlignDistributed when the value of the Orientation property is xlVertical, and you can set the HorizontalAlignment property to xlHAlignDistributed when the value of the Orientation property is xlHorizontal.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Application Property (Excel)

 Copy code hover
[image]

CellFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CellFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Borders Property (Excel)

 Copy code hover
[image]

CellFormat.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Borders collection that represents the search criteria based on the cell's border format.

Syntax

expression .Borders

expression A variable that represents a CellFormat object.

Example

This example sets the search criteria to identify the borders of cells that have a continuous and thick style bottom-edge, creates a cell with this condition, finds this cell, and notifies the user.

Note Note

The default color of the border is used in this example, therefore the color index is not changed.

VBA Copy code Copy code
Sub SearchCellFormat()

 ' Set the search criteria for the border of the cell format.
 With Application.FindFormat.Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThick
 End With

 ' Create a continuous thick bottom-edge border for cell A5.
 Range("A5").Select
 With Selection.Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThick
 End With
 Range("A1").Select
 MsgBox "Cell A5 has a continuous thick bottom-edge border"

 ' Find the cells based on the search criteria.
 Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
 xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
 , SearchFormat:=True).Activate
 MsgBox "Microsoft Excel has found this cell matching the search criteria."

End Sub

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Creator Property (Excel)

 Copy code hover
[image]

CellFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CellFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Font Property (Excel)

 Copy code hover
[image]

CellFormat.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object, allowing the user to set or return the search criteria based on the cell's font format.

Syntax

expression .Font

expression A variable that represents a CellFormat object.

Example

This example sets the search criteria to identify cells that contain red font, creates a cell with this condition, finds this cell, and notifies the user.

VBA Copy code Copy code
Sub SearchCellFormat()

 ' Set the search criteria for the font of the cell format.
 Application.FindFormat.Font.ColorIndex = 3

 ' Set the color index of the font for cell A5 to red.
 Range("A5").Font.ColorIndex = 3
 Range("A5").Formula = "Red font"
 Range("A1").Select
 MsgBox "Cell A5 has red font"

 ' Find the cells based on the search criteria.
 Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
 xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
 , SearchFormat:=True).Activate

 MsgBox "Microsoft Excel has found this cell matching the search criteria."

End Sub

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.FormulaHidden Property (Excel)

 Copy code hover
[image]

CellFormat.FormulaHidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.

Syntax

expression .FormulaHidden

expression A variable that represents a CellFormat object.

Remarks

This property returns True if the formula will be hidden when the worksheet is protected, Null if the specified range contains some cells withFormulaHidden equal to True and some cells with FormulaHidden equal to False.

Don't confuse this property with the Hidden property. The formula will not be hidden if the workbook is protected and the worksheet is not, but only if the worksheet is protected.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

CellFormat.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a CellFormat object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.IndentLevel Property (Excel)

 Copy code hover
[image]

CellFormat.IndentLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.

Syntax

expression .IndentLevel

expression A variable that represents a CellFormat object.

Remarks

Using this property to set the indent level to a number less than 0 (zero) or greater than 15 causes an error.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Interior Property (Excel)

 Copy code hover
[image]

CellFormat.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object allowing the user to set or return the search criteria based on the cell's interior format.

Syntax

expression .Interior

expression A variable that represents a CellFormat object.

Example

This example sets the search criteria to identify cells that contain a solid yellow interior, creates a cell with this condition, finds this cell, and notifies the user.

VBA Copy code Copy code
Sub SearchCellFormat()

 ' Set the search criteria for the interior of the cell format.
 With Application.FindFormat.Interior
 .ColorIndex = 6
 .Pattern = xlSolid
 .PatternColorIndex = xlAutomatic
 End With

 ' Create a yellow interior for cell A5.
 Range("A5").Select
 With Selection.Interior
 .ColorIndex = 6
 .Pattern = xlSolid
 .PatternColorIndex = xlAutomatic
 End With
 Range("A1").Select
 MsgBox "Cell A5 has a yellow interior."

 ' Find the cells based on the search criteria.
 Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
 xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
 , SearchFormat:=True).Activate
 MsgBox "Microsoft Excel has found this cell matching the search criteria."

End Sub

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Locked Property (Excel)

 Copy code hover
[image]

CellFormat.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a CellFormat object.

Remarks

This property returns True if the object is locked, False if the object can be modified when the sheet is protected, or Null if the specified range contains both locked and unlocked cells.

Example

This example unlocks cells A1:G37 on Sheet1 so that they can be modified when the sheet is protected.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").Locked = False
Worksheets("Sheet1").Protect

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.MergeCells Property (Excel)

 Copy code hover
[image]

CellFormat.MergeCells Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the range or style contains merged cells. Read/write Variant.

Syntax

expression .MergeCells

expression A variable that represents a CellFormat object.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.NumberFormat Property (Excel)

 Copy code hover
[image]

CellFormat.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a CellFormat object.

Remarks

This property returns Null if all cells in the specified range don't have the same number format.

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

CellFormat.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a CellFormat object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Orientation Property (Excel)

 Copy code hover
[image]

CellFormat.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a CellFormat object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.Parent Property (Excel)

 Copy code hover
[image]

CellFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CellFormat object.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.ShrinkToFit Property (Excel)

 Copy code hover
[image]

CellFormat.ShrinkToFit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.

Syntax

expression .ShrinkToFit

expression A variable that represents a CellFormat object.

Remarks

This property returns True if text automatically shrinks to fit in the available column width, or Null if this property isn't set to the same value for all cells in the specified range.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.VerticalAlignment Property (Excel)

 Copy code hover
[image]

CellFormat.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a CellFormat object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

Example

This example sets the height of row 2 on Sheet1 to twice the standard height and then centers the contents of the row vertically.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(2).RowHeight = _
 2 * Worksheets("Sheet1").StandardHeight
Worksheets("Sheet1").Rows(2).VerticalAlignment = xlVAlignCenter

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat.WrapText Property (Excel)

 Copy code hover
[image]

CellFormat.WrapText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.

Syntax

expression .WrapText

expression A variable that represents a CellFormat object.

Remarks

This property returns True if text is wrapped in all cells within the specified range, False if text is not wrapped in all cells within the specified range, or Null if the specified range contains some cells that wrap text and other cells that don't.

Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


CellFormat Methods (Excel)

 Copy code hover
[image]

CellFormat Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Clears the criterias set in the FindFormat and ReplaceFormat properties.


CellFormat.Clear Method (Excel)

 Copy code hover
[image]

CellFormat.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the criterias set in the FindFormat and ReplaceFormat properties.

Syntax

expression .Clear

expression A variable that represents a CellFormat object.

See also

Concepts

CellFormat Object

Other resources

CellFormat Object Members


Characters Object (Excel)

 Copy code hover
[image]

Characters Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents characters in an object that contains text.

Remarks

The Characters object lets you modify any sequence of characters contained in the full text string.

Use Characters(start, length), where start is the start character number and length is the number of characters, to return a Characters object.

Example

The following example adds text to cell B1 and then makes the second word bold.

VBA Copy code Copy code
With Worksheets("Sheet1").Range("B1")
 .Value = "New Title"
 .Characters(5, 5).Font.Bold = True
End With

The Characters method is necessary only when you need to change some of an object's text without affecting the rest (you cannot use the Characters method to format a portion of the text if the object doesn't support rich text). To change all the text at the same time, you can usually apply the appropriate method or property directly to the object. The following example formats the contents of cell A5 as italic.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A5").Font.Italic = True

See also

Concepts

Excel Object Model Reference

Other resources

Characters Object Members


Characters Members (Excel)

 Copy code hover
[image]

Characters Members (Excel)
Send feedback

Published: July 16, 2012

Represents characters in an object that contains text.

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a string preceding the selected characters.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the text of this range of characters.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Parent | Returns the parent object for the specified object. Read-only.
PhoneticCharacters | Returns or sets the phonetic text in the specified Characters object. Read/write String.
Text | Returns or sets the text for the specified object. Read/write String.


Characters Properties (Excel)

 Copy code hover
[image]

Characters Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the text of this range of characters.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Parent | Returns the parent object for the specified object. Read-only.
PhoneticCharacters | Returns or sets the phonetic text in the specified Characters object. Read/write String.
Text | Returns or sets the text for the specified object. Read/write String.


Characters.Application Property (Excel)

 Copy code hover
[image]

Characters.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Characters object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Caption Property (Excel)

 Copy code hover
[image]

Characters.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the text of this range of characters.

Syntax

expression .Caption

expression A variable that represents a Characters object.

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Count Property (Excel)

 Copy code hover
[image]

Characters.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Characters object.

Example

This example makes the last character in cell A1 a superscript character.

VBA Copy code Copy code
Sub MakeSuperscript()
 Dim n As Integer

 n = Worksheets("Sheet1").Range("A1").Characters.Count
 Worksheets("Sheet1").Range("A1").Characters(n, 1) _
 .Font.Superscript = True
End Sub

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Creator Property (Excel)

 Copy code hover
[image]

Characters.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Characters object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Font Property (Excel)

 Copy code hover
[image]

Characters.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a Characters object.

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Parent Property (Excel)

 Copy code hover
[image]

Characters.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Characters object.

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.PhoneticCharacters Property (Excel)

 Copy code hover
[image]

Characters.PhoneticCharacters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the phonetic text in the specified Characters object. Read/write String.

Syntax

expression .PhoneticCharacters

expression A variable that represents a Characters object.

Remarks

Instead of using this property, you should use the Add method of the Phonetics collection to add phonetic information to a cell, and use the Text property of the Phonetic object to return or set the phonetic text strings in a cell.

Example

This example replaces the fourth character from the beginning of the text in the active cell with Furigana characters.

VBA Copy code Copy code
ActiveCell.Characters(1,3).PhoneticCharacters = "フリガナ"

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Text Property (Excel)

 Copy code hover
[image]

Characters.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a Characters object.

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters Methods (Excel)

 Copy code hover
[image]

Characters Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a string preceding the selected characters.


Characters.Delete Method (Excel)

 Copy code hover
[image]

Characters.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Characters object.

Return Value

Variant

See also

Concepts

Characters Object

Other resources

Characters Object Members


Characters.Insert Method (Excel)

 Copy code hover
[image]

Characters.Insert Method (Excel)
See also Send feedback

Inserts a string preceding the selected characters.

Syntax

expression .Insert(String)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The string to insert.

Return Value

Variant

See also

Concepts

Characters Object

Other resources

Characters Object Members


Chart Object (Excel)

 Copy code hover
[image]

Chart Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a chart in a workbook.

Remarks

The chart can be either an embedded chart (contained in a ChartObject object) or a separate chart sheet.

The following properties and methods for returning a Chart object are described in the example section:

  • Charts method

  • ActiveChart property

  • ActiveSheet property

Example

The Charts collection contains a Chart object for each chart sheet in a workbook. Use Charts(index), where index is the chart-sheet index number or name, to return a single Chart object. The chart index number represents the position of the chart sheet on the workbook tab bar. Charts(1) is the first (leftmost) chart in the workbook; Charts(Charts.Count) is the last (rightmost). All chart sheets are included in the index count, even if they are hidden. The chart-sheet name is shown on the workbook tab for the chart. You can use the Name property to set or return the chart name. The following example changes the color of series 1 on chart sheet 1.

VBA Copy code Copy code
Charts(1).SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbRed

The following example moves the chart named Sales to the end of the active workbook.

VBA Copy code Copy code
Charts("Sales").Move after:=Sheets(Sheets.Count)

The Chart object is also a member of the Sheets collection, which contains all the sheets in the workbook (both chart sheets and worksheets). Use Sheets(index), where index is the sheet index number or name, to return a single sheet.

When a chart is the active object, you can use the ActiveChart property to refer to it. A chart sheet is active if the user has selected it or if it has been activated with the Activate method of the Chart object or the Activate method of the ChartObject object. The following example activates chart sheet 1 and then sets the chart type and title.

VBA Copy code Copy code
Charts(1).Activate
With ActiveChart
 .Type = xlLine
 .HasTitle = True
 .ChartTitle.Text = "January Sales"
End With

An embedded chart is active if the user has selected it or the ChartObject object in which it is contained has been activated with the Activate method. The following example activates embedded chart 1 on worksheet 1 and then sets the chart type and title. Notice that after the embedded chart has been activated, the code in this example is the same as that in the previous example. Using the ActiveChart property allows you to write Visual Basic code that can refer to either an embedded chart or a chart sheet (whichever is active).

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Activate
ActiveChart.ChartType = xlLine
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "January Sales"

When a chart sheet is the active sheet, you can use the ActiveSheet property to refer to it. The following example uses the Activate method to activate the chart sheet named Chart1 and then sets the interior color for series 1 in the chart to blue.

VBA Copy code Copy code
Charts("chart1").Activate
ActiveSheet.SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbBlue

See also

Concepts

Excel Object Model Reference

Other resources

Chart Object Members


Chart Members (Excel)

 Copy code hover
[image]

Chart Members (Excel)
Send feedback

Published: July 16, 2012

Represents a chart in a workbook.

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
BeforeDoubleClick | Occurs when a chart element is double-clicked, before the default double-click action.
BeforeRightClick | Occurs when a chart element is right-clicked, before the default right-click action.
Calculate | Occurs after the chart plots new or changed data, for the Chart object.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
MouseDown | Occurs when a mouse button is pressed while the pointer is over a chart.
MouseMove | Occurs when the position of the mouse pointer changes over a chart.
MouseUp | Occurs when a mouse button is released while the pointer is over a chart.
Resize | Occurs when the chart is resized.
Select | Occurs when a chart element is selected.
SeriesChange | Occurs when the user changes the value of a chart data point by clicking a bar in the chart and dragging the top edge up or down thus changing the value of the data point.

Methods

Name | Description
Activate | Makes the current chart the active chart.
ApplyChartTemplate | Applies a standard or custom chart type to a chart.
ApplyDataLabels | Applies data labels to all the series in a chart.
ApplyLayout | Applies the layouts shown in the ribbon.
Axes | Returns an object that represents either a single axis or a collection of the axes on the chart.
ChartGroups | Returns an object that represents either a single chart group (a ChartGroup object) or a collection of all the chart groups in the chart (a ChartGroups object). The returned collection includes every type of group.
ChartObjects | Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.
ChartWizard | Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.
CheckSpelling | Checks the spelling of an object.
ClearToMatchColorStyle | Clears all colors on the specified chart that do not follow the color style applied to the chart.
ClearToMatchStyle | Clears the chart elements formatting to automatic.
Copy | Copies the sheet to another location in the workbook.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Delete | Deletes the object.
Evaluate | Converts a Microsoft Excel name to an object or a value.
Export | Exports the chart in a graphic format.
ExportAsFixedFormat | Exports to a file of the specified format.
FullSeriesCollection | Enables retrieving the filtered out series specified by the Index argument.
GetChartElement | Returns information about the chart element at specified X and Y coordinates. This method is unusual in that you specify values for only the first two arguments. Microsoft Excel fills in the other arguments, and your code should examine those values when the method returns.
Location | Moves the chart to a new location.
Move | Moves the chart to another location in the workbook.
OLEObjects | Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.
Paste | Pastes chart data from the Clipboard into the specified chart.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a chart so that it cannot be modified.
Refresh | Causes the specified chart to be redrawn immediately.
SaveAs | Saves changes to the chart or worksheet in a different file.
SaveChartTemplate | Saves a custom chart template to the list of available chart templates.
Select | Selects the object.
SeriesCollection | Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.
SetBackgroundPicture | Sets the background graphic for a chart.
SetDefaultChart | Specifies the name of the chart template that Microsoft Excel uses when creating new charts.
SetElement | Sets chart elements on a chart. Read/write MsoChartElementType.
SetSourceData | Sets the source data range for the chart.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoScaling | True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.
BackWall | Returns a Walls object that allows the user to individually format the back wall of a 3-D chart. Read-only.
BarShape | Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.
CategoryLabelLevel | Returns a XlCategoryLabelLevel Enumeration (Excel) constant referring to the level of where the category labels are being sourced from. Integer Read/Write.
ChartArea | Returns a ChartArea object that represents the complete chart area for the chart. Read-only.
ChartColor | Returns or sets an Integer that represents the color scheme for the chart. Read-write.
ChartStyle | Returns or sets the chart style for the chart. Read/write Variant.
ChartTitle | Returns a ChartTitle object that represents the title of the specified chart. Read-only.
ChartType | Returns or sets the chart type. Read/write XlChartType.
CodeName | Returns the code name for the object. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataTable | Returns a DataTable object that represents the chart data table. Read-only.
DepthPercent | Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.
DisplayBlanksAs | Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.
Elevation | Returns or sets the elevation of the 3-D chart view, in degrees. Read/write Long.
Floor | Returns a Floor object that represents the floor of the 3-D chart. Read-only.
GapDepth | Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500. Read/write Long.
HasAxis | Returns or sets which axes exist on the chart. Read/write Variant.
HasDataTable | True if the chart has a data table. Read/write Boolean.
HasLegend | True if the chart has a legend. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
HeightPercent | Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). Read/write Long.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the chart.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Legend | Returns a Legend object that represents the legend for the chart. Read-only.
MailEnvelope | Rrepresents an e-mail header for a document.
Name | Returns or sets a String value representing the name of the object.
Next | Returns a Worksheet object that represents the next sheet.
PageSetup | Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Perspective | Returns or sets a Long value that represents the perspective for the 3-D chart view.
PivotLayout | Returns a PivotLayout object that represents the placement of fields in a PivotTable report and the placement of axes in a PivotChart report. Read-only.
PlotArea | Returns a PlotArea object that represents the plot area of a chart. Read-only.
PlotBy | Returns or sets the way columns or rows are used as data series on the chart. Can be one of the following XlRowCol constants: xlColumns or xlRows. Read/write Long.
PlotVisibleOnly | True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.
Previous | Returns a Worksheet object that represents the next sheet.
PrintedCommentPages | Returns the number of comment pages that will be printed for the current chart. Read-only
ProtectContents | True if the contents of the sheet are protected. For a chart, this protects the entire chart. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.
ProtectData | True if series formulas cannot be modified by the user. Read/write Boolean.
ProtectDrawingObjects | True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.
ProtectFormatting | True if chart formatting cannot be modified by the user. Read/write Boolean.
ProtectionMode | True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.
ProtectSelection | True if chart elements cannot be selected. Read/write Boolean.
RightAngleAxes | True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. Read/write Boolean.
Rotation | Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts. Read/write Variant.
SeriesNameLevel | Returns a XlSeriesNameLevel Enumeration (Excel) constant referring to the level of where the series names are being sourced from. Integer Read/Write.
Shapes | Returns a Shapes collection that represents all the shapes on the chart sheet. Read-only.
ShowAllFieldButtons | Returns or sets whether to display all field buttons on a PivotChart. Read/write
ShowAxisFieldButtons | Returns or sets whether to display axis field buttons on a PivotChart. Read/write
ShowDataLabelsOverMaximum | Returns or sets whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.
ShowLegendFieldButtons | Returns or sets whether to display legend field buttons on a PivotChart. Read/write
ShowReportFilterFieldButtons | Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write
ShowValueFieldButtons | Returns or sets whether to display the value field buttons on a PivotChart. Read/write
SideWall | Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.
Tab | Returns a Tab object for a chart.
Visible | Returns or sets an XlSheetVisibility value that determines whether the object is visible.
Walls | Returns a Walls object that represents the walls of the 3-D chart. Read-only.


Chart Properties (Excel)

 Copy code hover
[image]

Chart Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoScaling | True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.
BackWall | Returns a Walls object that allows the user to individually format the back wall of a 3-D chart. Read-only.
BarShape | Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.
CategoryLabelLevel | Returns a XlCategoryLabelLevel Enumeration (Excel) constant referring to the level of where the category labels are being sourced from. Integer Read/Write.
ChartArea | Returns a ChartArea object that represents the complete chart area for the chart. Read-only.
ChartColor | Returns or sets an Integer that represents the color scheme for the chart. Read-write.
ChartStyle | Returns or sets the chart style for the chart. Read/write Variant.
ChartTitle | Returns a ChartTitle object that represents the title of the specified chart. Read-only.
ChartType | Returns or sets the chart type. Read/write XlChartType.
CodeName | Returns the code name for the object. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataTable | Returns a DataTable object that represents the chart data table. Read-only.
DepthPercent | Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.
DisplayBlanksAs | Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.
Elevation | Returns or sets the elevation of the 3-D chart view, in degrees. Read/write Long.
Floor | Returns a Floor object that represents the floor of the 3-D chart. Read-only.
GapDepth | Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500. Read/write Long.
HasAxis | Returns or sets which axes exist on the chart. Read/write Variant.
HasDataTable | True if the chart has a data table. Read/write Boolean.
HasLegend | True if the chart has a legend. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
HeightPercent | Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). Read/write Long.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the chart.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Legend | Returns a Legend object that represents the legend for the chart. Read-only.
MailEnvelope | Rrepresents an e-mail header for a document.
Name | Returns or sets a String value representing the name of the object.
Next | Returns a Worksheet object that represents the next sheet.
PageSetup | Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Perspective | Returns or sets a Long value that represents the perspective for the 3-D chart view.
PivotLayout | Returns a PivotLayout object that represents the placement of fields in a PivotTable report and the placement of axes in a PivotChart report. Read-only.
PlotArea | Returns a PlotArea object that represents the plot area of a chart. Read-only.
PlotBy | Returns or sets the way columns or rows are used as data series on the chart. Can be one of the following XlRowCol constants: xlColumns or xlRows. Read/write Long.
PlotVisibleOnly | True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.
Previous | Returns a Worksheet object that represents the next sheet.
PrintedCommentPages | Returns the number of comment pages that will be printed for the current chart. Read-only
ProtectContents | True if the contents of the sheet are protected. For a chart, this protects the entire chart. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.
ProtectData | True if series formulas cannot be modified by the user. Read/write Boolean.
ProtectDrawingObjects | True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.
ProtectFormatting | True if chart formatting cannot be modified by the user. Read/write Boolean.
ProtectionMode | True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.
ProtectSelection | True if chart elements cannot be selected. Read/write Boolean.
RightAngleAxes | True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. Read/write Boolean.
Rotation | Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts. Read/write Variant.
SeriesNameLevel | Returns a XlSeriesNameLevel Enumeration (Excel) constant referring to the level of where the series names are being sourced from. Integer Read/Write.
Shapes | Returns a Shapes collection that represents all the shapes on the chart sheet. Read-only.
ShowAllFieldButtons | Returns or sets whether to display all field buttons on a PivotChart. Read/write
ShowAxisFieldButtons | Returns or sets whether to display axis field buttons on a PivotChart. Read/write
ShowDataLabelsOverMaximum | Returns or sets whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.
ShowLegendFieldButtons | Returns or sets whether to display legend field buttons on a PivotChart. Read/write
ShowReportFilterFieldButtons | Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write
ShowValueFieldButtons | Returns or sets whether to display the value field buttons on a PivotChart. Read/write
SideWall | Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.
Tab | Returns a Tab object for a chart.
Visible | Returns or sets an XlSheetVisibility value that determines whether the object is visible.
Walls | Returns a Walls object that represents the walls of the 3-D chart. Read-only.


Chart.Application Property (Excel)

 Copy code hover
[image]

Chart.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Chart object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.AutoScaling Property (Excel)

 Copy code hover
[image]

Chart.AutoScaling Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.

Syntax

expression .AutoScaling

expression A variable that represents a Chart object.

Example

This example automatically scales Chart1. The example should be run on a 3-D chart.

VBA Copy code Copy code
With Charts("Chart1")
 .RightAngleAxes = True
 .AutoScaling = True
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BackWall Property (Excel)

 Copy code hover
[image]

Chart.BackWall Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Walls object that allows the user to individually format the back wall of a 3-D chart. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .BackWall

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BarShape Property (Excel)

 Copy code hover
[image]

Chart.BarShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.

Syntax

expression .BarShape

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CategoryLabelLevel Property (Excel)

 Copy code hover
[image]

Chart.CategoryLabelLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlCategoryLabelLevel Enumeration (Excel) constant referring to the level of where the category labels are being sourced from. Integer Read/Write.

Version information

Version Added: Excel 2013

Syntax

expression .CategoryLabelLevel

expression A variable that represents a Chart object.

Remarks

If there is a hierarchy, 0 refers to the most parent level, 1 refers to its children, and so on. So, 0 equals the first level, 1 equals the second level, 2 equals the third level, and so on.

Example

The following sample code uses the CategoryNameLevel property to set the chart categories names from previously created row.

VBA Copy code Copy code
    Sheets(1).Range("C1:E1").Value2 = "Sample_Row1"
    Sheets(1).Range("C2:E2").Value2 = "Sample_Row2"
    Sheets(1).Range("A3:A5").Value2 = "Sample_ColA"
    Sheets(1).Range("B3:B5").Value2 = "Sample_ColB"
    Sheets(1).Range("C3:E5").Formula = "=row()"
    Dim crt As Chart
    Set crt = Sheets(1).ChartObjects.Add(0, 0, 500, 200).Chart
    crt.SetSourceData Sheets(1).Range("A1:E5")
    ' Set the series names to only use column B
    crt.SeriesNameLevel = 1
    ' Use columns A and B for the series names
    crt.SeriesNameLevel = xlSeriesNameLevelAll
    ' Use row 1 for the category labels
    crt.CategoryLabelLevel = 0
    ' Use rows 1 and 2 for the category labels
    crt.CategoryLabelLevel = xlCategoryLabelLevelAll

Property value

XLCATEGORYLABELLEVEL

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartArea Property (Excel)

 Copy code hover
[image]

Chart.ChartArea Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ChartArea object that represents the complete chart area for the chart. Read-only.

Syntax

expression .ChartArea

expression A variable that represents a Chart object.

Example

This example sets the chart area interior color of Chart1 to red and sets the border color to blue.

VBA Copy code Copy code
With Charts("Chart1").ChartArea
 .Interior.ColorIndex = 3
 .Border.ColorIndex = 5
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartColor Property (Excel)

 Copy code hover
[image]

Chart.ChartColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the color scheme for the chart. Read-write.

Version information

Version Added: Excel 2013

Syntax

expression .ChartColor

expression A variable that represents a Chart object.

Property value

VARIANT

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartStyle Property (Excel)

 Copy code hover
[image]

Chart.ChartStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart style for the chart. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .ChartStyle

expression A variable that represents a Chart object.

Remarks

You can use a number from 1 to 48 to set the chart style.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartTitle Property (Excel)

 Copy code hover
[image]

Chart.ChartTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ChartTitle object that represents the title of the specified chart. Read-only.

Syntax

expression .ChartTitle

expression A variable that represents a Chart object.

Example

This example sets the text for the title of Chart1.

VBA Copy code Copy code
With Charts("Chart1")
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartType Property (Excel)

 Copy code hover
[image]

Chart.ChartType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart type. Read/write XlChartType.

Syntax

expression .ChartType

expression A variable that represents a Chart object.

Remarks

Some chart types aren't available for PivotChart reports.

Example

This example sets the bubble size in chart group one to 200% of the default size if the chart is a 2D bubble chart.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 If .ChartType = xlBubble Then
 .ChartGroups(1).BubbleScale = 200
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CodeName Property (Excel)

 Copy code hover
[image]

Chart.CodeName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the code name for the object. Read-only String.

Syntax

expression .CodeName

expression An expression that returns a Chart object.

Remarks

The value that you see in the cell to the right of (Name) in the Properties window is the code name of the selected object. At design time, you can change the code name of an object by changing this value. You cannot programmatically change this property at run time.

The code name for an object can be used in place of an expression that returns the object. For example, if the code name for worksheet one is "Sheet1", the following expressions are identical:

VBA Copy code Copy code
Worksheets(1).Range("a1")
Sheet1.Range("a1")

It's possible for the sheet name to be different from the code name. When you create a sheet, the sheet name and code name are the same, but changing the sheet name doesn't change the code name, and changing the code name (using the Properties window in the Visual Basic Editor) doesn't change the sheet name.

Example

This example displays the code name for worksheet one.

VBA Copy code Copy code
MsgBox Worksheets(1).CodeName

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Creator Property (Excel)

 Copy code hover
[image]

Chart.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Chart object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DataTable Property (Excel)

 Copy code hover
[image]

Chart.DataTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DataTable object that represents the chart data table. Read-only.

Syntax

expression .DataTable

expression A variable that represents a Chart object.

Example

This example adds a data table with an outline border to the embedded chart.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 .DataTable.HasBorderOutline = True
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DepthPercent Property (Excel)

 Copy code hover
[image]

Chart.DepthPercent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.

Syntax

expression .DepthPercent

expression A variable that represents a Chart object.

Example

This example sets the depth of Chart1 to be 50 percent of its width. The example should be run on a 3-D chart (the DepthPercent property fails on 2-D charts).

VBA Copy code Copy code
Charts("Chart1").DepthPercent = 50

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DisplayBlanksAs Property (Excel)

 Copy code hover
[image]

Chart.DisplayBlanksAs Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.

Syntax

expression .DisplayBlanksAs

expression A variable that represents a Chart object.

Example

This example sets Microsoft Excel to not plot blank cells in Chart1.

VBA Copy code Copy code
Charts("Chart1").DisplayBlanksAs = xlNotPlotted

See also

Concepts

Chart Object
SparklineGroup Object

Other resources

Chart Object Members
SparklineGroup Object Members


Chart.Elevation Property (Excel)

 Copy code hover
[image]

Chart.Elevation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the elevation of the 3-D chart view, in degrees. Read/write Long.

Syntax

expression .Elevation

expression A variable that represents a Chart object.

Remarks

The chart elevation is the height at which you view the chart, in degrees. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.

Example

This example sets the chart elevation of Chart1 to 34 degrees. The example should be run on a 3-D chart (the Elevation property fails on 2-D charts).

VBA Copy code Copy code
Charts("Chart1").Elevation = 34

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Floor Property (Excel)

 Copy code hover
[image]

Chart.Floor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Floor object that represents the floor of the 3-D chart. Read-only.

Syntax

expression .Floor

expression An expression that returns a Chart object.

Return Value

Floor

Example

This example sets the floor color of Chart1 to blue. The example should be run on a 3-D chart (the Floor property fails on 2-D charts).

VBA Copy code Copy code
Charts("Chart1").Floor.Interior.ColorIndex = 5

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.GapDepth Property (Excel)

 Copy code hover
[image]

Chart.GapDepth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500. Read/write Long.

Syntax

expression .GapDepth

expression A variable that represents a Chart object.

Example

This example sets the distance between the data series in Chart1 to 200 percent of the marker width. The example should be run on a 3-D chart (the GapDepth property fails on 2-D charts).

VBA Copy code Copy code
Charts("Chart1").GapDepth = 200

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasAxis Property (Excel)

 Copy code hover
[image]

Chart.HasAxis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets which axes exist on the chart. Read/write Variant.

Syntax

expression .HasAxis(Index1, Index2)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index1 | Required | Variant | The axis type. Series axes apply only to 3-D charts. Can be one of the XlAxisType constants.
Index2 | Optional | Variant | The axis group. 3-D charts have only one set of axes. Can be one of the XlAxisGroup constants.

Remarks

You must enter a value for at least one of the parameters when setting this property.

Microsoft Excel may create or delete axes if you change the chart type or the Axis.AxisGroup, Chart.AxisGroup, or Series.AxisGroup properties.

Example

This example turns on the primary value axis for Chart1.

VBA Copy code Copy code
Charts("Chart1").HasAxis(xlValue, xlPrimary) = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasDataTable Property (Excel)

 Copy code hover
[image]

Chart.HasDataTable Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart has a data table. Read/write Boolean.

Syntax

expression .HasDataTable

expression A variable that represents a Chart object.

Example

This example causes the embedded chart data table to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasLegend Property (Excel)

 Copy code hover
[image]

Chart.HasLegend Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart has a legend. Read/write Boolean.

Syntax

expression .HasLegend

expression A variable that represents a Chart object.

Example

This example turns on the legend for Chart1 and then sets the legend font color to blue.

VBA Copy code Copy code
With Charts("Chart1")
 .HasLegend = True
 .Legend.Font.ColorIndex = 5
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasTitle Property (Excel)

 Copy code hover
[image]

Chart.HasTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the axis or chart has a visible title. Read/write Boolean.

Syntax

expression .HasTitle

expression A variable that represents a Chart object.

Remarks

A chart title is represented by a ChartTitle object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HeightPercent Property (Excel)

 Copy code hover
[image]

Chart.HeightPercent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). Read/write Long.

Syntax

expression .HeightPercent

expression A variable that represents a Chart object.

Example

This example sets the height of Chart1 to 80 percent of its width. The example should be run on a 3-D chart.

VBA Copy code Copy code
Charts("Chart1").HeightPercent = 80

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Hyperlinks Property (Excel)

 Copy code hover
[image]

Chart.Hyperlinks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents the hyperlinks for the chart.

Syntax

expression .Hyperlinks

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Index Property (Excel)

 Copy code hover
[image]

Chart.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Legend Property (Excel)

 Copy code hover
[image]

Chart.Legend Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Legend object that represents the legend for the chart. Read-only.

Syntax

expression .Legend

expression A variable that represents a Chart object.

Example

This example turns on the legend for Chart1 and then sets the legend font color to blue.

VBA Copy code Copy code
Charts("Chart1").HasLegend = True
Charts("Chart1").Legend.Font.ColorIndex = 5

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.MailEnvelope Property (Excel)

 Copy code hover
[image]

Chart.MailEnvelope Property (Excel)
See also Send feedback

Published: July 16, 2012

Rrepresents an e-mail header for a document.

Syntax

expression .MailEnvelope

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Name Property (Excel)

 Copy code hover
[image]

Chart.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Chart object.

Remarks

This property is read-only for chart objects (embedded charts).

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Next Property (Excel)

 Copy code hover
[image]

Chart.Next Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Worksheet object that represents the next sheet.

Syntax

expression .Next

expression A variable that represents a Chart object.

Remarks

If the object is a range, this property emulates the TAB key, although the property returns the next cell without selecting it.

On a protected sheet, this property returns the next unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the right of the specified cell.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PageSetup Property (Excel)

 Copy code hover
[image]

Chart.PageSetup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.

Syntax

expression .PageSetup

expression A variable that represents a Chart object.

Example

This example sets the center header text for Chart1.

VBA Copy code Copy code
Charts("Chart1").PageSetup.CenterHeader = "December Sales"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Parent Property (Excel)

 Copy code hover
[image]

Chart.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Perspective Property (Excel)

 Copy code hover
[image]

Chart.Perspective Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the perspective for the 3-D chart view.

Syntax

expression .Perspective

expression A variable that represents a Chart object.

Remarks

The value of this property must be between 0 and 100. This property is ignored if the RightAngleAxes property is True.

Example

This example sets the perspective of Chart1 to 70. The example should be run on a 3-D chart.

VBA Copy code Copy code
Charts("Chart1").RightAngleAxes = False
Charts("Chart1").Perspective = 70

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PivotLayout Property (Excel)

 Copy code hover
[image]

Chart.PivotLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotLayout object that represents the placement of fields in a PivotTable report and the placement of axes in a PivotChart report. Read-only.

Syntax

expression .PivotLayout

expression A variable that represents a Chart object.

Remarks

If the chart you specify isn't a PivotChart report, the value of this property is Nothing.

Example

This example creates a list of all the PivotTable field names used in the first PivotChart report.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objPF In _
 Charts("Chart1").PivotLayout.PivotFields
 objNewSheet.Cells(intRow, 1).Value = objPF.Caption
 intRow = intRow + 1
Next objPF

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PlotArea Property (Excel)

 Copy code hover
[image]

Chart.PlotArea Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PlotArea object that represents the plot area of a chart. Read-only.

Syntax

expression .PlotArea

expression A variable that represents a Chart object.

Example

This example sets the color of the plot area interior of Chart1 to cyan.

VBA Copy code Copy code
Charts("Chart1").PlotArea.Interior.ColorIndex = 8

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PlotBy Property (Excel)

 Copy code hover
[image]

Chart.PlotBy Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way columns or rows are used as data series on the chart. Can be one of the following XlRowCol constants: xlColumns or xlRows. Read/write Long.

Syntax

expression .PlotBy

expression A variable that represents a Chart object.

Remarks

For PivotChart reports, this property is read-only and always returns xlColumns.

Example

This example causes the embedded chart to plot data by columns.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart.PlotBy = xlColumns

See also

Concepts

SparklineGroup Object
Chart Object

Other resources

SparklineGroup Object Members
Chart Object Members


Chart.PlotVisibleOnly Property (Excel)

 Copy code hover
[image]

Chart.PlotVisibleOnly Property (Excel)
See also Send feedback

Published: July 16, 2012

True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.

Syntax

expression .PlotVisibleOnly

expression A variable that represents a Chart object.

Example

This example causes Microsoft Excel to plot only visible cells in Chart1.

VBA Copy code Copy code
Charts("Chart1").PlotVisibleOnly = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Previous Property (Excel)

 Copy code hover
[image]

Chart.Previous Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Worksheet object that represents the next sheet.

Syntax

expression .Previous

expression A variable that represents a Chart object.

Remarks

If the object is a range, this property emulates pressing SHIFT+TAB; unlike the key combination, however, the property returns the previous cell without selecting it.

On a protected sheet, this property returns the previous unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the left of the specified cell.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PrintedCommentPages Property (Excel)

 Copy code hover
[image]

Chart.PrintedCommentPages Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of comment pages that will be printed for the current chart. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PrintedCommentPages

expression A variable that returns a Chart object.

Return Value

Long

Remarks

Because charts and chart sheets do not support comments, the PrintedCommentPages property of the Chart object will always return zero.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectContents Property (Excel)

 Copy code hover
[image]

Chart.ProtectContents Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the contents of the sheet are protected. For a chart, this protects the entire chart. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.

Syntax

expression .ProtectContents

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectData Property (Excel)

 Copy code hover
[image]

Chart.ProtectData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if series formulas cannot be modified by the user. Read/write Boolean.

Syntax

expression .ProtectData

expression A variable that represents a Chart object.

Remarks

This property is not persisted when the file is saved. If you set this property to True and then reopen the file, it will no longer be set to True.

Example

This example protects the data on embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart.ProtectData = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectDrawingObjects Property (Excel)

 Copy code hover
[image]

Chart.ProtectDrawingObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.

Syntax

expression .ProtectDrawingObjects

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectFormatting Property (Excel)

 Copy code hover
[image]

Chart.ProtectFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if chart formatting cannot be modified by the user. Read/write Boolean.

Syntax

expression .ProtectFormatting

expression A variable that represents a Chart object.

Remarks

This property is not persisted when the file is saved. If you set this property to True and then reopen the file, it will no longer be set to True.

Example

This example protects the formatting of embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart.ProtectFormatting = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectionMode Property (Excel)

 Copy code hover
[image]

Chart.ProtectionMode Property (Excel)
See also Send feedback

Published: July 16, 2012

True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.

Syntax

expression .ProtectionMode

expression A variable that represents a Chart object.

Example

This example displays the status of the ProtectionMode property.

VBA Copy code Copy code
MsgBox ActiveSheet.ProtectionMode

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ProtectSelection Property (Excel)

 Copy code hover
[image]

Chart.ProtectSelection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if chart elements cannot be selected. Read/write Boolean.

Syntax

expression .ProtectSelection

expression A variable that represents a Chart object.

Remarks

When this property is True, shapes cannot be added to the chart, and the Click and DoubleClick events for chart elements don't occur.

This property is not persisted when the file is saved. If you set this property to True and then reopen the file, it will no longer be set to True.

Example

This example prevents chart elements from being selected on embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart.ProtectSelection = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.RightAngleAxes Property (Excel)

 Copy code hover
[image]

Chart.RightAngleAxes Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. Read/write Boolean.

Syntax

expression .RightAngleAxes

expression A variable that represents a Chart object.

Remarks

If this property is True, the Perspective property is ignored.

Example

This example sets the axes in Chart1 to intersect at right angles. The example should be run on a 3-D chart.

VBA Copy code Copy code
Charts("Chart1").RightAngleAxes = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Rotation Property (Excel)

 Copy code hover
[image]

Chart.Rotation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts. Read/write Variant.

Syntax

expression .Rotation

expression A variable that represents a Chart object.

Remarks

Rotations are always rounded to the nearest integer.

Example

This example sets the rotation of Chart1 to 30 degrees. The example should be run on a 3-D chart.

VBA Copy code Copy code
Charts("Chart1").Rotation = 30

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SeriesNameLevel Property (Excel)

 Copy code hover
[image]

Chart.SeriesNameLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlSeriesNameLevel Enumeration (Excel) constant referring to the level of where the series names are being sourced from. Integer Read/Write.

Version information

Version Added: Excel 2013

Syntax

expression .SeriesNameLevel

expression A variable that represents a Chart object.

Remarks

If there is a hierarchy, 0 refers to the most parent level, 1 refers to its children, and so on. So, 0 equals the first level, 1 equals the second level, 2 equals the third level, and so on.

Example

The following sample code uses the SeriesNameLevel property to set the chart series names from previously created columns.

VBA Copy code Copy code
    Sheets(1).Range("C1:E1").Value2 = "Sample_Row1"
    Sheets(1).Range("C2:E2").Value2 = "Sample_Row2"
    Sheets(1).Range("A3:A5").Value2 = "Sample_ColA"
    Sheets(1).Range("B3:B5").Value2 = "Sample_ColB"
    Sheets(1).Range("C3:E5").Formula = "=row()"
    Dim crt As Chart
    Set crt = Sheets(1).ChartObjects.Add(0, 0, 500, 200).Chart
    crt.SetSourceData Sheets(1).Range("A1:E5")
    ' Set the series names to only use column B
    crt.SeriesNameLevel = 1
    ' Use columns A and B for the series names
    crt.SeriesNameLevel = xlSeriesNameLevelAll
    ' Use row 1 for the category labels
    crt.CategoryLabelLevel = 0
    ' Use rows 1 and 2 for the category labels
    crt.CategoryLabelLevel = xlCategoryLabelLevelAll

Property value

XLSERIESNAMELEVEL

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Shapes Property (Excel)

 Copy code hover
[image]

Chart.Shapes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shapes collection that represents all the shapes on the chart sheet. Read-only.

Syntax

expression .Shapes

expression An expression that returns a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowAllFieldButtons Property (Excel)

 Copy code hover
[image]

Chart.ShowAllFieldButtons Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display all field buttons on a PivotChart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowAllFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

Set the ShowAllFieldButtons property to True to display all field buttons on the specified PivotChart. Set the property to False to hide all field buttons.

The ShowAllFieldButtons property corresponds to the Hide All command on the Field Buttons drop-down list of the Analyze tab, which is available when a PivotChart is selected.

Example

The following code example sets Chart 1 to display all field buttons.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ShowAllFieldButtons = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowAxisFieldButtons Property (Excel)

 Copy code hover
[image]

Chart.ShowAxisFieldButtons Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display axis field buttons on a PivotChart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowAxisFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

Set the ShowAxisFieldButtons property to True to display axis field buttons on the specified PivotChart. Set the property to False to hide the buttons.

The ShowAxisFieldButtons property corresponds to the Show Axis Field Buttons command on the Field Buttons drop-down list of the Analyze tab, which is available when a PivotChart is selected.

Example

The following code example sets Chart 1 to hide axis field buttons.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ShowAxisFieldButtons = False

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowDataLabelsOverMaximum Property (Excel)

 Copy code hover
[image]

Chart.ShowDataLabelsOverMaximum Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowDataLabelsOverMaximum

expression A variable that represents a Chart object.

Remarks

If you change the value axis in such a way that it became smaller than the size of the data points, you can use this property to set whether to show the data labels. This property applies to 2-D charts only.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowLegendFieldButtons Property (Excel)

 Copy code hover
[image]

Chart.ShowLegendFieldButtons Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display legend field buttons on a PivotChart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowLegendFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

Set the ShowLegendFieldButtons property to True to display legend field buttons on the specified PivotChart. Set the property to False to hide the buttons.

The ShowLegendFieldButtons property corresponds to the Show Legend Field Buttons command on the Field Buttons drop-down list of the Analyze tab, which is available when a PivotChart is selected.

Example

The following code example sets Chart 1 to display legend field buttons.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ShowLegendFieldButtons = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowReportFilterFieldButtons Property (Excel)

 Copy code hover
[image]

Chart.ShowReportFilterFieldButtons Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowReportFilterFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

Set the ShowReportFilterFieldButtons property to True to display the Report Filter Field buttons on the specified PivotChart. Set the property to False to hide the buttons.

The ShowReportFilterFieldButtons property corresponds to the Show Report Filter Field Buttons command on the Field Buttons drop-down list of the Analyze tab, which is available when a PivotChart is selected.

Example

The following code example sets Chart 1 to display report filter field buttons.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ShowReportFilterFieldButtons = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowValueFieldButtons Property (Excel)

 Copy code hover
[image]

Chart.ShowValueFieldButtons Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display the value field buttons on a PivotChart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowValueFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

Set the ShowValueFieldButtons property to True to display the Value Field buttons on the specified PivotChart. Set the property to False to hide the button.

The ShowValueFieldButtons property corresponds to the Show Value Field Buttons command on the Field Buttons drop-down list of the Analyze tab, which is available when a PivotChart is selected.

Example

The following code example sets Chart 1 to display value field buttons.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ShowValueFieldButtons = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SideWall Property (Excel)

 Copy code hover
[image]

Chart.SideWall Property (Excel)
See also Send feedback

Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SideWall

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Tab Property (Excel)

 Copy code hover
[image]

Chart.Tab Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Tab object for a chart.

Syntax

expression .Tab

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Visible Property (Excel)

 Copy code hover
[image]

Chart.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlSheetVisibility value that determines whether the object is visible.

Syntax

expression .Visible

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Walls Property (Excel)

 Copy code hover
[image]

Chart.Walls Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Walls object that represents the walls of the 3-D chart. Read-only.

Syntax

expression .Walls

expression A variable that represents a Chart object.

Example

This example sets the color of the wall border of Chart1 to red. The example should be run on a 3-D chart.

VBA Copy code Copy code
Charts("Chart1").Walls.Border.ColorIndex = 3

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart Methods (Excel)

 Copy code hover
[image]

Chart Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Makes the current chart the active chart.
ApplyChartTemplate | Applies a standard or custom chart type to a chart.
ApplyDataLabels | Applies data labels to all the series in a chart.
ApplyLayout | Applies the layouts shown in the ribbon.
Axes | Returns an object that represents either a single axis or a collection of the axes on the chart.
ChartGroups | Returns an object that represents either a single chart group (a ChartGroup object) or a collection of all the chart groups in the chart (a ChartGroups object). The returned collection includes every type of group.
ChartObjects | Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.
ChartWizard | Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.
CheckSpelling | Checks the spelling of an object.
ClearToMatchColorStyle | Clears all colors on the specified chart that do not follow the color style applied to the chart.
ClearToMatchStyle | Clears the chart elements formatting to automatic.
Copy | Copies the sheet to another location in the workbook.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Delete | Deletes the object.
Evaluate | Converts a Microsoft Excel name to an object or a value.
Export | Exports the chart in a graphic format.
ExportAsFixedFormat | Exports to a file of the specified format.
FullSeriesCollection | Enables retrieving the filtered out series specified by the Index argument.
GetChartElement | Returns information about the chart element at specified X and Y coordinates. This method is unusual in that you specify values for only the first two arguments. Microsoft Excel fills in the other arguments, and your code should examine those values when the method returns.
Location | Moves the chart to a new location.
Move | Moves the chart to another location in the workbook.
OLEObjects | Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.
Paste | Pastes chart data from the Clipboard into the specified chart.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a chart so that it cannot be modified.
Refresh | Causes the specified chart to be redrawn immediately.
SaveAs | Saves changes to the chart or worksheet in a different file.
SaveChartTemplate | Saves a custom chart template to the list of available chart templates.
Select | Selects the object.
SeriesCollection | Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.
SetBackgroundPicture | Sets the background graphic for a chart.
SetDefaultChart | Specifies the name of the chart template that Microsoft Excel uses when creating new charts.
SetElement | Sets chart elements on a chart. Read/write MsoChartElementType.
SetSourceData | Sets the source data range for the chart.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.


Chart.Activate Method (Excel)

 Copy code hover
[image]

Chart.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes the current chart the active chart.

Syntax

expression .Activate

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ApplyChartTemplate Method (Excel)

 Copy code hover
[image]

Chart.ApplyChartTemplate Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies a standard or custom chart type to a chart.

Version Information

Version Added: Excel 2007

Syntax

expression .ApplyChartTemplate(Filename)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The file name for a chart template.

Remarks

This method does not support taking constants for native or combination charts.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ApplyDataLabels Method (Excel)

 Copy code hover
[image]

Chart.ApplyDataLabels Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies data labels to all the series in a chart.

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | The type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default value is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | Pass a boolean value to enable or disable the series name for the data label.
ShowCategoryName | Optional | Variant | Pass a boolean value to enable or disable the category name for the data label.
ShowValue | Optional | Variant | Pass a boolean value to enable or disable the value for the data label.
ShowPercentage | Optional | Variant | Pass a boolean value to enable or disable the percentage for the data label.
ShowBubbleSize | Optional | Variant | Pass a boolean value to enable or disable the bubble size for the data label.
Separator | Optional | Variant | The separator for the data label.

Remarks

XlDataLabelsType can be one of these XlDataLabelsType constants.

xlDataLabelsShowBubbleSizes. The bubble size for the data label.

xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.

xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowLabel. Category for the point.

xlDataLabelsShowNone. No data labels.

xlDataLabelsShowValue. default. Value for the point (assumed if this argument isn't specified).

Example

This example applies category labels to series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ApplyLayout Method (Excel)

 Copy code hover
[image]

Chart.ApplyLayout Method (Excel)
See also Send feedback

Applies the layouts shown in the ribbon.

Version Information

Version Added: Excel 2007

Syntax

expression .ApplyLayout(Layout, ChartType)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Layout | Required | Long | Specifies the type of layout. The type of layout is denoted by a number from 1 to 10.
ChartType | Optional | XlChartType | The type of chart.

Remarks

When you use a layout on the current chart type, a number from 1 to 10 is applied to the chart type. You can also apply the layout of one chart type on another chart type. For example, you can apply the layouts that are available from a line chart to a column chart. The layout only adds chart elements that are available for that particular chart type.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Axes Method (Excel)

 Copy code hover
[image]

Chart.Axes Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single axis or a collection of the axes on the chart.

Syntax

expression .Axes(Type, AxisGroup)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | Variant | Specifies the axis to return. Can be one of the following XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3-D charts).
AxisGroup | Optional | XlAxisGroup | Specifies the axis group. If this argument is omitted, the primary group is used. 3-D charts have only one axis group.

Return Value

Object

Example

This example adds an axis label to the category axis in Chart1.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
End With

This example turns off major gridlines for the category axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlCategory).HasMajorGridlines = False

This example turns off all gridlines for all axes in Chart1.

VBA Copy code Copy code
For Each a In Charts("Chart1").Axes
 a.HasMajorGridlines = False
 a.HasMinorGridlines = False
Next a

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartGroups Method (Excel)

 Copy code hover
[image]

Chart.ChartGroups Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single chart group (a ChartGroup object) or a collection of all the chart groups in the chart (a ChartGroups object). The returned collection includes every type of group.

Syntax

expression .ChartGroups(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The chart group number.

Return Value

Object

Example

This example turns on up and down bars for chart group one on Chart1 and then sets their colors. The example should be run on a 2-D line chart containing two series that intersect at one or more data points.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartObjects Method (Excel)

 Copy code hover
[image]

Chart.ChartObjects Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.

Syntax

expression .ChartObjects(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the chart. This argument can be an array, to specify more than one chart.

Return Value

Object

Remarks

This method isn't equivalent to the Charts property. This method returns embedded charts; the Charts property returns chart sheets. Use the Chart property to return the Chart object for an embedded chart.

Example

This example adds a title to embedded chart one on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").ChartObjects(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "1995 Rainfall Totals by Month"
End With

This example creates a new series in embedded chart one on Sheet1. The data source for the new series is the range B1:B10 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Activate
ActiveChart.SeriesCollection.Add _
 source:=Worksheets("Sheet1").Range("B1:B10")

This example clears the formatting of embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.ClearFormats

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartWizard Method (Excel)

 Copy code hover
[image]

Chart.ChartWizard Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.

Syntax

expression .ChartWizard(Source, Gallery, Format, PlotBy, CategoryLabels, SeriesLabels, HasLegend, Title, CategoryTitle, ValueTitle, ExtraTitle)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Optional | Variant | The range that contains the source data for the new chart. If this argument is omitted, Microsoft Excel edits the active chart sheet or the selected chart on the active worksheet.
Gallery | Optional | Variant | One of the constants of XlChartType specifying the chart type.
Format | Optional | Variant | The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type. If this argument is omitted, Microsoft Excel chooses a default value based on the gallery type and data source.
PlotBy | Optional | Variant | Specifies whether the data for each series is in rows or columns. Can be one of the following XlRowCol constants: xlRows or xlColumns.
CategoryLabels | Optional | Variant | An integer specifying the number of rows or columns within the source range that contain category labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
SeriesLabels | Optional | Variant | An integer specifying the number of rows or columns within the source range that contain series labels. Legal values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
HasLegend | Optional | Variant | True to include a legend.
Title | Optional | Variant | The chart title text.
CategoryTitle | Optional | Variant | The category axis title text.
ValueTitle | Optional | Variant | The value axis title text.
ExtraTitle | Optional | Variant | The series axis title for 3-D charts or the second value axis title for 2-D charts.

Remarks

If Source is omitted and either the selection isn't an embedded chart on the active worksheet or the active sheet isn't an existing chart, this method fails and an error occurs.

Example

This example reformats Chart1 as a line chart, adds a legend, and adds category and value axis titles.

VBA Copy code Copy code
Charts("Chart1").ChartWizard _
 Gallery:=xlLine, _
 HasLegend:=True, CategoryTitle:="Year", ValueTitle:="Sales"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CheckSpelling Method (Excel)

 Copy code hover
[image]

Chart.CheckSpelling Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the spelling of an object.

Syntax

expression .CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest, SpellLang)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
CustomDictionary | Optional | Variant | A string that indicates the file name of the custom dictionary to be examined if the word isn't found in the main dictionary. If this argument is omitted, the currently specified dictionary is used.
IgnoreUppercase | Optional | Variant | True to have Microsoft Excel ignore words that are all uppercase. False to have Microsoft Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
AlwaysSuggest | Optional | Variant | True to have Microsoft Excel display a list of suggested alternate spellings when an incorrect spelling is found. False to have Microsoft Excel wait for you to input the correct spelling. If this argument is omitted, the current setting will be used.
SpellLang | Optional | Variant | The language of the dictionary being used. Can be one of the MsoLanguageID values.

Remarks

This method has no return value; Microsoft Excel displays the Spelling dialog box.

To check headers, footers, and objects on a worksheet, use this method on a Worksheet object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ClearToMatchColorStyle Method (Excel)

 Copy code hover
[image]

Chart.ClearToMatchColorStyle Method (Excel)
See also Send feedback

Clears all colors on the specified chart that do not follow the color style applied to the chart.

Version information

Version Added: Excel 2013

Syntax

expression .ClearToMatchColorStyle

expression A variable that represents a Chart object.

Return value

VOID

Remarks

Use this method to reset all the chart color formatting to the color style applied to the chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ClearToMatchStyle Method (Excel)

 Copy code hover
[image]

Chart.ClearToMatchStyle Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the chart elements formatting to automatic.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearToMatchStyle

expression A variable that represents a Chart object.

Remarks

Use this method to reset the chart elements formatting to automatic. If you use this method on a chart, all formatting (including overrides) will be reset.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Copy Method (Excel)

 Copy code hover
[image]

Chart.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the sheet to another location in the workbook.

Syntax

expression .Copy(Before, After)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the copied sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the copied sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.

The Copy method is not supported for chart objects.

Example

This example copies Sheet1, placing the copy after Sheet3.

VBA Copy code Copy code
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CopyPicture Method (Excel)

 Copy code hover
[image]

Chart.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture.

Syntax

expression .CopyPicture(Appearance, Format, Size)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | XlCopyPictureFormat | . The format of the picture. The default value is xlPicture.
Size | Optional | XlPictureAppearance | The size of the copied picture when the object is a chart on a chart sheet (not embedded on a worksheet). The default value is xlPrinter.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Delete Method (Excel)

 Copy code hover
[image]

Chart.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Evaluate Method (Excel)

 Copy code hover
[image]

Chart.Evaluate Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a Microsoft Excel name to an object or a value.

Syntax

expression .Evaluate(Name)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Variant | The name of the object, using the naming convention of Microsoft Excel.

Return Value

Variant

Remarks

The following types of names in Microsoft Excel can be used with this method:

  • A1-style references. You can use any reference to a single cell in A1-style notation. All references are considered to be absolute references.

  • Ranges. You can use the range, intersect, and union operators (colon, space, and comma, respectively) with references.

  • Defined names. You can specify any name in the language of the macro.

  • External references. You can use the ! operator to refer to a cell or to a name defined in another workbook — for example, Evaluate("[BOOK1.XLS]Sheet1!A1").

  • Chart Objects. You can specify any chart object name, such as "Legend", "Plot Area", or "Series 1", to access the properties and methods of that object. For example, Charts("Chart1").Evaluate("Legend").Font.Name returns the name of the font used in the legend.

Note Note

Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument. For example, the following expression pairs are equivalent.

VBA Copy code Copy code
[a1].Value = 25
Evaluate("A1").Value = 25

trigVariable = [SIN(45)]
trigVariable = Evaluate("SIN(45)")

Set firstCellInSheet = Workbooks("BOOK1.XLS").Sheets(4).[A1]
Set firstCellInSheet = _
 Workbooks("BOOK1.XLS").Sheets(4).Evaluate("A1")

The advantage of using square brackets is that the code is shorter. The advantage of using Evaluate is that the argument is a string, so you can either construct the string in your code or use a Visual Basic variable.

Example

This example turns on bold formatting in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
boldCell = "A1"
Application.Evaluate(boldCell).Font.Bold = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Export Method (Excel)

 Copy code hover
[image]

Chart.Export Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports the chart in a graphic format.

Syntax

expression .Export(Filename, FilterName, Interactive)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the exported file.
FilterName | Optional | Variant | The language-independent name of the graphic filter as it appears in the registry.
Interactive | Optional | Variant | True to display the dialog box that contains the filter-specific options. If this argument is False, Microsoft Excel uses the default values for the filter. The default value is False.

Return Value

Boolean

Example

This example exports chart one as a GIF file.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1) _
.Chart. Export _
 FileName:="current_sales.gif", FilterName:="GIF"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ExportAsFixedFormat Method (Excel)

 Copy code hover
[image]

Chart.ExportAsFixedFormat Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports to a file of the specified format.

Version Information

Version Added: Excel 2007

Syntax

expression .ExportAsFixedFormat(Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFixedFormatType | The type of file format to export to.
Filename | Optional | Variant | The file name of the file to be saved. You can include a full path, or Microsoft Excel saves the file in the current folder.
Quality | Optional | Variant | Optional XlFixedFormatQuality. Specifies the quality of the published file.
IncludeDocProperties | Optional | Variant | True to include the document properties; otherwise False.
IgnorePrintAreas | Optional | Variant | True to ignore any print areas set when publishing; otherwise False.
From | Optional | Variant | The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To | Optional | Variant | The number of the last page to publish. If this argument is omitted, publishing ends with the last page.
OpenAfterPublish | Optional | Variant | True to display the file in the viewer after it is published; otherwise False.
FixedFormatExtClassPtr | Optional | Variant | Pointer to the FixedFormatExt class.

Remarks

This method also supports initializing an add-in to export a file to a fixed-format file. For example, Excel will perform file format conversion if the converters are present. The conversion is usually initiated by the user.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.FullSeriesCollection Method (Excel)

 Copy code hover
[image]

Chart.FullSeriesCollection Method (Excel)
See also Send feedback

Published: July 16, 2012

Enables retrieving the filtered out series specified by the Index argument.

Version information

Version Added: Excel 2013

Syntax

expression .FullSeriesCollection(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The indexed number of the filtered out Series object.

Return value

OBJECT

Remarks

Series objects in hidden rows or columns do not appear in the current series collection unless the user has enabled the Show data in hidden rows and columns option in the Select Data dialog.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.GetChartElement Method (Excel)

 Copy code hover
[image]

Chart.GetChartElement Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns information about the chart element at specified X and Y coordinates. This method is unusual in that you specify values for only the first two arguments. Microsoft Excel fills in the other arguments, and your code should examine those values when the method returns.

Syntax

expression .GetChartElement(x, y, ElementID, Arg1, Arg2)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Long | The X coordinate of the chart element.
y | Required | Long | The Y coordinate of the chart element.
ElementID | Required | Long | When the method returns, this argument contains the XLChartItem value of the chart element at the specified coordinates. For more information, see the "Remarks" section.
Arg1 | Required | Long | When the method returns, this argument contains information related to the chart element. For more information, see the "Remarks" section.
Arg2 | Required | Long | When the method returns, this argument contains information related to the chart element. For more information, see the "Remarks" section.

Remarks

The value of ElementID after the method returns determines whether Arg1 and Arg2 contain any information, as shown in the following table.

ElementID Constant | Constant Value | Arg1 | Arg2
xlAxis | 21 | AxisIndex | AxisType
xlAxisTitle | 17 | AxisIndex | AxisType
xlDisplayUnitLabel | 30 | AxisIndex | AxisType
xlMajorGridlines | 15 | AxisIndex | AxisType
xlMinorGridlines | 16 | AxisIndex | AxisType
xlPivotChartDropZone | 32 | DropZoneType | None
xlPivotChartFieldButton | 31 | DropZoneType | PivotFieldIndex
xlDownBars | 20 | GroupIndex | None
xlDropLines | 26 | GroupIndex | None
xlHiLoLines | 25 | GroupIndex | None
xlRadarAxisLabels | 27 | GroupIndex | None
xlSeriesLines | 22 | GroupIndex | None
xlUpBars | 18 | GroupIndex | None
xlChartArea | 2 | None | None
xlChartTitle | 4 | None | None
xlCorners | 6 | None | None
xlDataTable | 7 | None | None
xlFloor | 23 | None | None
xlLeaderLines | 29 | None | None
xlLegend | 24 | None | None
xlNothing | 28 | None | None
xlPlotArea | 19 | None | None
xlWalls | 5 | None | None
xlDataLabel | 7 | SeriesIndex | PointIndex
xlErrorBars | 9 | SeriesIndex | None
xlLegendEntry | 12 | SeriesIndex | None
xlLegendKey | 13 | SeriesIndex | None
xlSeries | 3 | SeriesIndex | PointIndex
xlShape | 14 | ShapeIndex | None
xlTrendline | 8 | SeriesIndex | TrendLineIndex
xlXErrorBars | 10 | SeriesIndex | None
xlYErrorBars | 11 | SeriesIndex | None

The following table describes the meaning of Arg1 and Arg2 after the method returns.

Argument | Description
AxisIndex | Specifies whether the axis is primary or secondary. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.
AxisType | Specifies the axis type. Can be one of the following XlAxisType constants: xlCategory, xlSeriesAxis, or xlValue.
DropZoneType | Specifies the drop zone type: column, data, page, or row field. Can be one of the following XlPivotFieldOrientation constants: xlColumnField, xlDataField, xlPageField, or xlRowField. The column and row field constants specify the series and category fields, respectively.
GroupIndex | Specifies the offset within the ChartGroups collection for a specific chart group.
PivotFieldIndex | Specifies the offset within the PivotFields collection for a specific column (series), data, page, or row (category) field. -1 if the drop zone type is xlDataField.
PointIndex | Specifies the offset within the Points collection for a specific point within a series. A value of - 1 indicates that all data points are selected.
SeriesIndex | Specifies the offset within the Series collection for a specific series.
ShapeIndex | Specifies the offset within the Shapes collection for a specific shape.
TrendlineIndex | Specifies the offset within the Trendlines collection for a specific trendline within a series.

Example

This example warns the user if she moves the mouse over the chart legend.

VBA Copy code Copy code
Private Sub Chart_MouseMove(ByVal Button As Long, _
 ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
 Dim IDNum As Long
 Dim a As Long
 Dim b As Long

 ActiveChart.GetChartElement X, Y, IDNum, a, b
 If IDNum = xlLegendEntry Then _
 MsgBox "WARNING: Move away from the legend"
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Location Method (Excel)

 Copy code hover
[image]

Chart.Location Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the chart to a new location.

Syntax

expression .Location(Where, Name)

expression An expression that returns a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Where | Required | XlChartLocation | Where to move the chart.
Name | Optional | Variant | Required if Where is xlLocationAsObject. The name of the sheet where the chart will be embedded if Where is xlLocationAsObject or the name of the new sheet if Where is xlLocationAsNewSheet.

Return Value

Chart

Example

This example moves the embedded chart to a new chart sheet named "Monthly Sales."

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .Location xlLocationAsNewSheet, "Monthly Sales"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Move Method (Excel)

 Copy code hover
[image]

Chart.Move Method (Excel)
See also Send feedback

Moves the chart to another location in the workbook.

Syntax

expression .Move(Before, After)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the moved chart will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the moved chart will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the moved chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.OLEObjects Method (Excel)

 Copy code hover
[image]

Chart.OLEObjects Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.

Syntax

expression .OLEObjects(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the OLE object.

Return Value

Object

Example

This example creates a list of link types for OLE objects on Sheet1. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
i = 2
newSheet.Range("A1").Value = "Name"
newSheet.Range("B1").Value = "Link Type"
For Each obj In Worksheets("Sheet1").OLEObjects
 newSheet.Cells(i, 1).Value = obj.Name
 If obj.OLEType = xlOLELink Then
 newSheet.Cells(i, 2) = "Linked"
 Else
 newSheet.Cells(i, 2) = "Embedded"
 End If
 i = i + 1
Next

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Paste Method (Excel)

 Copy code hover
[image]

Chart.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes chart data from the Clipboard into the specified chart.

Syntax

expression .Paste(Type)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | Variant | Specifies the chart information to paste if a chart is on the Clipboard. Can be one of the following XlPasteType constants: xlPasteFormats, xlPasteFormulas, or xlPasteAll. The default value is xlPasteAll. If there's data other than a chart on the Clipboard, this argument cannot be used.

Example

This example pastes data from the range B1:B5 on Sheet1 into Chart1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("B1:B5").Copy
Charts("Chart1").Paste

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PrintOut Method (Excel)

 Copy code hover
[image]

Chart.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PrintPreview Method (Excel)

 Copy code hover
[image]

Chart.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Protect Method (Excel)

 Copy code hover
[image]

Chart.Protect Method (Excel)
See also Send feedback

Published: July 16, 2012

Protects a chart so that it cannot be modified.

Syntax

expression .Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that specifies a case-sensitive password for the worksheet or workbook. If this argument is omitted, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook. If you forget the password, you cannot unprotect the worksheet or workbook. Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.
DrawingObjects | Optional | Variant | True to protect shapes. The default value is True.
Contents | Optional | Variant | True to protect contents. For a chart, this protects the entire chart. For a worksheet, this protects the locked cells. The default value is True.
Scenarios | Optional | Variant | True to protect scenarios. This argument is valid only for worksheets. The default value is True.
UserInterfaceOnly | Optional | Variant | True to protect the user interface, but not macros. If this argument is omitted, protection applies both to macros and to the user interface.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Refresh Method (Excel)

 Copy code hover
[image]

Chart.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Causes the specified chart to be redrawn immediately.

Syntax

expression .Refresh

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SaveAs Method (Excel)

 Copy code hover
[image]

Chart.SaveAs Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves changes to the chart or worksheet in a different file.

Syntax

expression .SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AddToMru, TextCodepage, TextVisualLayout, Local)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Variant. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.
FileFormat | Optional | Variant | The file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.
Password | Optional | Variant | A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.
WriteResPassword | Optional | Variant | A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.
ReadOnlyRecommended | Optional | Variant | True to display a message when the file is opened, recommending that the file be opened as read-only.
CreateBackup | Optional | Variant | True to create a backup file.
AddToMru | Optional | Variant | True to add this workbook to the list of recently used files. The default value is False.
Local | Optional | Variant | Not used in U.S. English Microsoft Excel.
TextVisualLayout | Optional | Variant | Not used in U.S. English Microsoft Excel.
Local | Optional | Variant | True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

Remarks

Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SaveChartTemplate Method (Excel)

 Copy code hover
[image]

Chart.SaveChartTemplate Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves a custom chart template to the list of available chart templates.

Version Information

Version Added: Excel 2007

Syntax

expression .SaveChartTemplate(Filename)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the chart template.

Remarks

By default, this method saves the active chart to the user's chart template directory. If a UNC or URL is specified, the chart will be saved to the specified location instead.

Example

This example adds a new chart template based on the active chart.

VBA Copy code Copy code
ActiveChart.SaveChartTemplate _
 Filename:="Presentation Chart"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Select Method (Excel)

 Copy code hover
[image]

Chart.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Remarks

To select a cell or a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SeriesCollection Method (Excel)

 Copy code hover
[image]

Chart.SeriesCollection Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.

Syntax

expression .SeriesCollection(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the series.

Return Value

Object

Example

This example turns on data labels for series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).HasDataLabels = True

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetBackgroundPicture Method (Excel)

 Copy code hover
[image]

Chart.SetBackgroundPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the background graphic for a chart.

Syntax

expression .SetBackgroundPicture(Filename)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the graphic file.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetDefaultChart Method (Excel)

 Copy code hover
[image]

Chart.SetDefaultChart Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the name of the chart template that Microsoft Excel uses when creating new charts.

Version Information

Version Added: Excel 2007

Syntax

expression .SetDefaultChart(Name)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Variant | Specifies the name of the default chart template that will be used when creating new charts. This name can be a string naming a chart in the gallery for a user-defined template or it can be a special constant xlBuiltIn to specify a built-in chart template.

Example

This example sets the default chart template to the custom chart named "Monthly Sales."

VBA Copy code Copy code
ActiveChart.SetDefaultChart Name:="Monthly Sales"

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetElement Method (Excel)

 Copy code hover
[image]

Chart.SetElement Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets chart elements on a chart. Read/write MsoChartElementType.

Version Information

Version Added: Excel 2007

Syntax

expression .SetElement(Element)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Element | Required | MsoChartElementType | Specifies the chart element type.

Return Value

Nothing

Remarks

For charts, the following commands in the Layout tab correspond to the SetElement method:

  • Everything in the Labels group.

  • Everything in the Axes group.

  • Everything in the Analysis group.

  • PlotArea, Chart Wall, and Chart Floor buttons.

MsoChartElementType is an enumeration of constants that refer to all of the above commands.

Example

This example sets chart elements using the various constant values to an active chart.

VBA Copy code Copy code
ActiveChart.Axes(xlValue).MajorGridlines.Select
 ActiveChart.SetElement (msoElementChartTitleCenteredOverlay)
 ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMinor)
 ActiveChart.Walls.Select
 Application.CommandBars("Clip Art").Visible = False
 ActiveChart.SetElement (msoElementChartFloorShow)

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetSourceData Method (Excel)

 Copy code hover
[image]

Chart.SetSourceData Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the source data range for the chart.

Syntax

expression .SetSourceData(Source, PlotBy)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Range | The range that contains the source data.
PlotBy | Optional | Variant | Specifies the way the data is to be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Example

This example sets the source data range for chart one.

VBA Copy code Copy code
Charts(1).SetSourceData Source:=Sheets(1).Range("a1:a10"), _
 PlotBy:=xlColumns

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Unprotect Method (Excel)

 Copy code hover
[image]

Chart.Unprotect Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Syntax

expression .Unprotect(Password)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that denotes the case-sensitive password to use to unprotect the chart. If the chart isn't protected with a password, this argument is ignored.

Remarks

If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart Events (Excel)

 Copy code hover
[image]

Chart Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
BeforeDoubleClick | Occurs when a chart element is double-clicked, before the default double-click action.
BeforeRightClick | Occurs when a chart element is right-clicked, before the default right-click action.
Calculate | Occurs after the chart plots new or changed data, for the Chart object.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
MouseDown | Occurs when a mouse button is pressed while the pointer is over a chart.
MouseMove | Occurs when the position of the mouse pointer changes over a chart.
MouseUp | Occurs when a mouse button is released while the pointer is over a chart.
Resize | Occurs when the chart is resized.
Select | Occurs when a chart element is selected.
SeriesChange | Occurs when the user changes the value of a chart data point by clicking a bar in the chart and dragging the top edge up or down thus changing the value of the data point.


Chart.Activate Event (Excel)

 Copy code hover
[image]

Chart.Activate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.

Syntax

expression .Activate

expression A variable that represents a Chart object.

Remarks

This event doesn't occur when you create a new window.

When you switch between two windows showing the same workbook, the WindowActivate event occurs, but the Activate event for the workbook doesn't occur.

Example

This example sorts the range A1:A10 when the worksheet is activated.

VBA Copy code Copy code
Private Sub Worksheet_Activate()
 Range("a1:a10").Sort Key1:=Range("a1"), Order:=xlAscending
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BeforeDoubleClick Event (Excel)

 Copy code hover
[image]

Chart.BeforeDoubleClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a chart element is double-clicked, before the default double-click action.

Syntax

expression .BeforeDoubleClick(ElementID, Arg1, Arg2, Cancel)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default double-click action isn't performed when the procedure is finished.
Arg1 | Required | Long | Additional event information, depending on the value of ElementID. For more information about this parameter, see the Remarks section.
Arg2 | Required | Long | Additional event information, depending on the value of ElementID. For more information about this parameter, see the Remarks section.
ElementID | Required | Long | The double-clicked object. The value of this parameter determines the expected values of Arg1 and Arg2. For more information about this paramter, see the Remarks section.

Remarks

The DoubleClick method doesn't cause this event to occur.

This event doesn't occur when the user double-clicks the border of a cell.

The meaning of Arg1 and Arg2 depends on the ElementID value, as shown in the following table.

ElementID | Arg1 | Arg2
xlAxis | AxisIndex | AxisType
xlAxisTitle | AxisIndex | AxisType
xlDisplayUnitLabel | AxisIndex | AxisType
xlMajorGridlines | AxisIndex | AxisType
xlMinorGridlines | AxisIndex | AxisType
xlPivotChartDropZone | DropZoneType | None
xlPivotChartFieldButton | DropZoneType | PivotFieldIndex
xlDownBars | GroupIndex | None
xlDropLines | GroupIndex | None
xlHiLoLines | GroupIndex | None
xlRadarAxisLabels | GroupIndex | None
xlSeriesLines | GroupIndex | None
xlUpBars | GroupIndex | None
xlChartArea | None | None
xlChartTitle | None | None
xlCorners | None | None
xlDataTable | None | None
xlFloor | None | None
xlLegend | None | None
xlNothing | None | None
xlPlotArea | None | None
xlWalls | None | None
xlDataLabel | SeriesIndex | PointIndex
xlErrorBars | SeriesIndex | None
xlLegendEntry | SeriesIndex | None
xlLegendKey | SeriesIndex | None
xlSeries | SeriesIndex | PointIndex
xlTrendline | SeriesIndex | TrendLineIndex
xlXErrorBars | SeriesIndex | None
xlYErrorBars | SeriesIndex | None
xlShape | ShapeIndex | None

The following table describes the meaning of the arguments.

Argument | Description
AxisIndex | Specifies whether the axis is primary or secondary. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.
AxisType | Specifies the axis type. Can be one of the following XlAxisType constants: xlCategory, xlSeriesAxis, or xlValue.
DropZoneType | Specifies the drop zone type: column, data, page, or row field. Can be one of the following XlPivotFieldOrientation constants: xlColumnField, xlDataField, xlPageField, or xlRowField. The column and row field constants specify the series and category fields, respectively.
GroupIndex | Specifies the offset within the ChartGroups collection for a specific chart group.
PivotFieldIndex | Specifies the offset within the PivotFields collection for a specific column (series), data, page, or row (category) field.
PointIndex | Specifies the offset within the Points collection for a specific point within a series. The value - 1 indicates that all data points are selected.
SeriesIndex | Specifies the offset within the Series collection for a specific series.
ShapeIndex | Specifies the offset within the Shapes collection for a specific shape.
TrendlineIndex | Specifies the offset within the Trendlines collection for a specific trendline within a series.

Example

This example overrides the default double-click behavior for the chart floor.

VBA Copy code Copy code
Private Sub Chart_BeforeDoubleClick(ByVal ElementID As Long, _
 ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)

 If ElementID = xlFloor Then
 Cancel = True
 MsgBox "Chart formatting for this item is restricted."
 End If

End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BeforeRightClick Event (Excel)

 Copy code hover
[image]

Chart.BeforeRightClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a chart element is right-clicked, before the default right-click action.

Syntax

expression .BeforeRightClick(Cancel)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default right-click action isn't performed when the procedure is finished.

Remarks

Like other worksheet events, this event doesn't occur if you right-click while the pointer is on a shape or a command bar (a toolbar or menu bar).

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Calculate Event (Excel)

 Copy code hover
[image]

Chart.Calculate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the chart plots new or changed data, for the Chart object.

Syntax

expression .Calculate

expression A variable that represents a Chart object.

Return Value

nothing

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Deactivate Event (Excel)

 Copy code hover
[image]

Chart.Deactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the chart, worksheet, or workbook is deactivated.

Syntax

expression .Deactivate

expression A variable that represents a Chart object.

Example

This example arranges all open windows when the workbook is deactivated.

VBA Copy code Copy code
Private Sub Workbook_Deactivate()
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.MouseDown Event (Excel)

 Copy code hover
[image]

Chart.MouseDown Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a mouse button is pressed while the pointer is over a chart.

Syntax

expression .MouseDown(Button, Shift, x, y)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. Can be one of the following XlMouseButton constants: xlNoButton, xlPrimaryButton, or xlSecondaryButton.
Shift | Required | Long | The state of the SHIFT, CTRL, and ALT keys when the event occurred. Can be one of or a sum of values.
x | Required | Long | The X coordinate of the mouse pointer in chart object client coordinates.
y | Required | Long | The Y coordinate of the mouse pointer in chart object client coordinates.

Return Value

Nothing

Remarks

The following table specifies the values for the Shift parameter.

Value | Meaning
0 (zero) | No keys
1 | SHIFT key
2 | CTRL key
4 | ALT key

Example

This example runs when a mouse button is pressed while the pointer is over a chart.

VBA Copy code Copy code
Private Sub Chart_MouseDown(ByVal Button As Long, _
 ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
 MsgBox "Button = " & Button & chr$(13) & _
 "Shift = " & Shift & chr$(13) & _
 "X = " & X & " Y = " & Y
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.MouseMove Event (Excel)

 Copy code hover
[image]

Chart.MouseMove Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the position of the mouse pointer changes over a chart.

Syntax

expression .MouseMove(Button, Shift, x, y)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. Can be one of the following XlMouseButton constants: xlNoButton, xlPrimaryButton, or xlSecondaryButton.
Shift | Required | Long | The state of the SHIFT, CTRL, and ALT keys when the event occurred. Can be one of or a sum of values.
x | Required | Long | The X coordinate of the mouse pointer in chart object client coordinates.
y | Required | Long | The Y coordinate of the mouse pointer in chart object client coordinates.

Return Value

Nothing

Remarks

The following table specifies the values for the Shift parameter.

Value | Meaning
0 (zero) | No keys
1 | SHIFT key
2 | CTRL key
4 | ALT key

Example

This example runs when the position of the mouse pointer changes over a chart.

VBA Copy code Copy code
Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
 MsgBox "X = " & X & " Y = " & Y
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.MouseUp Event (Excel)

 Copy code hover
[image]

Chart.MouseUp Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a mouse button is released while the pointer is over a chart.

Syntax

expression .MouseUp(Button, Shift, x, y)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. Can be one of the following XlMouseButton constants: xlNoButton, xlPrimaryButton, or xlSecondaryButton.
Shift | Required | Long | The state of the SHIFT, CTRL, and ALT keys when the event occurred. Can be one of or a sum of values.
x | Required | Long | The X coordinate of the mouse pointer in chart object client coordinates.
y | Required | Long | The Y coordinate of the mouse pointer in chart object client coordinates.

Return Value

Nothing

Remarks

The following table specifies the values for the Shift parameter.

Value | Meaning
0 (zero) | No keys
1 | SHIFT key
2 | CTRL key
4 | ALT key

Example

This example runs when a mouse button is released over a chart.

VBA Copy code Copy code
Private Sub Chart_MouseUp(ByVal Button As Long, _
 ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
 MsgBox "Button = " & Button & chr$(13) & _
 "Shift = " & Shift & chr$(13) & _
 "X = " & X & " Y = " & Y
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Resize Event (Excel)

 Copy code hover
[image]

Chart.Resize Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the chart is resized.

Syntax

expression .Resize

expression A variable that returns a Chart object.

Example

The following code example keeps the upper-left corner of the chart at the same location when the chart is resized.

VBA Copy code Copy code
Private Sub myChartClass_Resize()
 With ActiveChart.Parent
 .Left = 100
 .Top = 150
 End With
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Select Event (Excel)

 Copy code hover
[image]

Chart.Select Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a chart element is selected.

Syntax

expression .Select(ElementID, Arg1, Arg2)

expression An expression that returns a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
ElementID | Required | Long | The selected chart element. For more information about these arguments, see the BeforeDoubleClick event.
Arg1 | Required | Long | The selected chart element. For more information about these arguments, see the BeforeDoubleClick event.
Arg2 | Required | Long | The selected chart element. For more information about these arguments, see the BeforeDoubleClick event.

Example

This example displays a message box if the user selects the chart title.

VBA Copy code Copy code
Private Sub Chart_Select(ByVal ElementID As Long, _
 ByVal Arg1 As Long, ByVal Arg2 As Long)
 If ElementId = xlChartTitle Then
 MsgBox "please don't change the chart title"
 End If
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SeriesChange Event (Excel)

 Copy code hover
[image]

Chart.SeriesChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the user changes the value of a chart data point by clicking a bar in the chart and dragging the top edge up or down thus changing the value of the data point.

Syntax

expression .SeriesChange(SeriesIndex, PointIndex)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
SeriesIndex | Required | Long | The offset within the Series collection for the changed series.
PointIndex | Required | Long | The offset within the Points collection for the changed point.

Return Value

Nothing

Example

This example changes the point's border color when the user changes the point value.

VBA Copy code Copy code
Private Sub Chart_SeriesChange(ByVal SeriesIndex As Long, _
 ByVal PointIndex As Long)
 Set p = Me.SeriesCollection(SeriesIndex).Points(PointIndex)
 p.Border.ColorIndex = 3
End Sub

See also

Concepts

Chart Object

Other resources

Chart Object Members


ChartArea Object (Excel)

 Copy code hover
[image]

ChartArea Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the chart area of a chart.

Remarks

The chart area includes everything, including the plot area. However, the plot area has its own fill, so filling the plot area does not fill the chart area.

For information about formatting the plot area, see PlotArea Object.

Use the ChartArea property to return the ChartArea object.

Example

The following example turns off the border for the chart area in embedded chart 1 on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart. _
 ChartArea.Format.Line.Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

ChartArea Object Members


ChartArea Members (Excel)

 Copy code hover
[image]

ChartArea Members (Excel)
Send feedback

Represents the chart area of a chart.

Methods

Name | Description
Clear | Clears the entire object.
ClearContents | Clears the data from a chart but leaves the formatting.
ClearFormats | Clears the formatting of the object.
Copy | Copies the object to the Clipboard.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
RoundedCorners | True if the chart area of the chart has rounded corners. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


ChartArea Properties (Excel)

 Copy code hover
[image]

ChartArea Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
RoundedCorners | True if the chart area of the chart has rounded corners. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


ChartArea.Application Property (Excel)

 Copy code hover
[image]

ChartArea.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartArea object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Creator Property (Excel)

 Copy code hover
[image]

ChartArea.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartArea object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Format Property (Excel)

 Copy code hover
[image]

ChartArea.Format Property (Excel)
See also Send feedback

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a ChartArea object.

Remarks

The ChartFormat object contains the line, fill, and effect formatting for the chart area.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Height Property (Excel)

 Copy code hover
[image]

ChartArea.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Left Property (Excel)

 Copy code hover
[image]

ChartArea.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Name Property (Excel)

 Copy code hover
[image]

ChartArea.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Parent Property (Excel)

 Copy code hover
[image]

ChartArea.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.RoundedCorners Property (Excel)

 Copy code hover
[image]

ChartArea.RoundedCorners Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart area of the chart has rounded corners. Read/write Boolean.

Version Information

Version Added: Excel 2010

Syntax

expression .RoundedCorners

expression A variable that returns a ChartArea object.

Example

This example adds rounded corners to chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.RoundedCorners = True

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Shadow Property (Excel)

 Copy code hover
[image]

ChartArea.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Top Property (Excel)

 Copy code hover
[image]

ChartArea.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Width Property (Excel)

 Copy code hover
[image]

ChartArea.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea Methods (Excel)

 Copy code hover
[image]

ChartArea Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Clears the entire object.
ClearContents | Clears the data from a chart but leaves the formatting.
ClearFormats | Clears the formatting of the object.
Copy | Copies the object to the Clipboard.
Select | Selects the object.


ChartArea.Clear Method (Excel)

 Copy code hover
[image]

ChartArea.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the entire object.

Syntax

expression .Clear

expression A variable that represents a ChartArea object.

Return Value

Variant

Example

This example clears the chart area (the chart data and formatting) of Chart1.

VBA Copy code Copy code
Charts("Chart1").ChartArea.Clear

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.ClearContents Method (Excel)

 Copy code hover
[image]

ChartArea.ClearContents Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the data from a chart but leaves the formatting.

Syntax

expression .ClearContents

expression A variable that represents a ChartArea object.

Return Value

Variant

Example

This example clears the chart data from Chart1 but leaves the formatting intact.

VBA Copy code Copy code
Charts("Chart1").ChartArea.ClearContents

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.ClearFormats Method (Excel)

 Copy code hover
[image]

ChartArea.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a ChartArea object.

Return Value

Variant

Example

This example clears the formatting from embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.ClearFormats

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Copy Method (Excel)

 Copy code hover
[image]

ChartArea.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a ChartArea object.

Return Value

Variant

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Select Method (Excel)

 Copy code hover
[image]

ChartArea.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a ChartArea object.

Return Value

A Variant value that represents the selected object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartCategory Object (Excel)

 Copy code hover
[image]

ChartCategory Object (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a chart type's category.

Version information

Version Added: Excel 2013

See also

Other resources

ChartCategory Object Members


ChartCategory Members (Excel)

 Copy code hover
[image]

ChartCategory Members (Excel)
Send feedback

Published: July 16, 2012

Specifies a chart type's category.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
IsFiltered | Returns TRUE when the user filters out a series. Boolean Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


ChartCategory Properties (Excel)

 Copy code hover
[image]

ChartCategory Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
IsFiltered | Returns TRUE when the user filters out a series. Boolean Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


ChartCategory.Application Property (Excel)

 Copy code hover
[image]

ChartCategory.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ChartCategory object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCategory.Creator Property (Excel)

 Copy code hover
[image]

ChartCategory.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ChartCategory object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

Property value

XLCREATOR

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCategory.IsFiltered Property (Excel)

 Copy code hover
[image]

ChartCategory.IsFiltered Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns TRUE when the user filters out a series. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .IsFiltered

expression A variable that represents a ChartCategory object.

Remarks

When a series is transferred out of its parent SeriesCollection, that series still remains in its parent FullSeriesCollection. When a user filters the series back in, it is inserted back in its original place in the SeriesCollection.

Property value

BOOL

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCategory.Name Property (Excel)

 Copy code hover
[image]

ChartCategory.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Version information

Version Added: Excel 2013

Syntax

expression .Name

expression A variable that represents a ChartCategory object.

Property value

STRING

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCategory.Parent Property (Excel)

 Copy code hover
[image]

ChartCategory.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ChartCategory object.

Property value

OBJECT

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartFormat Object (Excel)

 Copy code hover
[image]

ChartFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Provides access to the Office Art formatting for chart elements.

Version Information

Version Added: Excel 2007

Remarks

Using a property or method that does not apply to the type of object the ChartFormat object is attached to will result in a run-time error.

See also

Concepts

Excel Object Model Reference

Other resources

ChartFormat Object Members


ChartFormat Members (Excel)

 Copy code hover
[image]

ChartFormat Members (Excel)
Send feedback

Published: July 16, 2012

Provides access to the Office Art formatting for chart elements.

Properties

Name | Description
Adjustments | Returns an Adjustments Object (Excel) object. Read-only
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns the type of the specified shape. MsoAutoShapeType Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Glow | Returns a GlowFormat object for a specified chart that contains glow formatting properties for the chart element. Read-only.
Line | Returns a LineFormat object that contains line formatting properties for the specified chart element. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PictureFormat | Returns a PictureFormat object for a specified chart that contains pictures. Read-only.
Shadow | Returns a ShadowFormat object that contains shadow formatting properties for the chart element. Read-only.
SoftEdge | Returns a SoftEdgeFormat object for a specified chart that contains soft edge formatting properties for the chart. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified chart element. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified chart. Read-only.


ChartFormat Properties (Excel)

 Copy code hover
[image]

ChartFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments Object (Excel) object. Read-only
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns the type of the specified shape. MsoAutoShapeType Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Glow | Returns a GlowFormat object for a specified chart that contains glow formatting properties for the chart element. Read-only.
Line | Returns a LineFormat object that contains line formatting properties for the specified chart element. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PictureFormat | Returns a PictureFormat object for a specified chart that contains pictures. Read-only.
Shadow | Returns a ShadowFormat object that contains shadow formatting properties for the chart element. Read-only.
SoftEdge | Returns a SoftEdgeFormat object for a specified chart that contains soft edge formatting properties for the chart. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified chart element. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified chart. Read-only.


ChartFormat.Adjustments Property (Excel)

 Copy code hover
[image]

ChartFormat.Adjustments Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments Object (Excel) object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Adjustments

expression A variable that represents a ChartFormat object.

Property value

ADJUSTMENTS

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Application Property (Excel)

 Copy code hover
[image]

ChartFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ChartFormat object.

Return Value

Application

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.AutoShapeType Property (Excel)

 Copy code hover
[image]

ChartFormat.AutoShapeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the specified shape. MsoAutoShapeType Read-only

Version information

Version Added: Excel 2013

Syntax

expression .AutoShapeType

expression A variable that represents a ChartFormat object.

Property value

MSOAUTOSHAPETYPE

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Creator Property (Excel)

 Copy code hover
[image]

ChartFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a ChartFormat object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Fill Property (Excel)

 Copy code hover
[image]

ChartFormat.Fill Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Fill

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Glow Property (Excel)

 Copy code hover
[image]

ChartFormat.Glow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object for a specified chart that contains glow formatting properties for the chart element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Glow

expression A variable that represents a ChartFormat object.

Remarks

The glow effect adds a vibrant colored edge to graphics.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Line Property (Excel)

 Copy code hover
[image]

ChartFormat.Line Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified chart element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Line

expression A variable that represents a ChartFormat object.

Remarks

For a line, the LineFormat object represents the line itself; for a chart with a border, the LineFormat object represents the border.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Parent Property (Excel)

 Copy code hover
[image]

ChartFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.PictureFormat Property (Excel)

 Copy code hover
[image]

ChartFormat.PictureFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object for a specified chart that contains pictures. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PictureFormat

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Shadow Property (Excel)

 Copy code hover
[image]

ChartFormat.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShadowFormat object that contains shadow formatting properties for the chart element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Shadow

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.SoftEdge Property (Excel)

 Copy code hover
[image]

ChartFormat.SoftEdge Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object for a specified chart that contains soft edge formatting properties for the chart. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SoftEdge

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.TextFrame2 Property (Excel)

 Copy code hover
[image]

ChartFormat.TextFrame2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame2 object that contains text formatting for the specified chart element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TextFrame2

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.ThreeD Property (Excel)

 Copy code hover
[image]

ChartFormat.ThreeD Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified chart. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ThreeD

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartGroup Object (Excel)

 Copy code hover
[image]

ChartGroup Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Remarks

A chart contains one or more chart groups, each chart group contains one or more Series objects, and each series contains one or more Points objects. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format. The ChartGroup object is a member of the ChartGroups collection.

Use ChartGroups(index), where index is the chart-group index number, to return a single ChartGroup object.

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named chart group shortcut methods to return a particular chart group. The PieGroups method returns the collection of pie chart groups in a chart, the LineGroups method returns the collection of line chart groups, and so on. Each of these methods can be used with an index number to return a single ChartGroup object, or without an index number to return a ChartGroups collection.

Example

The following example adds drop lines to chart group 1 on chart sheet 1.

VBA Copy code Copy code
Charts(1).ChartGroups(1).HasDropLines = True

If the chart has been activated, you can use the ActiveChart property.

VBA Copy code Copy code
Charts(1).Activate
ActiveChart.ChartGroups(1).HasDropLines = True

See also

Concepts

Excel Object Model Reference

Other resources

ChartGroup Object Members


ChartGroup Members (Excel)

 Copy code hover
[image]

ChartGroup Members (Excel)
Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Methods

Name | Description
CategoryCollection | Returns an object that represents a collection of all of the visible categories (a CategoryCollection collection) in the chart group.
FullCategoryCollection | Returns an object that represents a collection of all of the visible and filtered categories (a CategoryCollection collection) in the chart group.
SeriesCollection | Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AxisGroup | Returns or sets the group for the specified chart. Read/write
BubbleScale | Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DoughnutHoleSize | Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. Read/write Long.
DownBars | Returns a DownBars object that represents the down bars on a line chart. Applies only to line charts. Read-only.
DropLines | Returns a DropLines object that represents the drop lines for a series on a line chart or area chart. Applies only to line charts or area charts. Read-only.
FirstSliceAngle | Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/write Long.
GapWidth | Bar and Column charts: Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. Pie of Pie and Bar of Pie charts: Returns or sets the space between the primary and secondary sections of the chart. Read/write Long.
Has3DShading | Returns or sets the 3D Shading property of a ChartGroup object. Read/write Boolean.
HasDropLines | True if the line chart or area chart has drop lines. Applies only to line and area charts. Read/write Boolean.
HasHiLoLines | True if the line chart has high-low lines. Applies only to line charts. Read/write Boolean.
HasRadarAxisLabels | True if a radar chart has axis labels. Applies only to radar charts. Read/write Boolean.
HasSeriesLines | True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie charts. Read/write Boolean.
HasUpDownBars | True if a line chart has up and down bars. Applies only to line charts. Read/write Boolean.
HiLoLines | Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts. Read-only.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Overlap | Specifies how bars and columns are positioned. Can be a value between - 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
RadarAxisLabels | Returns a TickLabels object that represents the radar axis labels for the specified chart group. Read-only.
SecondPlotSize | Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/write Long.
SeriesLines | Returns a SeriesLines object that represents the series lines for a 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie chart. Read-only.
ShowNegativeBubbles | True if negative bubbles are shown for the chart group. Valid only for bubble charts. Read/write Boolean.
SizeRepresents | Returns or sets what the bubble size represents on a bubble chart. Can be either of the following XlSizeRepresents constants: xlSizeIsArea or xlSizeIsWidth. Read/write Long.
SplitType | Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/write XlChartSplitType.
SplitValue | Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart. Read/write Variant.
UpBars | Returns an UpBars object that represents the up bars on a line chart. Applies only to line charts. Read-only.
VaryByCategories | True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/write Boolean.


ChartGroup Properties (Excel)

 Copy code hover
[image]

ChartGroup Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AxisGroup | Returns or sets the group for the specified chart. Read/write
BubbleScale | Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DoughnutHoleSize | Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. Read/write Long.
DownBars | Returns a DownBars object that represents the down bars on a line chart. Applies only to line charts. Read-only.
DropLines | Returns a DropLines object that represents the drop lines for a series on a line chart or area chart. Applies only to line charts or area charts. Read-only.
FirstSliceAngle | Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/write Long.
GapWidth | Bar and Column charts: Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. Pie of Pie and Bar of Pie charts: Returns or sets the space between the primary and secondary sections of the chart. Read/write Long.
Has3DShading | Returns or sets the 3D Shading property of a ChartGroup object. Read/write Boolean.
HasDropLines | True if the line chart or area chart has drop lines. Applies only to line and area charts. Read/write Boolean.
HasHiLoLines | True if the line chart has high-low lines. Applies only to line charts. Read/write Boolean.
HasRadarAxisLabels | True if a radar chart has axis labels. Applies only to radar charts. Read/write Boolean.
HasSeriesLines | True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie charts. Read/write Boolean.
HasUpDownBars | True if a line chart has up and down bars. Applies only to line charts. Read/write Boolean.
HiLoLines | Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts. Read-only.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Overlap | Specifies how bars and columns are positioned. Can be a value between - 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
RadarAxisLabels | Returns a TickLabels object that represents the radar axis labels for the specified chart group. Read-only.
SecondPlotSize | Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/write Long.
SeriesLines | Returns a SeriesLines object that represents the series lines for a 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie chart. Read-only.
ShowNegativeBubbles | True if negative bubbles are shown for the chart group. Valid only for bubble charts. Read/write Boolean.
SizeRepresents | Returns or sets what the bubble size represents on a bubble chart. Can be either of the following XlSizeRepresents constants: xlSizeIsArea or xlSizeIsWidth. Read/write Long.
SplitType | Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/write XlChartSplitType.
SplitValue | Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart. Read/write Variant.
UpBars | Returns an UpBars object that represents the up bars on a line chart. Applies only to line charts. Read-only.
VaryByCategories | True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/write Boolean.


ChartGroup.Application Property (Excel)

 Copy code hover
[image]

ChartGroup.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartGroup object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.AxisGroup Property (Excel)

 Copy code hover
[image]

ChartGroup.AxisGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the group for the specified chart. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AxisGroup

expression A variable that represents a ChartGroup object.

Return Value

XlAxisGroup

Remarks

For 3-D charts, only xlPrimary is valid.

Example

This example deletes the value axis if it is in the secondary group.

VBA Copy code Copy code
With myChart.Axes(xlValue)
 If .AxisGroup = xlSecondary Then .Delete
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.BubbleScale Property (Excel)

 Copy code hover
[image]

ChartGroup.BubbleScale Property (Excel)
See also Send feedback

Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. Read/write Long.

Syntax

expression .BubbleScale

expression A variable that represents a ChartGroup object.

Example

This example sets the bubble size in chart group one to 200% of the default size.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .ChartGroups(1).BubbleScale = 200
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Creator Property (Excel)

 Copy code hover
[image]

ChartGroup.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartGroup object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DoughnutHoleSize Property (Excel)

 Copy code hover
[image]

ChartGroup.DoughnutHoleSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. Read/write Long.

Syntax

expression .DoughnutHoleSize

expression A variable that represents a ChartGroup object.

Example

This example sets the hole size for doughnut group one in Chart1. The example should be run on a 2-D doughnut chart.

VBA Copy code Copy code
Charts("Chart1").DoughnutGroups(1).DoughnutHoleSize = 10

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DownBars Property (Excel)

 Copy code hover
[image]

ChartGroup.DownBars Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DownBars object that represents the down bars on a line chart. Applies only to line charts. Read-only.

Syntax

expression .DownBars

expression A variable that represents a ChartGroup object.

Example

This example turns on up bars and down bars for chart group one in Chart1 and then sets their colors. The example should be run on a 2-D line chart that has two series that cross each other at one or more data points.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DropLines Property (Excel)

 Copy code hover
[image]

ChartGroup.DropLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DropLines object that represents the drop lines for a series on a line chart or area chart. Applies only to line charts or area charts. Read-only.

Syntax

expression .DropLines

expression A variable that represents a ChartGroup object.

Example

This example turns on drop lines for chart group one in Chart1 and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.FirstSliceAngle Property (Excel)

 Copy code hover
[image]

ChartGroup.FirstSliceAngle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/write Long.

Syntax

expression .FirstSliceAngle

expression A variable that represents a ChartGroup object.

Example

This example sets the angle for the first slice in chart group one in Chart1. The example should be run on a 2-D pie chart.

VBA Copy code Copy code
Charts("Chart1").ChartGroups(1).FirstSliceAngle = 15

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.GapWidth Property (Excel)

 Copy code hover
[image]

ChartGroup.GapWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Bar and Column charts: Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. Pie of Pie and Bar of Pie charts: Returns or sets the space between the primary and secondary sections of the chart. Read/write Long.

Syntax

expression .GapWidth

expression A variable that represents a ChartGroup object.

Remarks

The value of this property must be between 0 and 500.

Example

This example sets the space between column clusters in Chart1 to be 50 percent of the column width.

VBA Copy code Copy code
Charts("Chart1").ChartGroups(1).GapWidth = 50

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Has3DShading Property (Excel)

 Copy code hover
[image]

ChartGroup.Has3DShading Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the 3D Shading property of a ChartGroup object. Read/write Boolean.

Syntax

expression .Has3DShading

expression A variable that represents a ChartGroup object.

Example

This example adds three-dimensional shading to a chart group.

VBA Copy code Copy code
Charts(1).ChartGroups(1).Has3DShading = True

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasDropLines Property (Excel)

 Copy code hover
[image]

ChartGroup.HasDropLines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the line chart or area chart has drop lines. Applies only to line and area charts. Read/write Boolean.

Syntax

expression .HasDropLines

expression A variable that represents a ChartGroup object.

Example

This example turns on drop lines for chart group one in Chart1 and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasHiLoLines Property (Excel)

 Copy code hover
[image]

ChartGroup.HasHiLoLines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the line chart has high-low lines. Applies only to line charts. Read/write Boolean.

Syntax

expression .HasHiLoLines

expression A variable that represents a ChartGroup object.

Example

This example turns on high-low lines for chart group one in Chart1 and then sets line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasRadarAxisLabels Property (Excel)

 Copy code hover
[image]

ChartGroup.HasRadarAxisLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a radar chart has axis labels. Applies only to radar charts. Read/write Boolean.

Syntax

expression .HasRadarAxisLabels

expression A variable that represents a ChartGroup object.

Example

This example turns on radar axis labels for chart group one in Chart1 and sets their color. The example should be run on a radar chart.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasSeriesLines Property (Excel)

 Copy code hover
[image]

ChartGroup.HasSeriesLines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie charts. Read/write Boolean.

Syntax

expression .HasSeriesLines

expression A variable that represents a ChartGroup object.

Example

This example turns on series lines for chart group one in Chart1 and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasUpDownBars Property (Excel)

 Copy code hover
[image]

ChartGroup.HasUpDownBars Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a line chart has up and down bars. Applies only to line charts. Read/write Boolean.

Syntax

expression .HasUpDownBars

expression A variable that represents a ChartGroup object.

Example

This example turns on up and down bars for chart group one in Chart1 and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HiLoLines Property (Excel)

 Copy code hover
[image]

ChartGroup.HiLoLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts. Read-only.

Syntax

expression .HiLoLines

expression A variable that represents a ChartGroup object.

Example

This example turns on high-low lines for chart group one in Chart1 and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Index Property (Excel)

 Copy code hover
[image]

ChartGroup.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a ChartGroup object.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Overlap Property (Excel)

 Copy code hover
[image]

ChartGroup.Overlap Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies how bars and columns are positioned. Can be a value between - 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/write Long.

Syntax

expression .Overlap

expression A variable that represents a ChartGroup object.

Remarks

If this property is set to - 100, bars are positioned so that there's one bar width between them. If the overlap is 0 (zero), there's no space between bars (one bar starts immediately after the preceding bar). If the overlap is 100, bars are positioned on top of each other.

Example

This example sets the overlap for chart group one to - 50. The example should be run on a 2-D column chart that has two or more series.

VBA Copy code Copy code
Charts("Chart1").ChartGroups(1).Overlap = -50

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Parent Property (Excel)

 Copy code hover
[image]

ChartGroup.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartGroup object.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.RadarAxisLabels Property (Excel)

 Copy code hover
[image]

ChartGroup.RadarAxisLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TickLabels object that represents the radar axis labels for the specified chart group. Read-only.

Syntax

expression .RadarAxisLabels

expression A variable that represents a ChartGroup object.

Example

This example turns on radar axis labels for chart group one in Chart1 and then sets the color for the labels. The example should be run on a radar chart.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SecondPlotSize Property (Excel)

 Copy code hover
[image]

ChartGroup.SecondPlotSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/write Long.

Syntax

expression .SecondPlotSize

expression A variable that represents a ChartGroup object.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. The secondary section is 50 percent of the size of the primary pie.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
 .SecondPlotSize = 50
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SeriesLines Property (Excel)

 Copy code hover
[image]

ChartGroup.SeriesLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SeriesLines object that represents the series lines for a 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie chart. Read-only.

Syntax

expression .SeriesLines

expression A variable that represents a ChartGroup object.

Example

This example turns on series lines for chart group one in Chart1 and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.ShowNegativeBubbles Property (Excel)

 Copy code hover
[image]

ChartGroup.ShowNegativeBubbles Property (Excel)
See also Send feedback

Published: July 16, 2012

True if negative bubbles are shown for the chart group. Valid only for bubble charts. Read/write Boolean.

Syntax

expression .ShowNegativeBubbles

expression A variable that represents a ChartGroup object.

Example

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .ChartGroups(1).ShowNegativeBubbles = True

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SizeRepresents Property (Excel)

 Copy code hover
[image]

ChartGroup.SizeRepresents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets what the bubble size represents on a bubble chart. Can be either of the following XlSizeRepresents constants: xlSizeIsArea or xlSizeIsWidth. Read/write Long.

Syntax

expression .SizeRepresents

expression A variable that represents a ChartGroup object.

Example

This example sets what the bubble size represents for chart group one.

VBA Copy code Copy code
Charts(1).ChartGroups(1).SizeRepresents = xlSizeIsWidth

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SplitType Property (Excel)

 Copy code hover
[image]

ChartGroup.SplitType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/write XlChartSplitType.

Syntax

expression .SplitType

expression A variable that represents a ChartGroup object.

Remarks

XlChartSplitType can be one of these XlChartSplitType constants.

xlSplitByCustomSplit

xlSplitByPercentValue

xlSplitByPosition

xlSplitByValue

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SplitValue Property (Excel)

 Copy code hover
[image]

ChartGroup.SplitValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart. Read/write Variant.

Syntax

expression .SplitValue

expression A variable that represents a ChartGroup object.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.UpBars Property (Excel)

 Copy code hover
[image]

ChartGroup.UpBars Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an UpBars object that represents the up bars on a line chart. Applies only to line charts. Read-only.

Syntax

expression .UpBars

expression A variable that represents a ChartGroup object.

Example

This example turns on up and down bars for chart group one in Chart1 and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

VBA Copy code Copy code
With Charts("Chart1").ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.VaryByCategories Property (Excel)

 Copy code hover
[image]

ChartGroup.VaryByCategories Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/write Boolean.

Syntax

expression .VaryByCategories

expression A variable that represents a ChartGroup object.

Example

This example assigns a different color or pattern to each data marker in chart group one. The example should be run on a 2-D line chart that has data markers on a series.

VBA Copy code Copy code
Charts("Chart1").ChartGroups(1).VaryByCategories = True

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup Methods (Excel)

 Copy code hover
[image]

ChartGroup Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CategoryCollection | Returns an object that represents a collection of all of the visible categories (a CategoryCollection collection) in the chart group.
FullCategoryCollection | Returns an object that represents a collection of all of the visible and filtered categories (a CategoryCollection collection) in the chart group.
SeriesCollection | Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.


ChartGroup.CategoryCollection Method (Excel)

 Copy code hover
[image]

ChartGroup.CategoryCollection Method (Excel)
See also Send feedback

Returns an object that represents a collection of all of the visible categories (a CategoryCollection collection) in the chart group.

Version information

Version Added: Excel 2013

Syntax

expression .CategoryCollection(Index)

expression A variable that represents a ChartGroup object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The name or number of the categories.

Return value

OBJECT

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.FullCategoryCollection Method (Excel)

 Copy code hover
[image]

ChartGroup.FullCategoryCollection Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents a collection of all of the visible and filtered categories (a CategoryCollection collection) in the chart group.

Version information

Version Added: Excel 2013

Syntax

expression .FullCategoryCollection(Index)

expression A variable that represents a ChartGroup object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The name or number of the categories.

Return value

OBJECT

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SeriesCollection Method (Excel)

 Copy code hover
[image]

ChartGroup.SeriesCollection Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.

Syntax

expression .SeriesCollection(Index)

expression A variable that represents a ChartGroup object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the series.

Return Value

Object

Example

This example turns on data labels for series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).HasDataLabels = True

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroups Object (Excel)

 Copy code hover
[image]

ChartGroups Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Remarks

A ChartGroups collection is a collection of all the ChartGroup objects in the specified chart. A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format.

Use the ChartGroups method to return the ChartGroups collection. The following example displays the number of chart groups on embedded chart 1 on worksheet 1.

VBA Copy code Copy code
MsgBox Worksheets(1).ChartObjects(1).Chart.ChartGroups.Count

Use ChartGroups(index), where index is the chart-group index number, to return a single ChartGroup object. The following example adds drop lines to chart group 1 on chart sheet 1.

VBA Copy code Copy code
Charts(1).ChartGroups(1).HasDropLines = True

If the chart has been activated, you can use ActiveChart:

VBA Copy code Copy code
Charts(1).Activate
ActiveChart.ChartGroups(1).HasDropLines = True

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named chart group shortcut methods to return a particular chart group. The PieGroups method returns the collection of pie chart groups in a chart, the LineGroups method returns the collection of line chart groups, and so on. Each of these methods can be used with an index number to return a single ChartGroup object, or without an index number to return a ChartGroups collection.

See also

Concepts

Excel Object Model Reference

Other resources

ChartGroups Object Members


ChartGroups Members (Excel)

 Copy code hover
[image]

ChartGroups Members (Excel)
Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ChartGroups Properties (Excel)

 Copy code hover
[image]

ChartGroups Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ChartGroups.Application Property (Excel)

 Copy code hover
[image]

ChartGroups.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartGroups object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Count Property (Excel)

 Copy code hover
[image]

ChartGroups.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ChartGroups object.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Creator Property (Excel)

 Copy code hover
[image]

ChartGroups.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartGroups object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Parent Property (Excel)

 Copy code hover
[image]

ChartGroups.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartGroups object.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups Methods (Excel)

 Copy code hover
[image]

ChartGroups Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


ChartGroups.Item Method (Excel)

 Copy code hover
[image]

ChartGroups.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ChartGroups object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A ChartGroup object contained by the collection.

Example

This example adds drop lines to chart group one on chart sheet one.

VBA Copy code Copy code
Charts(1).ChartGroups.Item(1).HasDropLines = True

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartObject Object (Excel)

 Copy code hover
[image]

ChartObject Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an embedded chart on a worksheet.

Remarks

The ChartObject object acts as a container for a Chart object. Properties and methods for the ChartObject object control the appearance and size of the embedded chart on the worksheet. The ChartObject object is a member of the ChartObjects collection. The ChartObjects collection contains all the embedded charts on a single sheet.

Use ChartObjects(index), where index is the embedded chart index number or name, to return a single ChartObject object.

Example

The following example sets the pattern for the chart area in embedded Chart 1 on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart. _
 ChartArea.Format.Fill.Pattern = msoPatternLightDownwardDiagonal

The embedded chart name is shown in the Name box when the embedded chart is selected. Use the Name property to set or return the name of the ChartObject object. The following example puts rounded corners on the embedded chart named "Chart 1" on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects("chart 1").RoundedCorners = True

See also

Concepts

Excel Object Model Reference

Other resources

ChartObject Object Members


ChartObject Members (Excel)

 Copy code hover
[image]

ChartObject Members (Excel)
Send feedback

Published: July 16, 2012

Represents an embedded chart on a worksheet.

Methods

Name | Description
Activate | Makes the current chart the active chart.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Chart | Returns a Chart object that represents the chart contained in the object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
ProtectChartObject | True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.
RoundedCorners | True if the embedded chart has rounded corners. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the font is a shadow font or if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


ChartObject Properties (Excel)

 Copy code hover
[image]

ChartObject Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Chart | Returns a Chart object that represents the chart contained in the object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
ProtectChartObject | True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.
RoundedCorners | True if the embedded chart has rounded corners. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the font is a shadow font or if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


ChartObject.Application Property (Excel)

 Copy code hover
[image]

ChartObject.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartObject object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.BottomRightCell Property (Excel)

 Copy code hover
[image]

ChartObject.BottomRightCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.

Syntax

expression .BottomRightCell

expression A variable that represents a ChartObject object.

Example

This example displays the address of the cell beneath the lower-right corner of embedded chart one on Sheet1.

VBA Copy code Copy code
MsgBox "The bottom right corner is over cell " & _
 Worksheets("Sheet1").ChartObjects(1).BottomRightCell.Address

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Chart Property (Excel)

 Copy code hover
[image]

ChartObject.Chart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the chart contained in the object. Read-only.

Syntax

expression .Chart

expression A variable that represents a ChartObject object.

Example

This example adds a title to the first embedded chart on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").ChartObjects(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "1995 Rainfall Totals by Month"
End With

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Creator Property (Excel)

 Copy code hover
[image]

ChartObject.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartObject object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Height Property (Excel)

 Copy code hover
[image]

ChartObject.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a ChartObject object.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Index Property (Excel)

 Copy code hover
[image]

ChartObject.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a ChartObject object.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Left Property (Excel)

 Copy code hover
[image]

ChartObject.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a ChartObject object.

Example

This example aligns the left edge of the embedded chart with the left edge of column B.

VBA Copy code Copy code
With Worksheets("Sheet1")
 .ChartObjects(1).Left = .Columns("B").Left
End With

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Locked Property (Excel)

 Copy code hover
[image]

ChartObject.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a ChartObject object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Name Property (Excel)

 Copy code hover
[image]

ChartObject.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a ChartObject object.

Remarks

This property is read-only for chart objects (embedded charts).

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Parent Property (Excel)

 Copy code hover
[image]

ChartObject.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartObject object.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Placement Property (Excel)

 Copy code hover
[image]

ChartObject.Placement Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.

Syntax

expression .Placement

expression A variable that represents a ChartObject object.

Example

This example sets embedded chart one on Sheet1 to be free-floating (it neither moves nor is sized with its underlying cells).

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Placement = xlFreeFloating

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.PrintObject Property (Excel)

 Copy code hover
[image]

ChartObject.PrintObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object will be printed when the document is printed. Read/write Boolean.

Syntax

expression .PrintObject

expression A variable that represents a ChartObject object.

Example

This example sets embedded chart one on Sheet1 to be printed with the worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).PrintObject = True

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.ProtectChartObject Property (Excel)

 Copy code hover
[image]

ChartObject.ProtectChartObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.

Syntax

expression .ProtectChartObject

expression A variable that represents a ChartObject object.

Remarks

Setting this property to True will not protect the embedded chart frame from being modified through the object model.

Example

This example protects embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).ProtectChartObject = True

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.RoundedCorners Property (Excel)

 Copy code hover
[image]

ChartObject.RoundedCorners Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the embedded chart has rounded corners. Read/write Boolean.

Syntax

expression .RoundedCorners

expression A variable that represents a ChartObject object.

Example

This example adds rounded corners to embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).RoundedCorners = True

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Shadow Property (Excel)

 Copy code hover
[image]

ChartObject.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the font is a shadow font or if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a ChartObject object.

Remarks

For the Font object, this property has no effect in Microsoft Windows, but its value is retained (it can be set and returned).

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.ShapeRange Property (Excel)

 Copy code hover
[image]

ChartObject.ShapeRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents the specified object or objects. Read-only.

Syntax

expression .ShapeRange

expression An expression that returns a ChartObject object.

Example

This example creates a shape range that represents the embedded charts on worksheet one.

VBA Copy code Copy code
Set sr = Worksheets(1).ChartObjects.ShapeRange

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Top Property (Excel)

 Copy code hover
[image]

ChartObject.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a ChartObject object.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.TopLeftCell Property (Excel)

 Copy code hover
[image]

ChartObject.TopLeftCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.

Syntax

expression .TopLeftCell

expression A variable that represents a ChartObject object.

Example

This example displays the address of the cell beneath the upper-left corner of embedded chart one on Sheet1.

VBA Copy code Copy code
MsgBox "The top left corner is over cell " & _
 Worksheets("Sheet1").ChartObjects(1).TopLeftCell.Address

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Visible Property (Excel)

 Copy code hover
[image]

ChartObject.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ChartObject object.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Width Property (Excel)

 Copy code hover
[image]

ChartObject.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a ChartObject object.

Example

This example sets the width of the embedded chart.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Width = 360

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.ZOrder Property (Excel)

 Copy code hover
[image]

ChartObject.ZOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the z-order position of the object. Read-only Long.

Syntax

expression .ZOrder

expression A variable that represents a ChartObject object.

Remarks

In any collection of objects, the object at the back of the z-order is collection(1), and the object at the front of the z-order is collection(collection.Count). For example, if there are embedded charts on the active sheet, the chart at the back of the z-order is ActiveSheet.ChartObjects(1), and the chart at the front of the z-order is ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).

Example

This example displays the z-order position of embedded chart one on Sheet1.

VBA Copy code Copy code
MsgBox "The chart's z-order position is " & _
 Worksheets("Sheet1").ChartObjects(1).ZOrder

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject Methods (Excel)

 Copy code hover
[image]

ChartObject Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Makes the current chart the active chart.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.


ChartObject.Activate Method (Excel)

 Copy code hover
[image]

ChartObject.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes the current chart the active chart.

Syntax

expression .Activate

expression A variable that represents a ChartObject object.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.BringToFront Method (Excel)

 Copy code hover
[image]

ChartObject.BringToFront Method (Excel)
See also Send feedback

Published: July 16, 2012

Brings the object to the front of the z-order.

Syntax

expression .BringToFront

expression A variable that represents a ChartObject object.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Copy Method (Excel)

 Copy code hover
[image]

ChartObject.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a ChartObject object.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.CopyPicture Method (Excel)

 Copy code hover
[image]

ChartObject.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents a ChartObject object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | XlCopyPictureFormat | . The format of the picture. The default value is xlPicture.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Cut Method (Excel)

 Copy code hover
[image]

ChartObject.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard.

Syntax

expression .Cut

expression A variable that represents a ChartObject object.

Return Value

Variant

Remarks

Only embedded charts can be cut.

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Delete Method (Excel)

 Copy code hover
[image]

ChartObject.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a ChartObject object.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Duplicate Method (Excel)

 Copy code hover
[image]

ChartObject.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents a ChartObject object.

Return Value

Object

Example

This example duplicates embedded chart one on Sheet1 and then selects the copy.

VBA Copy code Copy code
Set dChart = Worksheets("Sheet1").ChartObjects(1).Duplicate
dChart.Select

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.Select Method (Excel)

 Copy code hover
[image]

ChartObject.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a ChartObject object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Return Value

Variant

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObject.SendToBack Method (Excel)

 Copy code hover
[image]

ChartObject.SendToBack Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends the object to the back of the z-order.

Syntax

expression .SendToBack

expression A variable that represents a ChartObject object.

Return Value

Variant

Example

This example sends embedded chart one on Sheet1 to the back of the z-order.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).SendToBack

See also

Concepts

ChartObject Object

Other resources

ChartObject Object Members


ChartObjects Object (Excel)

 Copy code hover
[image]

ChartObjects Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the ChartObject objects on the specified chart sheet, dialog sheet, or worksheet.

Remarks

Each ChartObject object represents an embedded chart. The ChartObject object acts as a container for a Chart object. Properties and methods for the ChartObject object control the appearance and size of the embedded chart on the sheet. ChartObjects collection

Example

Use the ChartObjects method to return the ChartObjects collection. The following example deletes all the embedded charts on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects.Delete

You cannot use the ChartObjects collection to call the following properties and methods:

  • Locked property

  • Placement property

  • PrintObject property

Unlike in previous version, the ChartObjects collection can now read the properties for height, width, left and top.

Use the Add method to create a new, empty embedded chart and add it to the collection. Use the ChartWizard method to add data and format the new chart. The following example creates a new embedded chart and then adds the data from cells A1:A20 as a line chart.

VBA Copy code Copy code
Dim ch As ChartObject
Set ch = Worksheets("sheet1").ChartObjects.Add(100, 30, 400, 250)
ch.Chart.ChartWizard source:=Worksheets("sheet1").Range("a1:a20"), _
 gallery:=xlLine, title:="New Chart"

Use ChartObjects(index), where index is the embedded chart index number or name, to return a single object. The following example sets the pattern for the chart area in embedded Chart 1 on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart. _
 CChartObjecthartArea.Format.Fill.Pattern = msoPatternLightDownwardDiagonal

See also

Concepts

Excel Object Model Reference

Other resources

ChartObjects Object Members


ChartObjects Members (Excel)

 Copy code hover
[image]

ChartObjects Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ChartObject objects on the specified chart sheet, dialog sheet, or worksheet.

Methods

Name | Description
Add | Creates a new embedded chart.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Item | Returns a single object from a collection.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the objects are locked.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the objects are attached to the cells below them.
PrintObject | True if the objects will be printed when the document is printed. Read/write Boolean.
ProtectChartObject | True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.


ChartObjects Properties (Excel)

 Copy code hover
[image]

ChartObjects Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the objects are locked.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the objects are attached to the cells below them.
PrintObject | True if the objects will be printed when the document is printed. Read/write Boolean.
ProtectChartObject | True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.


ChartObjects.Application Property (Excel)

 Copy code hover
[image]

ChartObjects.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartObjects object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Count Property (Excel)

 Copy code hover
[image]

ChartObjects.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Creator Property (Excel)

 Copy code hover
[image]

ChartObjects.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartObjects object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Height Property (Excel)

 Copy code hover
[image]

ChartObjects.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Left Property (Excel)

 Copy code hover
[image]

ChartObjects.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Locked Property (Excel)

 Copy code hover
[image]

ChartObjects.Locked Property (Excel)
Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the objects are locked.

Syntax

expression .Locked

expression A variable that represents a ChartObjects object.

Remarks

This property returns True if the objects are locked or False if the objects can be modified when the sheet is protected.


ChartObjects.Parent Property (Excel)

 Copy code hover
[image]

ChartObjects.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Placement Property (Excel)

 Copy code hover
[image]

ChartObjects.Placement Property (Excel)
Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the objects are attached to the cells below them.

Syntax

expression .Placement

expression A variable that represents a ChartObjects object.

Example

This example sets the objects on Sheet1 to be free-floating (they neither moves nor are they sized with underlying cells).

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects.Placement = xlFreeFloating


ChartObjects.PrintObject Property (Excel)

 Copy code hover
[image]

ChartObjects.PrintObject Property (Excel)
Send feedback

Published: July 16, 2012

True if the objects will be printed when the document is printed. Read/write Boolean.

Syntax

expression .PrintObject

expression A variable that represents a ChartObjects object.

Example

This example sets the objects on Sheet1 to be printed with the worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects.PrintObject = True


ChartObjects.ProtectChartObject Property (Excel)

 Copy code hover
[image]

ChartObjects.ProtectChartObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the embedded chart frame cannot be moved, resized, or deleted through the user interface. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ProtectChartObject

expression A variable that represents a ChartObjects object.

Remarks

Setting this property to True will not protect the embedded chart frame from being modified through the object model.

Example

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).ProtectChartObject = True

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.ShapeRange Property (Excel)

 Copy code hover
[image]

ChartObjects.ShapeRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents the specified object or objects. Read-only.

Syntax

expression .ShapeRange

expression An expression that returns a ChartObjects object.

Example

This example creates a shape range that represents the embedded charts on worksheet one.

VBA Copy code Copy code
Set sr = Worksheets(1).ChartObjects.ShapeRange

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Top Property (Excel)

 Copy code hover
[image]

ChartObjects.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Visible Property (Excel)

 Copy code hover
[image]

ChartObjects.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Width Property (Excel)

 Copy code hover
[image]

ChartObjects.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a ChartObjects object.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects Methods (Excel)

 Copy code hover
[image]

ChartObjects Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new embedded chart.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Item | Returns a single object from a collection.
Select | Selects the object.


ChartObjects.Add Method (Excel)

 Copy code hover
[image]

ChartObjects.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new embedded chart.

Syntax

expression .Add(Left, Top, Width, Height)

expression A variable that represents a ChartObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Double | The initial coordinates of the new object (in points), relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.
Width | Required | Double | The initial size of the new object, in points.

Return Value

A ChartObject object that represents the new embedded chart.

Example

This example creates a new embedded chart..

VBA Copy code Copy code
Set co = Sheets("Sheet1").ChartObjects.Add(50, 40, 200, 100)
co.Chart.ChartWizard Source:=Worksheets("Sheet1").Range("A1:B2"), _
 Gallery:=xlColumn, Format:=6, PlotBy:=xlColumns, _
 CategoryLabels:=1, SeriesLabels:=0, HasLegend:=1

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Copy Method (Excel)

 Copy code hover
[image]

ChartObjects.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a ChartObjects object.

Return Value

Variant

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.CopyPicture Method (Excel)

 Copy code hover
[image]

ChartObjects.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture. Variant.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents a ChartObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | XlCopyPictureFormat | . The format of the picture. The default value is xlPicture.

Return Value

Variant

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Cut Method (Excel)

 Copy code hover
[image]

ChartObjects.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard.

Syntax

expression .Cut

expression A variable that represents a ChartObjects object.

Return Value

Variant

Remarks

Only embedded charts can be cut.

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Delete Method (Excel)

 Copy code hover
[image]

ChartObjects.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a ChartObjects object.

Return Value

Variant

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Duplicate Method (Excel)

 Copy code hover
[image]

ChartObjects.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents a ChartObjects object.

Return Value

Object

Example

This example duplicates embedded chart one on Sheet1 and then selects the copy.

VBA Copy code Copy code
Set dChart = Worksheets("Sheet1").ChartObjects(1).Duplicate
dChart.Select

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Item Method (Excel)

 Copy code hover
[image]

ChartObjects.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ChartObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

An Object value that represents an object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example activates embedded chart one.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects.Item(1).Activate

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


ChartObjects.Select Method (Excel)

 Copy code hover
[image]

ChartObjects.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a ChartObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Return Value

Variant

See also

Concepts

ChartObjects Object

Other resources

ChartObjects Object Members


Charts Object (Excel)

 Copy code hover
[image]

Charts Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the chart sheets in the specified or active workbook.

Remarks

Each chart sheet is represented by a Chart object. This does not include charts embedded on worksheets or dialog sheets. For information about embedded charts, see the Chart or ChartObject topics.

Example

Use the Charts property to return the Charts collection. The following example prints all chart sheets in the active workbook.

VBA Copy code Copy code
Charts.PrintOut

Use the Add method to create a new chart sheet and add it to the workbook. The following example adds a new chart sheet to the active workbook and places the new chart sheet immediately after the worksheet named Sheet1.

VBA Copy code Copy code
Charts.Add After:=Worksheets("Sheet1")

You can combine the Add method with the ChartWizard method to add a new chart that contains data from a worksheet. The following example adds a new line chart based on data in cells A1:A20 on the worksheet named Sheet1.

VBA Copy code Copy code
With Charts.Add
 .ChartWizard source:=Worksheets("Sheet1").Range("A1:A20"), _
 Gallery:=xlLine, Title:="February Data"
End With

Use Charts(index), where index is the chart-sheet index number or name, to return a single Chart object. The following example changes the color of series 1 on chart sheet 1 to red.

VBA Copy code Copy code
Charts(1).SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbRed

The Sheets collection contains all the sheets in the workbook (both chart sheets and worksheets). Use Sheets(index), where index is the sheet name or number, to return a single sheet.

See also

Concepts

Excel Object Model Reference

Other resources

Charts Object Members


Charts Members (Excel)

 Copy code hover
[image]

Charts Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the chart sheets in the specified or active workbook.

Methods

Name | Description
Add2 | Inserts a chart directly onto the grid.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
Move | Moves the chart to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the chart. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Charts Properties (Excel)

 Copy code hover
[image]

Charts Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the chart. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Charts.Application Property (Excel)

 Copy code hover
[image]

Charts.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Charts object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Count Property (Excel)

 Copy code hover
[image]

Charts.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Creator Property (Excel)

 Copy code hover
[image]

Charts.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Charts object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.HPageBreaks Property (Excel)

 Copy code hover
[image]

Charts.HPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an HPageBreaks collection that represents the horizontal page breaks on the chart. Read-only.

Syntax

expression .HPageBreaks

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Item Property (Excel)

 Copy code hover
[image]

Charts.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With Charts.Item("Chart1").SeriesCollection(1).Trendlines(1)
 .Forward = 5
 .Backward = .5
End With

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Parent Property (Excel)

 Copy code hover
[image]

Charts.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Visible Property (Excel)

 Copy code hover
[image]

Charts.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that determines whether the object is visible.

Syntax

expression .Visible

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.VPageBreaks Property (Excel)

 Copy code hover
[image]

Charts.VPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.

Syntax

expression .VPageBreaks

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts Methods (Excel)

 Copy code hover
[image]

Charts Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add2 | Inserts a chart directly onto the grid.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
Move | Moves the chart to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.


Charts.Add2 Method (Excel)

 Copy code hover
[image]

Charts.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Inserts a chart directly onto the grid.

Version information

Version Added: Excel 2013

Syntax

expression .Add2(Before,After,Count,NewLayout)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data type | Description
Before | Optional | VARIANT | An object that specifies the sheet before which the new sheet is added.
After | Optional | VARIANT | An object that specifies the sheet after which the new sheet is added.
Count | Optional | VARIANT | The number of sheets to be added. The default value is one.
NewLayout | Optional | VARIANT | If NewLayout is True, the chart is inserted by using the new dynamic formatting rules (Title is on, and Legend is on only if there are multiple series).

Return value

CHART

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Copy Method (Excel)

 Copy code hover
[image]

Charts.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the sheet to another location in the workbook.

Syntax

expression .Copy(Before, After)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the copied sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the copied sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.

Example

This example copies Sheet1, placing the copy after Sheet3.

VBA Copy code Copy code
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Delete Method (Excel)

 Copy code hover
[image]

Charts.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Charts object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Move Method (Excel)

 Copy code hover
[image]

Charts.Move Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the chart to another location in the workbook.

Syntax

expression .Move(Before, After)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the moved chart will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the moved chart will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the moved chart.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.PrintOut Method (Excel)

 Copy code hover
[image]

Charts.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.
IgnorePrintAreas | Optional | Variant | True to ignore print areas and print the entire object.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.PrintPreview Method (Excel)

 Copy code hover
[image]

Charts.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Charts Collection

Other resources

Charts Object Members


Charts.Select Method (Excel)

 Copy code hover
[image]

Charts.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Charts object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

See also

Concepts

Charts Collection

Other resources

Charts Object Members


ChartTitle Object (Excel)

 Copy code hover
[image]

ChartTitle Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the chart title.

Remarks

Use the ChartTitle property to return the ChartTitle object.

The ChartTitle object doesn't exist and cannot be used unless the HasTitle property for the chart is True.

Example

The following example adds a title to embedded chart one on the worksheet named "Sheet1."

VBA Copy code Copy code
With Worksheets("sheet1").ChartObjects(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "February Sales"
End With

See also

Concepts

Excel Object Model Reference

Other resources

ChartTitle Object Members


ChartTitle Members (Excel)

 Copy code hover
[image]

ChartTitle Members (Excel)
Send feedback

Represents the chart title.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the chart title text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IncludeInLayout | True if a chart title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


ChartTitle Properties (Excel)

 Copy code hover
[image]

ChartTitle Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the chart title text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
IncludeInLayout | True if a chart title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


ChartTitle.Application Property (Excel)

 Copy code hover
[image]

ChartTitle.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ChartTitle object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Caption Property (Excel)

 Copy code hover
[image]

ChartTitle.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the chart title text.

Syntax

expression .Caption

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Characters Property (Excel)

 Copy code hover
[image]

ChartTitle.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Syntax

expression .Characters(Start, Length)

expression A variable that represents a ChartTitle object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The Characters object isn't a collection.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Creator Property (Excel)

 Copy code hover
[image]

ChartTitle.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartTitle object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Format Property (Excel)

 Copy code hover
[image]

ChartTitle.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a ChartTitle object.

Remarks

The ChartFormat object contains the line, fill, effect, and text formatting for the chart area.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Formula Property (Excel)

 Copy code hover
[image]

ChartTitle.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Formula

expression A variable that represents a ChartTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaLocal Property (Excel)

 Copy code hover
[image]

ChartTitle.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaLocal

expression A variable that represents a ChartTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

ChartTitle.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a ChartTitle object.

Return Value

String

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

ChartTitle.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a ChartTitle object.

Return Value

String

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Height Property (Excel)

 Copy code hover
[image]

ChartTitle.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a ChartTitle object.

Return Value

Double

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

ChartTitle.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a ChartTitle object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.IncludeInLayout Property (Excel)

 Copy code hover
[image]

ChartTitle.IncludeInLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a chart title will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IncludeInLayout

expression A variable that represents a ChartTitle object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title using the Above Chart command, the chart will resize smaller. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Left Property (Excel)

 Copy code hover
[image]

ChartTitle.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Name Property (Excel)

 Copy code hover
[image]

ChartTitle.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Orientation Property (Excel)

 Copy code hover
[image]

ChartTitle.Orientation Property (Excel)
See also Send feedback

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a ChartTitle object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Parent Property (Excel)

 Copy code hover
[image]

ChartTitle.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Position Property (Excel)

 Copy code hover
[image]

ChartTitle.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.ReadingOrder Property (Excel)

 Copy code hover
[image]

ChartTitle.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Shadow Property (Excel)

 Copy code hover
[image]

ChartTitle.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a ChartTitle object.

Example

This example adds a shadow to the title of myChart.

VBA Copy code Copy code
Charts("Chart1").ChartTitle.Shadow = True

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Text Property (Excel)

 Copy code hover
[image]

ChartTitle.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a ChartTitle object.

Example

This example sets the text for the chart title of Chart1.

VBA Copy code Copy code
With Charts("Chart1")
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Top Property (Excel)

 Copy code hover
[image]

ChartTitle.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.VerticalAlignment Property (Excel)

 Copy code hover
[image]

ChartTitle.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a ChartTitle object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Width Property (Excel)

 Copy code hover
[image]

ChartTitle.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a ChartTitle object.

Return Value

Double

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle Methods (Excel)

 Copy code hover
[image]

ChartTitle Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


ChartTitle.Delete Method (Excel)

 Copy code hover
[image]

ChartTitle.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a ChartTitle object.

Return Value

Variant

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Select Method (Excel)

 Copy code hover
[image]

ChartTitle.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a ChartTitle object.

Return Value

Variant

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartView Object (Excel)

 Copy code hover
[image]

ChartView Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a view of a chart.

Version Information

Version Added: Excel 2007

Remarks

The ChartView object is one of the objects that can be returned by the SheetViews collection, similar to the Sheets collection. The ChartView object applies only to chart sheets.

Example

The following example returns a ChartView object.

VBA Copy code Copy code
ActiveWindow.SheetViews.Item(1)

The following example returns a Chart object.

VBA Copy code Copy code
ActiveWindow.SheetViews.Item(1).Sheet

See also

Concepts

Excel Object Model Reference

Other resources

ChartView Object Members


ChartView Members (Excel)

 Copy code hover
[image]

ChartView Members (Excel)
Send feedback

Published: July 16, 2012

Represents a view of a chart.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified ChartView object. Read-only.


ChartView Properties (Excel)

 Copy code hover
[image]

ChartView Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified ChartView object. Read-only.


ChartView.Application Property (Excel)

 Copy code hover
[image]

ChartView.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ChartView object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

ChartView Object

Other resources

ChartView Object Members


ChartView.Creator Property (Excel)

 Copy code hover
[image]

ChartView.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ChartView object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ChartView Object

Other resources

ChartView Object Members


ChartView.Parent Property (Excel)

 Copy code hover
[image]

ChartView.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ChartView object.

See also

Concepts

ChartView Object

Other resources

ChartView Object Members


ChartView.Sheet Property (Excel)

 Copy code hover
[image]

ChartView.Sheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sheet name for the specified ChartView object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Sheet

expression A variable that represents a ChartView object.

See also

Concepts

ChartView Object

Other resources

ChartView Object Members


ColorFormat Object (Excel)

 Copy code hover
[image]

ColorFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the color of a one-color object, the foreground or background color of an object with a gradient or patterned fill, or the pointer color.

Remarks

You can set colors to an explicit red-green-blue value (by using the RGB property) or to a color in the color scheme (by using the SchemeColor property).

Use one of the properties listed in the following table to return a ColorFormat object.

Use this property | With this object | To return a ColorFormat object that represents this
BackColor | FillFormat | The background fill color (used in a shaded or patterned fill)
ForeColor | FillFormat | The foreground fill color (or simply the fill color for a solid fill)
BackColor | LineFormat | The background line color (used in a patterned line)
ForeColor | LineFormat | The foreground line color (or just the line color for a solid line)
ForeColor | ShadowFormat | The shadow color
ExtrusionColor | ThreeDFormat | The color of the sides of an extruded object

Example

Use the RGB property to set a color to an explicit red-green-blue value. The following example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

Excel Object Model Reference

Other resources

ColorFormat Object Members


ColorFormat Members (Excel)

 Copy code hover
[image]

ColorFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents the color of a one-color object, the foreground or background color of an object with a gradient or patterned fill, or the pointer color.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the luminosity of the specified object. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ObjectThemeColor | Returns or sets a color that is mapped to the theme color scheme. Read/write MsoThemeColorIndex.
Parent | Returns the parent object for the specified object. Read-only.
RGB | Returns or sets a Long value that represents the red-green-blue value of the specified color.
SchemeColor | Returns or sets an Integer value that represents the color of a Color object, as an index in the current color.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Type | Returns a MsoColorType value that represents the color format type.


ColorFormat Properties (Excel)

 Copy code hover
[image]

ColorFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the luminosity of the specified object. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ObjectThemeColor | Returns or sets a color that is mapped to the theme color scheme. Read/write MsoThemeColorIndex.
Parent | Returns the parent object for the specified object. Read-only.
RGB | Returns or sets a Long value that represents the red-green-blue value of the specified color.
SchemeColor | Returns or sets an Integer value that represents the color of a Color object, as an index in the current color.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Type | Returns a MsoColorType value that represents the color format type.


ColorFormat.Application Property (Excel)

 Copy code hover
[image]

ColorFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ColorFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Brightness Property (Excel)

 Copy code hover
[image]

ColorFormat.Brightness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the luminosity of the specified object. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Brightness

expression A variable that represents a ColorFormat object.

Return Value

Single

Remarks

The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest).

Example

The following code example sets the brightness of the fill color for the first shape in the active worksheet.

VBA Copy code Copy code
ActiveSheet.Shapes(1).Fill.ForeColor.Brightness = 0.5

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Creator Property (Excel)

 Copy code hover
[image]

ColorFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ColorFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.ObjectThemeColor Property (Excel)

 Copy code hover
[image]

ColorFormat.ObjectThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a color that is mapped to the theme color scheme. Read/write MsoThemeColorIndex.

Version Information

Version Added: Excel 2007

Syntax

expression .ObjectThemeColor

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Parent Property (Excel)

 Copy code hover
[image]

ColorFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.RGB Property (Excel)

 Copy code hover
[image]

ColorFormat.RGB Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the red-green-blue value of the specified color.

Syntax

expression .RGB

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.SchemeColor Property (Excel)

 Copy code hover
[image]

ColorFormat.SchemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer value that represents the color of a Color object, as an index in the current color.

Syntax

expression .SchemeColor

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.TintAndShade Property (Excel)

 Copy code hover
[image]

ColorFormat.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens a color.

Syntax

expression .TintAndShade

expression A variable that represents a ColorFormat object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1 results in a run-time error: "The specified value is out of range." This property works for both theme colors and nontheme colors.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Type Property (Excel)

 Copy code hover
[image]

ColorFormat.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a MsoColorType value that represents the color format type.

Syntax

expression .Type

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorScale Object (Excel)

 Copy code hover
[image]

ColorScale Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a color scale conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create a color scale formatting rule by using either the Add or AddColorScale method of the FormatConditions collection.

Color scales are visual guides that help you understand data distribution and variation. You can apply either a two-color or a three-color scale to a range of data, data in a table, or data in a PivotTable report. For a two-color scale conditional format, you assign the value, type, and color to the minimum and maximum thresholds of a range. A three-color scale also has a midpoint threshold.

Each of these thresholds is determined by setting the properties of the ColorScaleCriteria object. The ColorScaleCriteria object, which is a child of the ColorScale object, is a collection of all of the ColorScaleCriterion objects for the color scale.

Example

The following code example creates a range of numbers and then applies a two-color scale conditional formatting rule to that range. The color for the minimum threshold is then assigned to red and the maximum threshold to blue.

VBA Copy code Copy code
Sub CreateColorScaleCF()

 Dim cfColorScale As ColorScale

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 1
 .Range("C2") = 2
 .Range("C1:C2").AutoFill Destination:=Range("C1:C10")
 End With

 Range("C1:C10").Select

 'Create a two-color ColorScale object for the created sample data range
 Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=2)

 'Set the minimum threshold to red and maximum threshold to blue
 cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(255, 0, 0)
 cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(0, 0, 255)

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ColorScale Object Members


ColorScale Members (Excel)

 Copy code hover
[image]

ColorScale Members (Excel)
Send feedback

Published: July 16, 2012

Represents a color scale conditional formatting rule.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
ColorScaleCriteria | Returns a ColorScaleCriteria object, which is a collection of individual ColorScaleCriterion objects. The ColorScaleCriterion object specifies the type, value, and color of threshold criteria used in the color scale conditional format. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String representing a formula that determines the values to which the icon set will be applied.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


ColorScale Properties (Excel)

 Copy code hover
[image]

ColorScale Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
ColorScaleCriteria | Returns a ColorScaleCriteria object, which is a collection of individual ColorScaleCriterion objects. The ColorScaleCriterion object specifies the type, value, and color of threshold criteria used in the color scale conditional format. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String representing a formula that determines the values to which the icon set will be applied.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


ColorScale.Application Property (Excel)

 Copy code hover
[image]

ColorScale.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ColorScale object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.AppliesTo Property (Excel)

 Copy code hover
[image]

ColorScale.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents a ColorScale object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.ColorScaleCriteria Property (Excel)

 Copy code hover
[image]

ColorScale.ColorScaleCriteria Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ColorScaleCriteria object, which is a collection of individual ColorScaleCriterion objects. The ColorScaleCriterion object specifies the type, value, and color of threshold criteria used in the color scale conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ColorScaleCriteria

expression A variable that represents a ColorScale object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.Creator Property (Excel)

 Copy code hover
[image]

ColorScale.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ColorScale object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.Formula Property (Excel)

 Copy code hover
[image]

ColorScale.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String representing a formula that determines the values to which the icon set will be applied.

Version Information

Version Added: Excel 2007

Syntax

expression .Formula

expression A variable that represents a ColorScale object.

Remarks

This property is useful to limit the range of values that will display the conditional format. A typical scenario is when you have a range of numbers containing both positive and negative values. You may want to create more than one conditional format for this range of numbers—one for positive values and another for negative values.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.Parent Property (Excel)

 Copy code hover
[image]

ColorScale.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ColorScale object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.Priority Property (Excel)

 Copy code hover
[image]

ColorScale.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a ColorScale object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.PTCondition Property (Excel)

 Copy code hover
[image]

ColorScale.PTCondition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents a ColorScale object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.ScopeType Property (Excel)

 Copy code hover
[image]

ColorScale.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents a ColorScale object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.StopIfTrue Property (Excel)

 Copy code hover
[image]

ColorScale.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents a ColorScale object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.Type Property (Excel)

 Copy code hover
[image]

ColorScale.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a ColorScale object.

Remarks

This property will always return a Long value of "3", which is equivalent to xlColorScale.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale Methods (Excel)

 Copy code hover
[image]

ColorScale Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


ColorScale.Delete Method (Excel)

 Copy code hover
[image]

ColorScale.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a ColorScale object.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

ColorScale.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents a ColorScale object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.SetFirstPriority Method (Excel)

 Copy code hover
[image]

ColorScale.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents a ColorScale object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScale.SetLastPriority Method (Excel)

 Copy code hover
[image]

ColorScale.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents a ColorScale object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

ColorScale Object

Other resources

ColorScale Object Members


ColorScaleCriteria Object (Excel)

 Copy code hover
[image]

ColorScaleCriteria Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ColorScaleCriterion objects that represents all of the criteria for a color scale conditional format. Each criterion specifies the minimum, midpoint, or maximum threshold for the color scale.

Version Information

Version Added: Excel 2007

Remarks

To return the ColorScaleCriteria collection, use the ColorScaleCriteria property of the ColorScale object.

Example

The following code example creates a range of numbers and then applies a two-color scale conditional formatting rule to that range. The color for the minimum threshold is then assigned to red and the maximum threshold to blue by indexing into the ColorScaleCriteria collection to set individual criteria.

VBA Copy code Copy code
Sub CreateColorScaleCF()

 Dim cfColorScale As ColorScale

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 1
 .Range("C2") = 2
 .Range("C1:C2").AutoFill Destination:=Range("C1:C10")
 End With

 Range("C1:C10").Select

 'Create a two-color ColorScale object for the created sample data range
 Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=2)

 'Set the minimum threshold to red and maximum threshold to blue
 cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(255, 0, 0)
 cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(0, 0, 255)

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ColorScaleCriteria Object Members


ColorScaleCriteria Members (Excel)

 Copy code hover
[image]

ColorScaleCriteria Members (Excel)
Send feedback

Published: July 16, 2012

A collection of ColorScaleCriterion objects that represents all of the criteria for a color scale conditional format. Each criterion specifies the minimum, midpoint, or maximum threshold for the color scale.

Properties

Name | Description
Count | Returns a Long value that specifies the number of criteria for a color scale conditional format rule. Read-only.
Item | Returns a single ColorScaleCriterion object from the ColorScaleCriteria collection. Read-only.


ColorScaleCriteria Properties (Excel)

 Copy code hover
[image]

ColorScaleCriteria Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns a Long value that specifies the number of criteria for a color scale conditional format rule. Read-only.
Item | Returns a single ColorScaleCriterion object from the ColorScaleCriteria collection. Read-only.


ColorScaleCriteria.Count Property (Excel)

 Copy code hover
[image]

ColorScaleCriteria.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that specifies the number of criteria for a color scale conditional format rule. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a ColorScaleCriteria object.

Remarks

The number of criteria is equivalent to the number of threshold values assigned for a color scale. This will be either two or three, depending on whether you use a two-color scale or three-color scale for the conditional format rule.

See also

Concepts

ColorScaleCriteria Collection

Other resources

ColorScaleCriteria Object Members


ColorScaleCriteria.Item Property (Excel)

 Copy code hover
[image]

ColorScaleCriteria.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single ColorScaleCriterion object from the ColorScaleCriteria collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a ColorScaleCriteria object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number of the ColorScaleCriterion object.

Remarks

The value of the Index parameter cannot be greater than the number of criteria set for an color scale conditional format. The criteria are equivalent to the threshold values assigned for the color scale. To find the number of threshold values, use the ColorScaleCriteria.Count property.

See also

Concepts

ColorScaleCriteria Collection

Other resources

ColorScaleCriteria Object Members


ColorScaleCriterion Object (Excel)

 Copy code hover
[image]

ColorScaleCriterion Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the criteria for the minimum, midpoint, or maximum thresholds for a color format conditional format.

Version Information

Version Added: Excel 2007

Remarks

Each ColorScaleCriterion is part of the ColorScaleCriteria collection. Use ColorScaleCriteria(index), to return an individual criterion.

You can set the Type, Value, and FormatColor of each threshold for the color scale.

Example

The following code example creates a range of numbers and then applies a two-color scale conditional formatting rule to that range. The color for the minimum threshold is then assigned to red and the maximum threshold to blue by indexing into the ColorScaleCriteria collection to set individual criteria.

VBA Copy code Copy code
Sub CreateColorScaleCF()

 Dim cfColorScale As ColorScale

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 1
 .Range("C2") = 2
 .Range("C1:C2").AutoFill Destination:=Range("C1:C10")
 End With

 Range("C1:C10").Select

 'Create a two-color ColorScale object for the created sample data range
 Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=2)

 'Set the minimum threshold to red and maximum threshold to blue
 cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(255, 0, 0)
 cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(0, 0, 255)

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ColorScaleCriterion Object Members


ColorScaleCriterion Members (Excel)

 Copy code hover
[image]

ColorScaleCriterion Members (Excel)
Send feedback

Published: July 16, 2012

Represents the criteria for the minimum, midpoint, or maximum thresholds for a color format conditional format.

Properties

Name | Description
FormatColor | Returns a FormatColor object, which specifies the color assigned to the threshold of a color scale conditional format. Read-only.
Index | Returns a Long value indicating which threshold the criteria represents. Read-only.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar or color scale conditional format are determined. Read-only.
Value | Returns or sets the minimum, midpoint, or maximum threshold value for a color scale conditional format. Read/write Variant.


ColorScaleCriterion Properties (Excel)

 Copy code hover
[image]

ColorScaleCriterion Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
FormatColor | Returns a FormatColor object, which specifies the color assigned to the threshold of a color scale conditional format. Read-only.
Index | Returns a Long value indicating which threshold the criteria represents. Read-only.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar or color scale conditional format are determined. Read-only.
Value | Returns or sets the minimum, midpoint, or maximum threshold value for a color scale conditional format. Read/write Variant.


ColorScaleCriterion.FormatColor Property (Excel)

 Copy code hover
[image]

ColorScaleCriterion.FormatColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FormatColor object, which specifies the color assigned to the threshold of a color scale conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .FormatColor

expression A variable that represents a ColorScaleCriterion object.

Remarks

You can set the color of the minimum, midpoint, or maximum thresholds to any custom color by using the Color property; or use the ThemeColor property.

See also

Concepts

ColorScaleCriterion Object

Other resources

ColorScaleCriterion Object Members


ColorScaleCriterion.Index Property (Excel)

 Copy code hover
[image]

ColorScaleCriterion.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value indicating which threshold the criteria represents. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Index

expression A variable that represents a ColorScaleCriterion object.

Remarks

For a two-color scale conditional format rule, this property will return a value of "1" for the minimum threshold and "2" for the maximum threshold. When using a three-color scale rule, the values will be "1" for the minimum, "2" for the midpoint, and "3" for the maximum thresholds.

See also

Concepts

ColorScaleCriterion Object

Other resources

ColorScaleCriterion Object Members


ColorScaleCriterion.Type Property (Excel)

 Copy code hover
[image]

ColorScaleCriterion.Type Property (Excel)
See also Send feedback

Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar or color scale conditional format are determined. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a ColorScaleCriterion object.

Remarks

The type of threshold value for a data bar or color scale can be a number, percent, formula, or percentile. Setting the type to percentile will use the Percentile function in Microsoft Excel to determine the threshold value.

See also

Concepts

ColorScaleCriterion Object

Other resources

ColorScaleCriterion Object Members


ColorScaleCriterion.Value Property (Excel)

 Copy code hover
[image]

ColorScaleCriterion.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum, midpoint, or maximum threshold value for a color scale conditional format. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Value

expression A variable that represents a ColorScaleCriterion object.

Remarks

You can set the value only if the ColorScaleCriterion.Type property for the conditional format is set to one of the following constants: xlConditionValueNumber, xlConditionValuePercent, xlConditionValuePercentile, or xlConditionValueFormula.

If the type of threshold is a formula, you can set the formula as a String. The formula must return a single number.

See also

Concepts

ColorScaleCriterion Object

Other resources

ColorScaleCriterion Object Members


ColorStop Object (Excel)

 Copy code hover
[image]

ColorStop Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the color stop point for a gradient fill in a range or selection.

Version Information

Version Added: Excel 2007

Remarks

The ColorStop object enables you to set properties for the cell fill including the Color, ThemeColor, and TintAndShade properties.

Example

The following example shows how to apply properties to a ColorStop object.

.

VBA Copy code Copy code
With Selection.Interior
 .Pattern = xlPatternLinearGradient
 .Gradient.Degree = 135
 .Gradient.ColorStops.Clear
End With

With Selection.Interior.Gradient.ColorStops.Add(0)
 .ThemeColor = xlThemeColorDark1
 .TintAndShade = 0
End With

With Selection.Interior.Gradient.ColorStops.Add(0.5)
 .ThemeColor = xlThemeColorAccent1
 .TintAndShade = 0
End With

With Selection.Interior.Gradient.ColorStops.Add(1)
 .ThemeColor = xlThemeColorDark1
 .TintAndShade = 0
End With

See also

Concepts

Excel Object Model Reference

Other resources

ColorStop Object Members


ColorStop Members (Excel)

 Copy code hover
[image]

ColorStop Members (Excel)
Send feedback

Published: July 16, 2012

Represents the color stop point for a gradient fill in a range or selection.

Methods

Name | Description
Delete | Deletes the represented object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the color of the represented object. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only
Position | Returns or sets the position of the ColorStop. Read/write
ThemeColor | Returns or sets the theme color of the represented object. Read/write
TintAndShade | Returns or sets the tint and shade of the represented object. Read/write


ColorStop Properties (Excel)

 Copy code hover
[image]

ColorStop Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the color of the represented object. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only
Position | Returns or sets the position of the ColorStop. Read/write
ThemeColor | Returns or sets the theme color of the represented object. Read/write
TintAndShade | Returns or sets the tint and shade of the represented object. Read/write


ColorStop.Application Property (Excel)

 Copy code hover
[image]

ColorStop.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ColorStop object.

Return Value

Application

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.Color Property (Excel)

 Copy code hover
[image]

ColorStop.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the represented object. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .Color

expression A variable that represents a ColorStop object.

Return Value

Variant

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.Creator Property (Excel)

 Copy code hover
[image]

ColorStop.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a ColorStop object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.Parent Property (Excel)

 Copy code hover
[image]

ColorStop.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ColorStop object.

Return Value

Object

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.Position Property (Excel)

 Copy code hover
[image]

ColorStop.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the ColorStop. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents a ColorStop object.

Return Value

Double

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.ThemeColor Property (Excel)

 Copy code hover
[image]

ColorStop.ThemeColor Property (Excel)
See also Send feedback

Returns or sets the theme color of the represented object. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a ColorStop object.

Return Value

Long

Example

Applies theme color to the active selection.

VBA Copy code Copy code
Range("A1:A10").Select
With Selection.Interior.Gradient.ColorStop.Add(1)
 .ThemeColor = xlThemeColorAccent1
 .TintAndShade = 0
End With

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop.TintAndShade Property (Excel)

 Copy code hover
[image]

ColorStop.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the tint and shade of the represented object. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a ColorStop object.

Return Value

Variant

Example

Applies tint and shade to the active selection.

VBA Copy code Copy code
Range("A1:A10").Select
With Selection.Interior.Gradient.ColorStop.Add(1)
 .ThemeColor = xlThemeColorAccent1
 .TintAndShade = 0
End With

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStop Methods (Excel)

 Copy code hover
[image]

ColorStop Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the represented object.


ColorStop.Delete Method (Excel)

 Copy code hover
[image]

ColorStop.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the represented object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a ColorStop object.

Return Value

Nothing

See also

Concepts

ColorStop Object

Other resources

ColorStop Object Members


ColorStops Object (Excel)

 Copy code hover
[image]

ColorStops Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the ColorStop objects for the specified series.

Version Information

Version Added: Excel 2007

Remarks

Each ColorStop Object represents a color stop for gradient fill in a range or selection.

Example

The following example shows the ColorStops with LinearGradients.

VBA Copy code Copy code
With Selection.Interior
 .Pattern = xlPatternLinearGradient
 .Gradient.Degree = 90
 .Gradient.ColorStops.Clear
End With

 'adds stops after any have been cleared
With Selection.Interior.Gradient.ColorStops.Add(0)
 .ThemeColor = xlThemeColorDark1
 .TintAndShade = 0
End With

With Selection.Interior.Gradient.ColorStops.Add(1)
 .ThemeColor = xlThemeColorAccent1
 .TintAndShade = 0
End With

The following example shows the ColorStops with RectangularGradients.

VBA Copy code Copy code
With Selection.Interior
 .Pattern = xlPatternRectangularGradient
 .Gradient.RectangleLeft = 0
 .Gradient.RectangleRight = 0
 .Gradient.RectangleTop = 0
 .Gradient.RectangleBottom = 0
 .Gradient.ColorStops.Clear
End With

With Selection.Interior.Gradient.ColorStops.Add(0)
 .Color = 192
 .TintAndShade = 0
End With

With Selection.Interior.Gradient.ColorStops.Add(1)
 .ThemeColor = xlThemeColorLight1
 .TintAndShade = 0
End With

See also

Concepts

Excel Object Model Reference

Other resources

ColorStops Object Members


ColorStops Members (Excel)

 Copy code hover
[image]

ColorStops Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ColorStop objects for the specified series.

Methods

Name | Description
Add | Adds a ColorStop object to the specified collection.
Clear | Clears the represented object.
Item | Returns a single object from the represented collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns or sets the count of the represented object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Parent | Returns the parent object for the specified object. Read-only


ColorStops Properties (Excel)

 Copy code hover
[image]

ColorStops Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns or sets the count of the represented object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Parent | Returns the parent object for the specified object. Read-only


ColorStops.Application Property (Excel)

 Copy code hover
[image]

ColorStops.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression An expression that returns a ColorStops object.

Return Value

Application

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops.Count Property (Excel)

 Copy code hover
[image]

ColorStops.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the count of the represented object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression An expression that returns a ColorStops object.

Return Value

Long

Example

Returns the number of ColorStops in the active cell.

VBA Copy code Copy code
ActiveCell.Interior.Gradient.ColorStops.Count

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops.Creator Property (Excel)

 Copy code hover
[image]

ColorStops.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression An expression that returns a ColorStops object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops.Parent Property (Excel)

 Copy code hover
[image]

ColorStops.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ColorStops object.

Return Value

Object

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops Methods (Excel)

 Copy code hover
[image]

ColorStops Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a ColorStop object to the specified collection.
Clear | Clears the represented object.
Item | Returns a single object from the represented collection.


ColorStops.Add Method (Excel)

 Copy code hover
[image]

ColorStops.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a ColorStop object to the specified collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Add(Position)

expression An expression that returns a ColorStops object.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Double | Represents the position in which to apply the ColorStop.

Return Value

ColorStop

Example

Adds a ColorStop for the active selection.

VBA Copy code Copy code
Range("A1:A10").Select
With Selection.Interior.Gradient.ColorStop.Add(1)
 .ThemeColor = xlThemeColorAccent1
 .TintAndShade = 0
End With

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops.Clear Method (Excel)

 Copy code hover
[image]

ColorStops.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the represented object.

Version Information

Version Added: Excel 2007

Syntax

expression .Clear

expression An expression that returns a ColorStops object.

Return Value

Nothing

Example

Clears the current ColorStops

VBA Copy code Copy code
Range("A1:A10").Select
With Selection.Interior
 .Pattern = xlPatternLinearGradient
 .Gradient.Degree = 90
 .Gradient.ColorStops.Clear
End With

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


ColorStops.Item Method (Excel)

 Copy code hover
[image]

ColorStops.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the represented collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression An expression that returns a ColorStops object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A ColorStops object contained by the collection.

See also

Concepts

ColorStops Object

Other resources

ColorStops Object Members


Comment Object (Excel)

 Copy code hover
[image]

Comment Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a cell comment.

Remarks

The Comment object is a member of the Comments collection.

Example

Use the Comment property to return a Comment object. The following example changes the text in the comment in cell E5.

VBA Copy code Copy code
Worksheets(1).Range("E5").Comment.Text "reviewed on " & Date

Use Comments(index), where index is the comment number, to return a single comment from the Comments collection. The following example hides comment two on worksheet one.

VBA Copy code Copy code
Worksheets(1).Comments(2).Visible = False

Use the AddComment method to add a comment to a range. The following example adds a comment to cell E5 on worksheet one.

VBA Copy code Copy code
With Worksheets(1).Range("e5").AddComment
 .Visible = False
 .Text "reviewed on " & Date
End With

See also

Concepts

Excel Object Model Reference

Other resources

Comment Object Members


Comment Members (Excel)

 Copy code hover
[image]

Comment Members (Excel)
Send feedback

Published: July 16, 2012

Represents a cell comment.

Methods

Name | Description
Delete | Deletes the object.
Next | Returns a Comment object that represents the next comment.
Previous | Returns a Comment object that represents the previous comment.
Text | Sets comment text.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Author | Returns or sets the author of the comment. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Shape | Returns a Shape object that represents the shape attached to the specified comment.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Comment Properties (Excel)

 Copy code hover
[image]

Comment Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Author | Returns or sets the author of the comment. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Shape | Returns a Shape object that represents the shape attached to the specified comment.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Comment.Application Property (Excel)

 Copy code hover
[image]

Comment.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Comment object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Author Property (Excel)

 Copy code hover
[image]

Comment.Author Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the author of the comment. Read-only String.

Syntax

expression .Author

expression A variable that represents a Comment object.

Example

This example deletes all comments added by Jean Selva on the active sheet.

VBA Copy code Copy code
For Each c in ActiveSheet.Comments
 If c.Author = "Jean Selva" Then c.Delete
Next

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Creator Property (Excel)

 Copy code hover
[image]

Comment.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Comment object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Parent Property (Excel)

 Copy code hover
[image]

Comment.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Shape Property (Excel)

 Copy code hover
[image]

Comment.Shape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the shape attached to the specified comment.

Syntax

expression .Shape

expression An expression that returns a Comment object.

Example

This example selects comment two on the active sheet.

Note Note

Ensure that the comments are not hidden. On the Review Tab, choose Comments, Show All Comments.

VBA Copy code Copy code
ActiveSheet.Comments(2).Shape.Select

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Visible Property (Excel)

 Copy code hover
[image]

Comment.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment Methods (Excel)

 Copy code hover
[image]

Comment Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Next | Returns a Comment object that represents the next comment.
Previous | Returns a Comment object that represents the previous comment.
Text | Sets comment text.


Comment.Delete Method (Excel)

 Copy code hover
[image]

Comment.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Next Method (Excel)

 Copy code hover
[image]

Comment.Next Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Comment object that represents the next comment.

Syntax

expression .Next

expression An expression that returns a Comment object.

Return Value

Comment

Remarks

This method works only on one sheet. Using this method on the last comment on a sheet returns Null (not the next comment on the next sheet).

Example

This example shows every second comment, navigating with the next method.

Note Note

Please test in a new workbook with no existing comments. To clear all comments from a workbook use Selection.SpecialCells(xlCellTypeComments).delete in the Immediate Pane.

VBA Copy code Copy code
'Sets up the comments
For xNum = 1 To 10
 Range("A" & xNum).AddComment
 Range("A" & xNum).Comment.Text Text:="Comment " & xNum
Next

MsgBox "Comments created... A1:A10"

'Deletes every second comment in the A1:A10 range
For yNum = 1 To 10 Step 2
 Range("A" & yNum).Comment.Next.Shape.Select True
 Selection.Delete
Next

MsgBox "Deleted every second comment"

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Previous Method (Excel)

 Copy code hover
[image]

Comment.Previous Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Comment object that represents the previous comment.

Syntax

expression .Previous

expression An expression that returns a Comment object.

Return Value

Comment

Remarks

This method works only on one sheet. Using this method on the first comment on a sheet returns Null (not the last comment on the previous sheet).

Example

This example deletes every second comment, navigating with the Previous method.

Note Note

Please test in a new workbook with no existing comments. To clear all comments from a workbook use Selection.SpecialCells(xlCellTypeComments).Delete in the Immediate Pane.

VBA Copy code Copy code
'Sets up the comments
For xNum = 1 To 10
 Range("A" & xNum).AddComment
 Range("A" & xNum).Comment.Text Text:="Comment " & xNum
Next

MsgBox "Comments created... A1:A10"

'Deletes every second comment in the A1:A10 range
For yNum = 10 To 1 Step -2
 Range("A" & yNum).Comment.Previous.Shape.Select True
 Selection.Delete
Next

MsgBox "Deleted every second comment"

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Text Method (Excel)

 Copy code hover
[image]

Comment.Text Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets comment text.

Syntax

expression .Text(Text, Start, Overwrite)

expression A variable that represents a Comment object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Optional | Variant | The text to be added.
Start | Optional | Variant | The character number where the added text will be placed. If this argument is omitted, any existing text in the comment is deleted.
Overwrite | Optional | Variant | True to overwrite the existing text. The default value is False (text is inserted).

Return Value

String

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comments Object (Excel)

 Copy code hover
[image]

Comments Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of cell comments.

Remarks

Each comment is represented by a Comment object.

Example

Use the Comments property to return the Comments collection. The following example hides all the comments on worksheet one.

VBA Copy code Copy code
Set cmt = Worksheets(1).Comments
For Each c In cmt
 c.Visible = False
Next

Use the AddComment method to add a comment to a range. The following example adds a comment to cell E5 on worksheet one.

VBA Copy code Copy code
With Worksheets(1).Range("e5").AddComment
 .Visible = False
 .Text "reviewed on " & Date
End With

Use Comments(index), where index is the comment number, to return a single comment from the Comments collection. The following example hides comment two on worksheet one.

VBA Copy code Copy code
Worksheets(1).Comments(2).Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

Comments Object Members


Comments Members (Excel)

 Copy code hover
[image]

Comments Members (Excel)
Send feedback

Published: July 16, 2012

A collection of cell comments.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Comments Properties (Excel)

 Copy code hover
[image]

Comments Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Comments.Application Property (Excel)

 Copy code hover
[image]

Comments.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Comments object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Comments Object

Other resources

Comments Object Members


Comments.Count Property (Excel)

 Copy code hover
[image]

Comments.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Comments object.

See also

Concepts

Comments Object

Other resources

Comments Object Members


Comments.Creator Property (Excel)

 Copy code hover
[image]

Comments.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Comments object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Comments Object

Other resources

Comments Object Members


Comments.Parent Property (Excel)

 Copy code hover
[image]

Comments.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Comments object.

See also

Concepts

Comments Object

Other resources

Comments Object Members


Comments Methods (Excel)

 Copy code hover
[image]

Comments Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


Comments.Item Method (Excel)

 Copy code hover
[image]

Comments.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Comments object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number for the object.

Return Value

A Comment object contained by the collection.

Example

This example hides comment two.

VBA Copy code Copy code
Worksheets(1).Comments.Item(2).Visible = False

See also

Concepts

Comments Object

Other resources

Comments Object Members


ConditionValue Object (Excel)

 Copy code hover
[image]

ConditionValue Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents how the shortest bar or longest bar is evaluated for a data bar conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

The ConditionValue object is returned using either the MaxPoint or MinPoint property of the Databar object.

You can change the type of evaluation from the default setting (lowest value for the shortest bar and highest value for the longest bar) by using the Modify method.

Example

The following example creates a range of data and then applies a data bar to the range. You will notice that because there is an extremely low and high value in the range, the middle values have data bars that are of similiar length. To disambiguate the middle values, the sample code uses the ConditionValue object to change how the thresholds are evaluated to percentiles.

VBA Copy code Copy code
Sub CreateDataBarCF()

 Dim cfDataBar As Databar

 'Create a range of data with a couple of extreme values
 With ActiveSheet
 .Range("D1") = 1
 .Range("D2") = 45
 .Range("D3") = 50
 .Range("D2:D3").AutoFill Destination:=Range("D2:D8")
 .Range("D9") = 500
 End With

 Range("D1:D9").Select

 'Create a data bar with default behavior
 Set cfDataBar = Selection.FormatConditions.AddDatabar
 MsgBox "Because of the extreme values, middle data bars are very similar"

 'The MinPoint and MaxPoint properties return a ConditionValue object
 'which you can use to change threshold parameters
 cfDataBar.MinPoint.Modify newtype:=xlConditionValuePercentile, _
 newvalue:=5
 cfDataBar.MaxPoint.Modify newtype:=xlConditionValuePercentile, _
 newvalue:=75

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ConditionValue Object Members


ConditionValue Members (Excel)

 Copy code hover
[image]

ConditionValue Members (Excel)
Send feedback

Published: July 16, 2012

Represents how the shortest bar or longest bar is evaluated for a data bar conditional formatting rule.

Methods

Name | Description
Modify | Modifies how the longest bar or shortest bar is evaluated for a data bar conditional formatting rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar, color scale, or icon set conditional format are determined. Read-only.
Value | Returns or sets the shortest bar or longest bar threshold value for a data bar conditional format. Read/write Variant.


ConditionValue Properties (Excel)

 Copy code hover
[image]

ConditionValue Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar, color scale, or icon set conditional format are determined. Read-only.
Value | Returns or sets the shortest bar or longest bar threshold value for a data bar conditional format. Read/write Variant.


ConditionValue.Application Property (Excel)

 Copy code hover
[image]

ConditionValue.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ConditionValue object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


ConditionValue.Creator Property (Excel)

 Copy code hover
[image]

ConditionValue.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ConditionValue object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


ConditionValue.Parent Property (Excel)

 Copy code hover
[image]

ConditionValue.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ConditionValue object.

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


ConditionValue.Type Property (Excel)

 Copy code hover
[image]

ConditionValue.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar, color scale, or icon set conditional format are determined. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a ConditionValue object.

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


ConditionValue.Value Property (Excel)

 Copy code hover
[image]

ConditionValue.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shortest bar or longest bar threshold value for a data bar conditional format. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Value

expression A variable that represents a ConditionValue object.

Remarks

You can set the value only if the ConditionValue.Type property for the conditional format is set to one of the following constants: xlConditionValueNumber, xlConditionValuePercent, xlConditionValuePercentile, or xlConditionValueFormula.

If the threshold type is a formula, you can set the formula as a String. The formula must return a single number.

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


ConditionValue Methods (Excel)

 Copy code hover
[image]

ConditionValue Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Modify | Modifies how the longest bar or shortest bar is evaluated for a data bar conditional formatting rule.


ConditionValue.Modify Method (Excel)

 Copy code hover
[image]

ConditionValue.Modify Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies how the longest bar or shortest bar is evaluated for a data bar conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .Modify(newtype, newvalue)

expression A variable that represents a ConditionValue object.

Parameters

Name | Required/Optional | Data Type | Description
newtype | Required | XlConditionValueTypes | Specifies how the shortest bar or longest bar is evaluated. The default value is xlConditionLowestValue for the shortest bar and xlConditionHighestValue for the longest bar.
newvalue | Optional | Variant | The value assigned to the shortest or longest data bar. Depending on the newtype argument, this can be a number or a formula that evaluates to a number.

Remarks

The following table describes the acceptable threshold values for each type of evaluation.

newtype argument | newvalue argument
xlConditionLowestValue | argument is ignored
xlConditionHighestValue | argument is ignored
xlConditionValueNumber | any number
xlConditionValuePercent | any number between 0 and 100
xlConditionValuePercentile | any number between 0 and 100
xlConditionValueFormula | a formula that returns a single number

See also

Concepts

ConditionValue Object

Other resources

ConditionValue Object Members


Connections Object (Excel)

 Copy code hover
[image]

Connections Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of Connection objects for the specified workbook.

Version Information

Version Added: Excel 2007

Example

The following example shows how to add a connection to a workbook from an existing file.

VBA Copy code Copy code
ActiveWorkbook.Connections.AddFromFile _
 "C:\Documents and Settings\myComputer\My Documents\My Data Sources\Northwind 2007 Customers.odc"

See also

Concepts

Excel Object Model Reference

Other resources

Connections Object Members


Connections Members (Excel)

 Copy code hover
[image]

Connections Members (Excel)
Send feedback

Published: July 16, 2012

A collection of Connection objects for the specified workbook.

Methods

Name | Description
Add2 | Adds a new connction to the workbook.
AddFromFile | Adds a connection from the specified file.
Item | This method creates a connection item.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Connections Properties (Excel)

 Copy code hover
[image]

Connections Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Connections.Application Property (Excel)

 Copy code hover
[image]

Connections.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Connections object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections.Count Property (Excel)

 Copy code hover
[image]

Connections.Count Property (Excel)
See also Send feedback

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a Connections object.

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections.Creator Property (Excel)

 Copy code hover
[image]

Connections.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Connections object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections.Parent Property (Excel)

 Copy code hover
[image]

Connections.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Connections object.

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections Methods (Excel)

 Copy code hover
[image]

Connections Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add2 | Adds a new connction to the workbook.
AddFromFile | Adds a connection from the specified file.
Item | This method creates a connection item.


Connections.Add2 Method (Excel)

 Copy code hover
[image]

Connections.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new connction to the workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .Add(Name, Description, ConnectionString, CommandText, lCmdtype), CreateModelConnection, ImportRelationships

expression A variable that represents a Connections object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Name of the connection.
Description | Required | String | Brief description about the connection.
ConnectionString | Required | Variant | The connection string.
CommandText | Required | Variant | The command text to create the connection.
lCmdtype | Optional | Variant | Command type.
CreateModelConnection | Optional | Boolean | Specifies whether to create a connection to the PowerPivot model.
ImportRelationships] | Optional | Boolean | Specifies whether to import any existing relationships.

Return Value

WorkbookConnection

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections.AddFromFile Method (Excel)

 Copy code hover
[image]

Connections.AddFromFile Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a connection from the specified file.

Version Information

Version Added: Excel 2007

Syntax

expression .AddFromFile(Filename, Filename, Filename)

expression A variable that represents a Connections object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Name of the file.
CreateModelConnection | Optional | Boolean | Specifies whether to create the connection to the model.
ImportRelationships | Optional | Boolean | Specifies whether to import the connection relationship.

Return Value

WorkbookConnection

See also

Concepts

Connections Object

Other resources

Connections Object Members


Connections.Item Method (Excel)

 Copy code hover
[image]

Connections.Item Method (Excel)
See also Send feedback

This method creates a connection item.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a Connections object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the item.

Return Value

WorkbookConnection

See also

Concepts

Connections Object

Other resources

Connections Object Members


ConnectorFormat Object (Excel)

 Copy code hover
[image]

ConnectorFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to connectors.

Remarks

A connector is a line that attaches two other shapes at points called connection sites. If you rearrange shapes that are connected, the geometry of the connector will be automatically adjusted so that the shapes remain connected.

Connection sites are generally numbered according to the rules presented in the following table.

Shape type | Connection site numbering scheme
AutoShapes, WordArt, pictures, and OLE objects | The connection sites are numbered starting at the top and proceeding counterclockwise.
Freeforms | The connection sites are the vertices, and they correspond to the vertex numbers.

Use the ConnectorFormat property to return a ConnectorFormat object. Use the BeginConnect and EndConnect methods to attach the ends of the connector to other shapes in the document. Use the RerouteConnections method to automatically find the shortest path between the two shapes connected by the connector. Use the Connector property to see whether a shape is a connector.

Note Note

You assign a size and a position when you add a connector to the Shapes collection, but the size and position are automatically adjusted when you attach the beginning and end of the connector to other shapes in the collection. Therefore, if you intend to attach a connector to other shapes, the initial size and position you specify are irrelevant. Likewise, you specify which connection sites on a shape to attach the connector to when you attach the connector, but using the RerouteConnections method after the connector is attached may change which connection sites the connector attaches to, making your original choice of connection sites irrelevant.

Example

To figure out which number corresponds to which connection site on a complex shape, you can experiment with the shape while the macro recorder is turned on and then examine the recorded code; or you can create a shape, select it, and then run the following example. This code will number each connection site and attach a connector to it.

VBA Copy code Copy code
Set mainshape = ActiveWindow.Selection.ShapeRange(1)
With mainshape
 bx = .Left + .Width + 50
 by = .Top + .Height + 50
End With
With ActiveSheet
 For j = 1 To mainshape.ConnectionSiteCount
 With .Shapes.AddConnector(msoConnectorStraight, _
 bx, by, bx + 50, by + 50)
 .ConnectorFormat.EndConnect mainshape, j
 .ConnectorFormat.Type = msoConnectorElbow
 .Line.ForeColor.RGB = RGB(255, 0, 0)
 l = .Left
 t = .Top
 End With
 With .Shapes.AddTextbox(msoTextOrientationHorizontal, _
 l, t, 36, 14)
 .Fill.Visible = False
 .Line.Visible = False
 .TextFrame.Characters.Text = j
 End With
 Next j
End With

The following example adds two rectangles to myDocument and connects them with a curved connector.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Setc c = s.AddConnector(msoConnectorCurve, 0, 0, 0, 0)
With c.ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
 c.RerouteConnections
End With

See also

Concepts

Excel Object Model Reference

Other resources

ConnectorFormat Object Members


ConnectorFormat Members (Excel)

 Copy code hover
[image]

ConnectorFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to connectors.

Methods

Name | Description
BeginConnect | Attaches the beginning of the specified connector to a specified shape. If there's already a connection between the beginning of the connector and another shape, that connection is broken. If the beginning of the connector isn't already positioned at the specified connecting site, this method moves the beginning of the connector to the connecting site and adjusts the size and position of the connector. Use the EndConnect method to attach the end of the connector to a shape.
BeginDisconnect | Detaches the beginning of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the beginning of the connector remains positioned at a connection site but is no longer connected. Use the EndDisconnect method to detach the end of the connector from a shape.
EndConnect | Attaches the end of the specified connector to a specified shape. If there's already a connection between the end of the connector and another shape, that connection is broken. If the end of the connector isn't already positioned at the specified connecting site, this method moves the end of the connector to the connecting site and adjusts the size and position of the connector. Use the BeginConnect method to attach the beginning of the connector to a shape.
EndDisconnect | Detaches the end of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the end of the connector remains positioned at a connection site but is no longer connected. Use the BeginDisconnect method to detach the beginning of the connector from a shape.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BeginConnected | True if the beginning of the specified connector is connected to a shape. Read-only MsoTriState.
BeginConnectedShape | Returns a Shape object that represents the shape that the beginning of the specified connector is attached to. Read-only.
BeginConnectionSite | Returns an integer that specifies the connection site that the beginning of a connector is connected to. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EndConnected | msoTrue if the end of the specified connector is connected to a shape. Read-only MsoTriState.
EndConnectedShape | Returns a Shape object that represents the shape that the end of the specified connector is attached to. Read-only.
EndConnectionSite | Returns an integer that specifies the connection site that the end of a connector is connected to. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a MsoConnectorType value that represents the connector format type.


ConnectorFormat Properties (Excel)

 Copy code hover
[image]

ConnectorFormat Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BeginConnected | True if the beginning of the specified connector is connected to a shape. Read-only MsoTriState.
BeginConnectedShape | Returns a Shape object that represents the shape that the beginning of the specified connector is attached to. Read-only.
BeginConnectionSite | Returns an integer that specifies the connection site that the beginning of a connector is connected to. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EndConnected | msoTrue if the end of the specified connector is connected to a shape. Read-only MsoTriState.
EndConnectedShape | Returns a Shape object that represents the shape that the end of the specified connector is attached to. Read-only.
EndConnectionSite | Returns an integer that specifies the connection site that the end of a connector is connected to. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a MsoConnectorType value that represents the connector format type.


ConnectorFormat.Application Property (Excel)

 Copy code hover
[image]

ConnectorFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ConnectorFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.BeginConnected Property (Excel)

 Copy code hover
[image]

ConnectorFormat.BeginConnected Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the beginning of the specified connector is connected to a shape. Read-only MsoTriState.

Syntax

expression .BeginConnected

expression A variable that represents a ConnectorFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue. The beginning of the specified connector is connected to a shape.

Example

If shape three on myDocument is a connector whose beginning is connected to a shape, this example stores the connection site number in the variable oldBeginConnSite, stores a reference to the connected shape in the object variable oldBeginConnShape, and then disconnects the beginning of the connector from the shape.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
    If .Connector Then
        With .ConnectorFormat
            If .BeginConnected Then
                oldBeginConnSite = .BeginConnectionSite
                Set oldBeginConnShape = .BeginConnectedShape
                .BeginDisconnect
            End If
        End With
    End If
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.BeginConnectedShape Property (Excel)

 Copy code hover
[image]

ConnectorFormat.BeginConnectedShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the shape that the beginning of the specified connector is attached to. Read-only.

Syntax

expression .BeginConnectedShape

expression A variable that represents a ConnectorFormat object.

Remarks

If the beginning of the specified connector isn't attached to a shape, this property generates an error.

Example

This example assumes that myDocument already contains two shapes attached by a connector named "Conn1To2." The code adds a rectangle and a connector to myDocument. The beginning of the new connector will be attached to the same connection site as the beginning of the connector named "Conn1To2," and the end of the new connector will be attached to connection site one on the new rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 Set r3 = .AddShape(msoShapeRectangle, 450, 190, 200, 100)
 .AddConnector(msoConnectorCurve, 0, 0, 10, 10).Name = _
 "Conn1To3"
 With .Item("Conn1To2").ConnectorFormat
 beginConnSite1 = .BeginConnectionSite
 Set beginConnShape1 = .BeginConnectedShape
 End With
 With .Item("Conn1To3").ConnectorFormat
 .BeginConnect beginConnShape1, beginConnSite1
 .EndConnect r3, 1
 End With
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.BeginConnectionSite Property (Excel)

 Copy code hover
[image]

ConnectorFormat.BeginConnectionSite Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an integer that specifies the connection site that the beginning of a connector is connected to. Read-only Long.

Syntax

expression .BeginConnectionSite

expression A variable that represents a ConnectorFormat object.

Remarks

If the beginning of the specified connector isn't attached to a shape, this property generates an error.

Example

This example assumes that myDocument already contains two shapes attached by a connector named "Conn1To2." The code adds a rectangle and a connector to myDocument. The beginning of the new connector will be attached to the same connection site as the beginning of the connector named "Conn1To2," and the end of the new connector will be attached to connection site one on the new rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 Set r3 = .AddShape(msoShapeRectangle, 450, 190, 200, 100)
 .AddConnector(msoConnectorCurve, 0, 0, 10, 10).Name = _
 "Conn1To3"
 With .Item("Conn1To2").ConnectorFormat
 beginConnSite1 = .BeginConnectionSite
 Set beginConnShape1 = .BeginConnectedShape
 End With
 With .Item("Conn1To3").ConnectorFormat
 .BeginConnect beginConnShape1, beginConnSite1
 .EndConnect r3, 1
 End With
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.Creator Property (Excel)

 Copy code hover
[image]

ConnectorFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ConnectorFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.EndConnected Property (Excel)

 Copy code hover
[image]

ConnectorFormat.EndConnected Property (Excel)
See also Send feedback

Published: July 16, 2012

msoTrue if the end of the specified connector is connected to a shape. Read-only MsoTriState.

Syntax

expression .EndConnected

expression A variable that represents a ConnectorFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse . The end of the specified connector is not connected to a shape.

msoTriStateMixed . Does not apply to this property.

msoTriStateToggle. Does not apply to this property.

msoTrue. The end of the specified connector is connected to a shape.

Example

If the end of the connector represented by shape three on myDocument is connected to a shape, this example stores the connection site number in the variable oldEndConnSite, stores a reference to the connected shape in the object variable oldEndConnShape, and then disconnects the end of the connector from the shape.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
    If .Connector Then
        With .ConnectorFormat
            If .EndConnected Then
                oldEndConnSite = .EndConnectionSite
                Set oldEndConnShape = .EndConnectedShape
                .EndDisconnect
            End If
        End With
    End If
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.EndConnectedShape Property (Excel)

 Copy code hover
[image]

ConnectorFormat.EndConnectedShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the shape that the end of the specified connector is attached to. Read-only.

Syntax

expression .EndConnectedShape

expression A variable that represents a ConnectorFormat object.

Remarks

If the end of the specified connector isn't attached to a shape, this property generates an error.

Example

This example assumes that myDocument already contains two shapes attached by a connector named "Conn1To2." The code adds a rectangle and a connector to myDocument. The end of the new connector will be attached to the same connection site as the end of the connector named "Conn1To2," and the beginning of the new connector will be attached to connection site one on the new rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 Set r3 = .AddShape(msoShapeRectangle, _
 100, 420, 200, 100)
 With .Item("Conn1To2").ConnectorFormat
 endConnSite1 = .EndConnectionSite
 Set endConnShape1 = .EndConnectedShape
 End With
 With .AddConnector(msoConnectorCurve, _
 0, 0, 10, 10).ConnectorFormat
 .BeginConnect r3, 1
 .EndConnect endConnShape1, endConnSite1
 End With
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.EndConnectionSite Property (Excel)

 Copy code hover
[image]

ConnectorFormat.EndConnectionSite Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an integer that specifies the connection site that the end of a connector is connected to. Read-only Long.

Syntax

expression .EndConnectionSite

expression A variable that represents a ConnectorFormat object.

Remarks

If the end of the specified connector isn't attached to a shape, this property generates an error.

Example

This example assumes that myDocument already contains two shapes attached by a connector named "Conn1To2." The code adds a rectangle and a connector to myDocument. The end of the new connector will be attached to the same connection site as the end of the connector named "Conn1To2," and the beginning of the new connector will be attached to connection site one on the new rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 Set r3 = .AddShape(msoShapeRectangle, _
 100, 420, 200, 100)
 With .Item("Conn1To2").ConnectorFormat
 endConnSite1 = .EndConnectionSite
 Set endConnShape1 = .EndConnectedShape
 End With
 With .AddConnector(msoConnectorCurve, _
 0, 0, 10, 10).ConnectorFormat
 .BeginConnect r3, 1
 .EndConnect endConnShape1, endConnSite1
 End With
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.Parent Property (Excel)

 Copy code hover
[image]

ConnectorFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ConnectorFormat object.

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.Type Property (Excel)

 Copy code hover
[image]

ConnectorFormat.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoConnectorType value that represents the connector format type.

Syntax

expression .Type

expression A variable that represents a ConnectorFormat object.

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat Methods (Excel)

 Copy code hover
[image]

ConnectorFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BeginConnect | Attaches the beginning of the specified connector to a specified shape. If there's already a connection between the beginning of the connector and another shape, that connection is broken. If the beginning of the connector isn't already positioned at the specified connecting site, this method moves the beginning of the connector to the connecting site and adjusts the size and position of the connector. Use the EndConnect method to attach the end of the connector to a shape.
BeginDisconnect | Detaches the beginning of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the beginning of the connector remains positioned at a connection site but is no longer connected. Use the EndDisconnect method to detach the end of the connector from a shape.
EndConnect | Attaches the end of the specified connector to a specified shape. If there's already a connection between the end of the connector and another shape, that connection is broken. If the end of the connector isn't already positioned at the specified connecting site, this method moves the end of the connector to the connecting site and adjusts the size and position of the connector. Use the BeginConnect method to attach the beginning of the connector to a shape.
EndDisconnect | Detaches the end of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the end of the connector remains positioned at a connection site but is no longer connected. Use the BeginDisconnect method to detach the beginning of the connector from a shape.


ConnectorFormat.BeginConnect Method (Excel)

 Copy code hover
[image]

ConnectorFormat.BeginConnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Attaches the beginning of the specified connector to a specified shape. If there's already a connection between the beginning of the connector and another shape, that connection is broken. If the beginning of the connector isn't already positioned at the specified connecting site, this method moves the beginning of the connector to the connecting site and adjusts the size and position of the connector. Use the EndConnect method to attach the end of the connector to a shape.

Syntax

expression .BeginConnect(ConnectedShape, ConnectionSite)

expression A variable that represents a ConnectorFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectedShape | Required | Shape | The shape to attach the beginning of the connector to. The specified Shape object must be in the same Shapes collection as the connector.
ConnectionSite | Required | Long | A connection site on the shape specified by ConnectedShape. Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

Remarks

When you attach a connector to an object, the size and position of the connector are automatically adjusted, if necessary.

Example

This example adds two rectangles to myDocument and connects them with a curved connector. Notice that the RerouteConnections method makes it irrelevant what values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Set c = s.AddConnector(msoConnectorCurve, 0, 0, 100, 100)
with c.ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
 c.RerouteConnections
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.BeginDisconnect Method (Excel)

 Copy code hover
[image]

ConnectorFormat.BeginDisconnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Detaches the beginning of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the beginning of the connector remains positioned at a connection site but is no longer connected. Use the EndDisconnect method to detach the end of the connector from a shape.

Syntax

expression .BeginDisconnect

expression A variable that represents a ConnectorFormat object.

Example

This example adds two rectangles to myDocument, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Set c = s.AddConnector(msoConnectorCurve, 0, 0, 0, 0)
With c.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
 c.RerouteConnections
 .BeginDisconnect
 .EndDisconnect
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.EndConnect Method (Excel)

 Copy code hover
[image]

ConnectorFormat.EndConnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Attaches the end of the specified connector to a specified shape. If there's already a connection between the end of the connector and another shape, that connection is broken. If the end of the connector isn't already positioned at the specified connecting site, this method moves the end of the connector to the connecting site and adjusts the size and position of the connector. Use the BeginConnect method to attach the beginning of the connector to a shape.

Syntax

expression .EndConnect(ConnectedShape, ConnectionSite)

expression A variable that represents a ConnectorFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectedShape | Required | Shape | The shape to attach the end of the connector to. The specified Shape object must be in the same Shapes collection as the connector.
ConnectionSite | Required | Long | Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

Remarks

When you attach a connector to an object, the size and position of the connector are automatically adjusted, if necessary.

Example

This example adds two rectangles to myDocument and connects them with a curved connector. Notice that the RerouteConnections method makes it irrelevant what values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Set c = s.AddConnector(msoConnectorCurve, 0, 0, 100, 100)
With c.ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
 c.RerouteConnections
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ConnectorFormat.EndDisconnect Method (Excel)

 Copy code hover
[image]

ConnectorFormat.EndDisconnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Detaches the end of the specified connector from the shape it's attached to. This method doesn't alter the size or position of the connector: the end of the connector remains positioned at a connection site but is no longer connected. Use the BeginDisconnect method to detach the beginning of the connector from a shape.

Syntax

expression .EndDisconnect

expression A variable that represents a ConnectorFormat object.

Example

This example adds two rectangles to myDocument, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
set c = s.AddConnector(msoConnectorCurve, 0, 0, 0, 0)
with c.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
 c.RerouteConnections
 .BeginDisconnect
 .EndDisconnect
End With

See also

Concepts

ConnectorFormat Object

Other resources

ConnectorFormat Object Members


ControlFormat Object (Excel)

 Copy code hover
[image]

ControlFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains Microsoft Excel control properties.

Example

Use the ControlFormat property to return a ControlFormat object. The following example sets the fill range for a list box control on worksheet one.

Note Note

If the shape isn't a control, the ControlFormat property fails; and if the control isn't a list box, the ListFillRange property fails.

VBA Copy code Copy code
Worksheets(1).Shapes(1).ControlFormat.ListFillRange = "A1:A10"

See also

Concepts

Excel Object Model Reference

Other resources

ControlFormat Object Members


ControlFormat Members (Excel)

 Copy code hover
[image]

ControlFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains Microsoft Excel control properties.

Methods

Name | Description
AddItem | Adds an item to a list box or a combo box.
List | Returns or sets the text entries in the specified list box or a combo box, as an array of strings, or returns or sets a single text entry. An error occurs if there are no entries in the list.
RemoveAllItems | Removes all entries from a Microsoft Excel list box or combo box.
RemoveItem | Removes one or more items from a list box or combo box.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DropDownLines | Returns or sets the number of list lines displayed in the drop-down portion of a combo box. Read/write Long.
Enabled | True if the object is enabled. Read/write Boolean.
LargeChange | Returns or sets the amount that the scroll box increments or decrements for a page scroll (when the user clicks in the scroll bar body region). Read/write Long.
LinkedCell | Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.
ListCount | Returns the number of entries in a list box or combo box. Returns 0 (zero) if there are no entries in the list. Read-only Long.
ListFillRange | Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.
ListIndex | Returns or sets the index number of the currently selected item in a list box or combo box. Read/write Long.
LockedText | True if the text in the specified object will be locked to prevent changes when the workbook is protected. Read/write Boolean.
Max | Returns or sets the maximum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values greater than this maximum value. Read/write Long.
Min | Returns or sets the minimum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values less than this minimum value. Read/write Long.
MultiSelect | Returns or sets the selection mode of the specified list box. Can be one of the following constants: xlNone, xlSimple, or xlExtended. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
SmallChange | Returns or sets the amount that the scroll bar or spinner is incremented or decremented for a line scroll (when the user clicks an arrow). Read/write Long.
Value | Returns or sets a Long value that represents the name of specified control format.


ControlFormat Properties (Excel)

 Copy code hover
[image]

ControlFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DropDownLines | Returns or sets the number of list lines displayed in the drop-down portion of a combo box. Read/write Long.
Enabled | True if the object is enabled. Read/write Boolean.
LargeChange | Returns or sets the amount that the scroll box increments or decrements for a page scroll (when the user clicks in the scroll bar body region). Read/write Long.
LinkedCell | Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.
ListCount | Returns the number of entries in a list box or combo box. Returns 0 (zero) if there are no entries in the list. Read-only Long.
ListFillRange | Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.
ListIndex | Returns or sets the index number of the currently selected item in a list box or combo box. Read/write Long.
LockedText | True if the text in the specified object will be locked to prevent changes when the workbook is protected. Read/write Boolean.
Max | Returns or sets the maximum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values greater than this maximum value. Read/write Long.
Min | Returns or sets the minimum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values less than this minimum value. Read/write Long.
MultiSelect | Returns or sets the selection mode of the specified list box. Can be one of the following constants: xlNone, xlSimple, or xlExtended. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
SmallChange | Returns or sets the amount that the scroll bar or spinner is incremented or decremented for a line scroll (when the user clicks an arrow). Read/write Long.
Value | Returns or sets a Long value that represents the name of specified control format.


ControlFormat.Application Property (Excel)

 Copy code hover
[image]

ControlFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ControlFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Creator Property (Excel)

 Copy code hover
[image]

ControlFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ControlFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.DropDownLines Property (Excel)

 Copy code hover
[image]

ControlFormat.DropDownLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of list lines displayed in the drop-down portion of a combo box. Read/write Long.

Syntax

expression .DropDownLines

expression A variable that represents a ControlFormat object.

Example

This example creates a combo box with 10 list lines.

VBA Copy code Copy code
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
 Left:=10, Top:=10, Width:=100, Height:=10)
 .ControlFormat.DropDownLines = 10
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Enabled Property (Excel)

 Copy code hover
[image]

ControlFormat.Enabled Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object is enabled. Read/write Boolean.

Syntax

expression .Enabled

expression A variable that represents a ControlFormat object.

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.LargeChange Property (Excel)

 Copy code hover
[image]

ControlFormat.LargeChange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount that the scroll box increments or decrements for a page scroll (when the user clicks in the scroll bar body region). Read/write Long.

Syntax

expression .LargeChange

expression A variable that represents a ControlFormat object.

Example

This example creates a scroll bar and sets its linked cell, minimum, maximum, large change, and small change values.

VBA Copy code Copy code
Set sb = Worksheets(1).Shapes.AddFormControl(xlScrollBar, _
 Left:=10, Top:=10, Width:=10, Height:=200)
With sb.ControlFormat
 .LinkedCell = "D1"
 .Max = 100
 .Min = 0
 .LargeChange = 10
 .SmallChange = 2
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.LinkedCell Property (Excel)

 Copy code hover
[image]

ControlFormat.LinkedCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.

Syntax

expression .LinkedCell

expression A variable that represents a ControlFormat object.

Remarks

You cannot use this property with multiselect list boxes.

Example

This example adds a check box to worksheet one and links the check box value to cell A1.

VBA Copy code Copy code
With Worksheets(1)
 Set cb = .Shapes.AddFormControl(xlCheckBox, 10, 10, 100, 10)
 cb.ControlFormat.LinkedCell = "A1"
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.ListCount Property (Excel)

 Copy code hover
[image]

ControlFormat.ListCount Property (Excel)
See also Send feedback

Returns the number of entries in a list box or combo box. Returns 0 (zero) if there are no entries in the list. Read-only Long.

Syntax

expression .ListCount

expression A variable that represents a ControlFormat object.

Example

This example adjusts a combo box to display all entries in its list. If Shapes(1) does not represent a combo box, this example fails.

VBA Copy code Copy code
Set cf = Worksheets(1).Shapes(1).ControlFormat
cf.DropDownLines = cf.ListCount

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.ListFillRange Property (Excel)

 Copy code hover
[image]

ControlFormat.ListFillRange Property (Excel)
See also Send feedback

Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.

Syntax

expression .ListFillRange

expression A variable that represents a ControlFormat object.

Remarks

Microsoft Excel reads the contents of every cell in the range and inserts the cell values into the list box. The list tracks changes in the range's cells.

If the list in the list box was created with the AddItem method, this property returns an empty string ("").

Example

This example adds a list box to worksheet one and sets the fill range for the list box.

VBA Copy code Copy code
With Worksheets(1)
 Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
 lb.ControlFormat.ListFillRange = "A1:A10"
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.ListIndex Property (Excel)

 Copy code hover
[image]

ControlFormat.ListIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the index number of the currently selected item in a list box or combo box. Read/write Long.

Syntax

expression .ListIndex

expression A variable that represents a ControlFormat object.

Remarks

You cannot use this property with multiselect list boxes.

Example

This example removes the selected item from a list box. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Set lbcf = Worksheets(1).Shapes(2).ControlFormat
lbcf.RemoveItem lbcf.ListIndex

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.LockedText Property (Excel)

 Copy code hover
[image]

ControlFormat.LockedText Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the text in the specified object will be locked to prevent changes when the workbook is protected. Read/write Boolean.

Syntax

expression .LockedText

expression A variable that represents a ControlFormat object.

Example

This example locks text in embedded chart one when the workbook is protected.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).LockedText = True

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Max Property (Excel)

 Copy code hover
[image]

ControlFormat.Max Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values greater than this maximum value. Read/write Long.

Syntax

expression .Max

expression An expression that returns a ControlFormat object.

Return Value

Long

Remarks

The value of the Max property must be greater than the value of the Min property.

Example

This example creates a scroll bar and sets its linked cell, minimum, maximum, large change, and small change values.

VBA Copy code Copy code
Set sb = Worksheets(1).Shapes.AddFormControl(xlScrollBar, _
 Left:=10, Top:=10, Width:=10, Height:=200)
With sb.ControlFormat
 .LinkedCell = "D1"
 .Max = 100
 .Min = 0
 .LargeChange = 10
 .SmallChange = 2
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Min Property (Excel)

 Copy code hover
[image]

ControlFormat.Min Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum value of a scroll bar or spinner range. The scroll bar or spinner won't take on values less than this minimum value. Read/write Long.

Syntax

expression .Min

expression An expression that returns a ControlFormat object.

Return Value

Long

Remarks

The value of the Min property must be less than the value of the Max property.

Example

This example creates a scroll bar and sets its linked cell, minimum, maximum, large change, and small change values.

VBA Copy code Copy code
Set sb = Worksheets(1).Shapes.AddFormControl(xlScrollBar, _
 Left:=10, Top:=10, Width:=10, Height:=200)
With sb.ControlFormat
 .LinkedCell = "D1"
 .Max = 100
 .Min = 0
 .LargeChange = 10
 .SmallChange = 2
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.MultiSelect Property (Excel)

 Copy code hover
[image]

ControlFormat.MultiSelect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the selection mode of the specified list box. Can be one of the following constants: xlNone, xlSimple, or xlExtended. Read/write Long.

Syntax

expression .MultiSelect

expression A variable that represents a ControlFormat object.

Remarks

Single select (xlNone) allows only one item at a time to be selected. Clicking the mouse or pressing the SPACEBAR cancels the selection and selects the clicked item.

Simple multiselect (xlSimple) toggles the selection on an item in the list when click it with the mouse or press the SPACEBAR when the focus is on the item. This mode is appropriate for pick lists, in which there are often multiple items selected.

Extended multiselect (xlExtended) usually acts like a single-selection list box, so when you click an item, you cancel all other selections. When you hold down SHIFT while clicking the mouse or pressing an arrow key, you select items sequentially from the current item. When you hold down CTRL while clicking the mouse, you add single items to the list. This mode is appropriate when multiple items are allowed but not often used.

You can use the Value or ListIndex property to return and set the selected item in a single-select list box.

You cannot link multiselect list boxes by using the LinkedCell property.

Example

This example creates a simple multiselect list box.

VBA Copy code Copy code
Set lb = Worksheets(1).Shapes.AddFormControl(xlListBox, _
 Left:=10, Top:=10, Height:=100, Width:100)
lb.ControlFormat.MultiSelect = xlSimple

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Parent Property (Excel)

 Copy code hover
[image]

ControlFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ControlFormat object.

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.PrintObject Property (Excel)

 Copy code hover
[image]

ControlFormat.PrintObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object will be printed when the document is printed. Read/write Boolean.

Syntax

expression .PrintObject

expression A variable that represents a ControlFormat object.

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.SmallChange Property (Excel)

 Copy code hover
[image]

ControlFormat.SmallChange Property (Excel)
See also Send feedback

Returns or sets the amount that the scroll bar or spinner is incremented or decremented for a line scroll (when the user clicks an arrow). Read/write Long.

Syntax

expression .SmallChange

expression A variable that represents a ControlFormat object.

Example

This example creates a scroll bar and sets its linked cell, minimum, maximum, large change, and small change values.

VBA Copy code Copy code
Set sb = Worksheets(1).Shapes.AddFormControl(xlScrollBar, _
 Left:=10, Top:=10, Width:=10, Height:=200)
With sb.ControlFormat
 .LinkedCell = "D1"
 .Max = 100
 .Min = 0
 .LargeChange = 10
 .SmallChange = 2
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.Value Property (Excel)

 Copy code hover
[image]

ControlFormat.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the name of specified control format.

Syntax

expression .Value

expression A variable that represents a ControlFormat object.

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat Methods (Excel)

 Copy code hover
[image]

ControlFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddItem | Adds an item to a list box or a combo box.
List | Returns or sets the text entries in the specified list box or a combo box, as an array of strings, or returns or sets a single text entry. An error occurs if there are no entries in the list.
RemoveAllItems | Removes all entries from a Microsoft Excel list box or combo box.
RemoveItem | Removes one or more items from a list box or combo box.


ControlFormat.AddItem Method (Excel)

 Copy code hover
[image]

ControlFormat.AddItem Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds an item to a list box or a combo box.

Syntax

expression .AddItem(Text, Index)

expression A variable that represents a ControlFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be added.
Index | Optional | Variant | The position of the new entry. If the list has fewer entries than the specified index, blank items from the end of the list are added to the specified position. If this argument is omitted, the item is appended to the existing list.

Remarks

Using this method clears any range specified by the ListFillRange property.

Example

This example creates a list box and fills it with integers from 1 to 10.

VBA Copy code Copy code
With Worksheets(1)
 Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
 For x = 1 To 10
 lb.ControlFormat.AddItem x
 Next
End With

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.List Method (Excel)

 Copy code hover
[image]

ControlFormat.List Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text entries in the specified list box or a combo box, as an array of strings, or returns or sets a single text entry. An error occurs if there are no entries in the list.

Syntax

expression .List(Index)

expression A variable that represents a ControlFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The index number of a single text entry to be set or returned. If this argument is omitted, the entire list is returned or set as an array of strings.

Return Value

Variant

Remarks

Setting this property clears any range specified by the ListFillRange property.

Example

This example sets the entries in a list box on worksheet one. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Worksheets(1).Shapes(2).ControlFormat.List = _
 Array("cogs", "widgets", "sprockets", "gizmos")

This example sets entry four in a list box on worksheet one. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Worksheets(1).Shapes(2).ControlFormat.List(4) = "gadgets"

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.RemoveAllItems Method (Excel)

 Copy code hover
[image]

ControlFormat.RemoveAllItems Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all entries from a Microsoft Excel list box or combo box.

Syntax

expression .RemoveAllItems

expression A variable that represents a ControlFormat object.

Example

This example removes all items from a list box. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Worksheets(1).Shapes(2).ControlFormat.RemoveAllItems

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


ControlFormat.RemoveItem Method (Excel)

 Copy code hover
[image]

ControlFormat.RemoveItem Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes one or more items from a list box or combo box.

Syntax

expression .RemoveItem(Index, Count)

expression A variable that represents a ControlFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the first item to be removed. Valid values are from 1 to the number of items in the list (returned by the ListCount property).
Count | Optional | Variant | The number of items to be removed, starting at item Index. If this argument is omitted, one item is removed. If Index + Count exceeds the number of items in the list, all items from Index through the end of the list are removed without an error.

Remarks

If the specified object has a fill range defined for it, this method fails.

Use the RemoveAllItems method to remove all entries from a Microsoft Excel list box or combo box.

Example

This example removes the selected item from a list box. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Set lbcf = Worksheets(1).Shapes(2).ControlFormat
lbcf.RemoveItem lbcf.ListIndex

See also

Concepts

ControlFormat Object

Other resources

ControlFormat Object Members


CubeField Object (Excel)

 Copy code hover
[image]

CubeField Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a hierarchy or measure field from an OLAP cube. In a PivotTable report, the CubeField object is a member of the CubeFields collection.

Example

Use the CubeField property to return the CubeField object. This example creates a list of the cube field names for all the hierarchy fields in the first OLAP-based PivotTable report on Sheet1.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objPF in _
 Worksheets("Sheet1").PivotTables(1).PivotFields
 If objPF.CubeField.CubeFieldType = xlHierarchy Then
 objNewSheet.Cells(intRow, 1).Value = objPF.Name
 intRow = intRow + 1
 End If
Next objPF

Use CubeFields(index), where index is the cube field's index number, to return a single CubeField object. The following example determines the name of the second cube field in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
strAlphaName = _
 ActiveSheet.PivotTables(1).CubeFields(2).Name

See also

Concepts

Excel Object Model Reference

Other resources

CubeField Object Members


CubeField Members (Excel)

 Copy code hover
[image]

CubeField Members (Excel)
Send feedback

Published: July 16, 2012

Represents a hierarchy or measure field from an OLAP cube. In a PivotTable report, the CubeField object is a member of the CubeFields collection.

Methods

Name | Description
AddMemberPropertyField | Adds a member property field to the display for the cube field.
ClearManualFilter | The ClearManualFilter method provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList/VisibleItemsList collections in OLAP PivotTables.
CreatePivotFields | The CreatePivotFields method enables users to apply a filter to PivotFields not yet added to the PivotTable by creating the corresponding PivotField object.
Delete | Deletes the object.

Properties

Name | Description
AllItemsVisible | The AllItemsVisible property checks whether manual filtering is applied to a PivotField or CubeField. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the label text for the cube field.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeFieldSubType | Specifies the type of a CubeField. Read-only.
CubeFieldType | Indicates whether the OLAP cube field is a hierarchy field or a measure field. Can be one of the XlCubeFieldType constants.
CurrentPageName | Returns or sets the page name for a CubeField. Read/write String.
DragToColumn | True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.
DragToData | True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean
DragToHide | True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.
DragToPage | True if the field can be dragged to the page position. The default value is True. Read/write Boolean.
DragToRow | True if the field can be dragged to the row position. The default value is True. Read/write Boolean.
EnableMultiplePageItems | Set to True to allow multiple items in the page field area for OLAP PivotTables to be selected. The default value is False. Read/write Boolean.
FlattenHierarchies | Returns or sets whether items from all levels of hierarchies in a named set cube field are displayed in the same field of a PivotTable report based on an OLAP cube. Read/write
HasMemberProperties | Returns True when there are member properties specified to be displayed for the cube field. Read-only Boolean.
HierarchizeDistinct | Returns or sets whether to order and remove duplicates when displaying the specified named set in a PivotTable report based on an OLAP cube. Read/write
IncludeNewItemsInFilter | The IncludeNewItemsInFilter property is used to track included/excluded items in OLAP PivotTables. Read/write.
IsDate | Returns True if the CubeField is a date. Read-only Boolean.
LayoutForm | Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.
LayoutSubtotalLocation | Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.
Parent | Returns the parent object for the specified object. Read-only.
PivotFields | Returns the PivotFields collection. This collection contains all PivotTable fields, including those that aren't currently visible on-screen. Read-only PivotFields object.
Position | Returns or sets a Long value that represents the position of the hierarchy field on the PivotTable report when it's dragged from the field well.
ShowInFieldList | When set to True (default), a CubeField object will be shown in the field list. Read/write Boolean.
TreeviewControl | Returns the TreeviewControl object of the CubeField object, representing the cube manipulation control of an OLAP-based PivotTable report. Read-only.
Value | Returns a String value that represents the name of the specified field.


CubeField Properties (Excel)

 Copy code hover
[image]

CubeField Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllItemsVisible | The AllItemsVisible property checks whether manual filtering is applied to a PivotField or CubeField. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the label text for the cube field.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeFieldSubType | Specifies the type of a CubeField. Read-only.
CubeFieldType | Indicates whether the OLAP cube field is a hierarchy field or a measure field. Can be one of the XlCubeFieldType constants.
CurrentPageName | Returns or sets the page name for a CubeField. Read/write String.
DragToColumn | True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.
DragToData | True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean
DragToHide | True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.
DragToPage | True if the field can be dragged to the page position. The default value is True. Read/write Boolean.
DragToRow | True if the field can be dragged to the row position. The default value is True. Read/write Boolean.
EnableMultiplePageItems | Set to True to allow multiple items in the page field area for OLAP PivotTables to be selected. The default value is False. Read/write Boolean.
FlattenHierarchies | Returns or sets whether items from all levels of hierarchies in a named set cube field are displayed in the same field of a PivotTable report based on an OLAP cube. Read/write
HasMemberProperties | Returns True when there are member properties specified to be displayed for the cube field. Read-only Boolean.
HierarchizeDistinct | Returns or sets whether to order and remove duplicates when displaying the specified named set in a PivotTable report based on an OLAP cube. Read/write
IncludeNewItemsInFilter | The IncludeNewItemsInFilter property is used to track included/excluded items in OLAP PivotTables. Read/write.
IsDate | Returns True if the CubeField is a date. Read-only Boolean.
LayoutForm | Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.
LayoutSubtotalLocation | Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.
Parent | Returns the parent object for the specified object. Read-only.
PivotFields | Returns the PivotFields collection. This collection contains all PivotTable fields, including those that aren't currently visible on-screen. Read-only PivotFields object.
Position | Returns or sets a Long value that represents the position of the hierarchy field on the PivotTable report when it's dragged from the field well.
ShowInFieldList | When set to True (default), a CubeField object will be shown in the field list. Read/write Boolean.
TreeviewControl | Returns the TreeviewControl object of the CubeField object, representing the cube manipulation control of an OLAP-based PivotTable report. Read-only.
Value | Returns a String value that represents the name of the specified field.


CubeField.AllItemsVisible Property (Excel)

 Copy code hover
[image]

CubeField.AllItemsVisible Property (Excel)
See also Send feedback

Published: July 16, 2012

The AllItemsVisible property checks whether manual filtering is applied to a PivotField or CubeField. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AllItemsVisible

expression A variable that represents a CubeField object.

Remarks

Default value is True and is available for the PivotField and the CubeField objects.

For OLAP PivotTables, this property is only available for the CubeField object. Trying to get or set it on the PivotField object in OLAP PivotTables will return a run-time error.

For PivotTables, this property is available for the PivotField object.

This property is automatically set to True when no manual filtering is applied (independent of whether the IncludeNewItemsInFilter property is true or false). It is automatically set to False when any manual filtering is applied (independent of whether the IncludeNewItemsInFilter property is true or false).

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Application Property (Excel)

 Copy code hover
[image]

CubeField.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CubeField object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Caption Property (Excel)

 Copy code hover
[image]

CubeField.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the label text for the cube field.

Syntax

expression .Caption

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Creator Property (Excel)

 Copy code hover
[image]

CubeField.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CubeField object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.CubeFieldSubType Property (Excel)

 Copy code hover
[image]

CubeField.CubeFieldSubType Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the type of a CubeField. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .CubeFieldSubType

expression A variable that represents a CubeField object.

Remarks

The CubeFieldSubType can be any of the values in the following enumeration

  • xlCubeAttribute

  • xlCubeCalculatedMeasure

  • xlCubeHierarchy

  • xlCubeKPIGoal

  • xlCubeKPIStatus

  • xlCubeKPITrend

  • xlCubeKPIValue

  • xlCubeKPIWeight

  • xlCubeMeasure

  • xlCubeSet

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.CubeFieldType Property (Excel)

 Copy code hover
[image]

CubeField.CubeFieldType Property (Excel)
See also Send feedback

Published: July 16, 2012

Indicates whether the OLAP cube field is a hierarchy field or a measure field. Can be one of the XlCubeFieldType constants.

Syntax

expression .CubeFieldType

expression A variable that represents a CubeField object.

Example

This example creates a list of cube field names for the measure fields in the first OLAP-based PivotTable report on Sheet1.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objCubeFld in Worksheets("Sheet1").PivotTables(1).CubeFields
 If objCubeFld.CubeFieldType = xlMeasure Then
 objNewSheet.Cells(intRow, 1).Value = objCubeFld.Name
 intRow = intRow + 1
 End If
Next objCubeFld

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.CurrentPageName Property (Excel)

 Copy code hover
[image]

CubeField.CurrentPageName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the page name for a CubeField. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .CurrentPageName

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.DragToColumn Property (Excel)

 Copy code hover
[image]

CubeField.DragToColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.

Syntax

expression .DragToColumn

expression A variable that represents a CubeField object.

Remarks

For OLAP data sources, the value is False for measure fields.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.DragToData Property (Excel)

 Copy code hover
[image]

CubeField.DragToData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean

Syntax

expression .DragToData

expression A variable that represents a CubeField object.

Remarks

For OLAP data sources, the value is False for measure fields.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.DragToHide Property (Excel)

 Copy code hover
[image]

CubeField.DragToHide Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.

Syntax

expression .DragToHide

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.DragToPage Property (Excel)

 Copy code hover
[image]

CubeField.DragToPage Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the field can be dragged to the page position. The default value is True. Read/write Boolean.

Syntax

expression .DragToPage

expression A variable that represents a CubeField object.

Remarks

For OLAP data sources, the value is False for measure fields.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.DragToRow Property (Excel)

 Copy code hover
[image]

CubeField.DragToRow Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the field can be dragged to the row position. The default value is True. Read/write Boolean.

Syntax

expression .DragToRow

expression A variable that represents a CubeField object.

Remarks

For OLAP data sources, the value is False for measure fields.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.EnableMultiplePageItems Property (Excel)

 Copy code hover
[image]

CubeField.EnableMultiplePageItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Set to True to allow multiple items in the page field area for OLAP PivotTables to be selected. The default value is False. Read/write Boolean.

Syntax

expression .EnableMultiplePageItems

expression A variable that represents a CubeField object.

Example

This example determines if multiple page items are enabled for the cube field and notifies the user. The example assumes that an OLAP PivotTable exists on the active worksheet.

Copy code Copy code
Sub UseMultiplePageItems()

 Dim pvtTable As PivotTable
 Dim cbeField As CubeField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set cbeField = pvtTable.CubeFields("[Country]")

 ' Determine setting for mulitple page items.
 If cbeField.EnableMultiplePageItems = False Then
 MsgBox "Mulitple page items cannot be selected."
 Else
 MsgBox "Multiple page items can be selected."
 End If
End Sub

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.FlattenHierarchies Property (Excel)

 Copy code hover
[image]

CubeField.FlattenHierarchies Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether items from all levels of hierarchies in a named set cube field are displayed in the same field of a PivotTable report based on an OLAP cube. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .FlattenHierarchies

expression A variable that represents a CubeField object.

Return Value

Boolean

Remarks

True if all hierarchies of the specified named set are displayed in the same field; otherwise False.

The value of this property corresponds to the setting of the Display items from different levels in separate fields check box on the Layout & Print tab of the Field Settings dialog box for a named set in a PivotTable report that is based on an OLAP cube.

This property returns an error if the CubeFieldType property of the specified CubeField object is not xlSet.

Example

The following code example flattens the hierarchies of the specified cube field, so that all levels are displayed in the same field of the PivotTable.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").CubeFields("[Summary P&L]"). _
 FlattenHierarchies = True

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.HasMemberProperties Property (Excel)

 Copy code hover
[image]

CubeField.HasMemberProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True when there are member properties specified to be displayed for the cube field. Read-only Boolean.

Syntax

expression .HasMemberProperties

expression A variable that represents a CubeField object.

Example

The example determines if there are member properties to be displayed for the cube field and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseHasMemberProperties()

 Dim pvtTable As PivotTable
 Dim cbeField As CubeField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set cbeField = pvtTable.CubeFields("[Country]")

 ' Determine if there are member properties to be displayed.
 If cbeField.HasMemberProperties = True Then
 MsgBox "There are member properties to be displayed."
 Else
 MsgBox "There are no member properties to be displayed."
 End If

End Sub

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.HierarchizeDistinct Property (Excel)

 Copy code hover
[image]

CubeField.HierarchizeDistinct Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to order and remove duplicates when displaying the specified named set in a PivotTable report based on an OLAP cube. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .HierarchizeDistinct

expression A variable that represents a CubeField object.

Return Value

Boolean

Remarks

True if the named set is displayed as ordered with duplicates removed; otherwise False.

The value of this property corresponds to the setting of the Automatically order and remove duplicates from the set check box on the Layout & Print tab of the Field Settings dialog box for a named set in a PivotTable report based on an OLAP cube.

This property returns an error if the CubeFieldType property of the specified CubeField object is not xlSet.

Example

The following code example sets the HierarchizeDistinct property to True to order and remove duplicates from the specified named set.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").CubeFields("[Summary P&L]"). _
 HierarchizeDistinct = True

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.IncludeNewItemsInFilter Property (Excel)

 Copy code hover
[image]

CubeField.IncludeNewItemsInFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

The IncludeNewItemsInFilter property is used to track included/excluded items in OLAP PivotTables. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .IncludeNewItemsInFilter

expression A variable that represents a CubeField object.

Remarks

Default value is False.

When this setting is set to True, excluded items are tracked when manual filtering is applied. When this setting is set to False, included items are tracked when manual filtering is applied.

When IncludeNewItemsInFilter is set to False, the HiddenItemsList and HiddenItems collections are empty and items cannot be added to them.

When IncludeNewItemsInFilter is set to True, the VisibleItemsList and VisibleItems collections are empty and items cannot be added to them.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.IsDate Property (Excel)

 Copy code hover
[image]

CubeField.IsDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the CubeField is a date. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IsDate

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.LayoutForm Property (Excel)

 Copy code hover
[image]

CubeField.LayoutForm Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.

Syntax

expression .LayoutForm

expression A variable that represents a CubeField object.

Remarks

XlLayoutFormType can be one of these XlLayoutFormType constants.

xlTabular. Default.

xlOutline. The LayoutSubtotalLocation property specifies where the subtotal appears in the PivotTable report.

You can set this property for any PivotTable field; however, the formatting appears only if the specified field is a row field other than the innermost (lowest-level) row field. For non-OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or removed from the PivotTable report.

Example

This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutForm = xlOutline
 .LayoutSubtotalLocation = xlTop
End With

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.LayoutSubtotalLocation Property (Excel)

 Copy code hover
[image]

CubeField.LayoutSubtotalLocation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.

Syntax

expression .LayoutSubtotalLocation

expression A variable that represents a CubeField object.

Remarks

You can set this property for any PivotTable field in outline format; however, the formatting appears only if the specified field is a row field other than the innermost (lowest level) row field. For non- OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or from removed from the report.

The LayoutForm property determines whether the report appears in table format or in outline format.

Example

This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutForm = xlOutline
 .LayoutSubtotalLocation = xlAtTop
End With

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Name Property (Excel)

 Copy code hover
[image]

CubeField.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Orientation Property (Excel)

 Copy code hover
[image]

CubeField.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.

Syntax

expression .Orientation

expression A variable that represents a CubeField object.

Remarks

For OLAP data sources, setting this property for one field in a hierarchy sets the orientation for the other fields in the same hierarchy. Dimension fields can only be oriented in the row, column, and page field areas of the PivotTable report. Measure fields can only be oriented in the data area. Setting a hierarchy or data field to xlHidden removes the hierarchy or field from the PivotTable report.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Parent Property (Excel)

 Copy code hover
[image]

CubeField.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.PivotFields Property (Excel)

 Copy code hover
[image]

CubeField.PivotFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotFields collection. This collection contains all PivotTable fields, including those that aren't currently visible on-screen. Read-only PivotFields object.

Syntax

expression .PivotFields

expression An expression that returns a CubeField object.

Return Value

PivotFields

Remarks

For Online Analytical Processing (OLAP) data sources, there are no hidden fields, and the object or collection that's returned reflects what's currently visible.

Example

This example creates a list of all the PivotTable field names used in the first PivotChart report.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objPF In _
 Charts("Chart1").PivotLayout.PivotFields
 objNewSheet.Cells(intRow, 1).Value = objPF.Caption
 intRow = intRow + 1
Next objPF

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Position Property (Excel)

 Copy code hover
[image]

CubeField.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the position of the hierarchy field on the PivotTable report when it's dragged from the field well.

Syntax

expression .Position

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.ShowInFieldList Property (Excel)

 Copy code hover
[image]

CubeField.ShowInFieldList Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), a CubeField object will be shown in the field list. Read/write Boolean.

Syntax

expression .ShowInFieldList

expression A variable that represents a CubeField object.

Example

In this example, Microsoft Excel determines if a CubeField object can be shown in the Field list and notifies the user. This example assumes a PivotTable report exists on the active worksheet and a CubeField object exists.

VBA Copy code Copy code
Sub IsCubeFieldInList()

 Dim pvtTable As PivotTable
 Dim cbeField As CubeField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set cbeField = pvtTable.CubeFields("[Country]")

 ' Determine if a CubeField can be seen.
 If cbeField.ShowInFieldList = True Then
 MsgBox "The CubeField object can be seen in the field list."
 Else
 MsgBox "The CubeField object cannot be seen in the field list."
 End If

End Sub

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.TreeviewControl Property (Excel)

 Copy code hover
[image]

CubeField.TreeviewControl Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the TreeviewControl object of the CubeField object, representing the cube manipulation control of an OLAP-based PivotTable report. Read-only.

Syntax

expression .TreeviewControl

expression A variable that represents a CubeField object.

Remarks

This property is available only when the control is visible.

Example

This example sets the first cube field control to "drilled" for the states of California and Maryland in the second PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable2") _
 .CubeFields(1).TreeviewControl.Drilled = _
 Array(Array("", ""), _
 Array("[state].[states].[CA]", _
 "[state].[states].[MD]"))

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Value Property (Excel)

 Copy code hover
[image]

CubeField.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the specified field.

Syntax

expression .Value

expression A variable that represents a CubeField object.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField Methods (Excel)

 Copy code hover
[image]

CubeField Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddMemberPropertyField | Adds a member property field to the display for the cube field.
ClearManualFilter | The ClearManualFilter method provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList/VisibleItemsList collections in OLAP PivotTables.
CreatePivotFields | The CreatePivotFields method enables users to apply a filter to PivotFields not yet added to the PivotTable by creating the corresponding PivotField object.
Delete | Deletes the object.


CubeField.AddMemberPropertyField Method (Excel)

 Copy code hover
[image]

CubeField.AddMemberPropertyField Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a member property field to the display for the cube field.

Syntax

expression .AddMemberPropertyField(Property, PropertyOrder, PropertyDisplayedIn)

expression A variable that represents a CubeField object.

Parameters

Name | Required/Optional | Data Type | Description
Property | Required | String | The unique name of the member property. For balanced hierarchies, a unique name can be created by appending the "quoted" member property name to the unique name of the level with which the member property is associated. For unbalanced hierarchies, a unique name can be created by appending the "quoted" member property name to the unique name of the hierarchy.
PropertyOrder | Optional | Variant | Sets the PropertyOrder property value for a CubeField object. The actual position in the collection will be immediately before the PivotTable field that currently has the same PropertyOrder value that is given in the argument. If no field has the given property order value, the range of acceptable values is 1 to the number of member properties already showing for the hierarchy plus one. This argument is one-based. If omitted, the property goes to the end of the list.
PropertyDisplayedIn | Optional | XlPropertyDisplayedIn | Specifies where to display the property. If this argument is omitted, the member property field will be added to the PivotTable only.

Remarks

The property field specified will not be viewable if the PivotTable view has no fields.

To delete member properties, use the Delete method to delete the PivotField object from the PivotFields collection.

Example

In this example, Microsoft Excel adds a member property field titled "Description" to the PivotTable report view. This example assumes that a PivotTable exists on the active worksheet and that "Country", "Area", and "Description" are items in the report.

VBA Copy code Copy code
Sub UseAddMemberPropertyField()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 With pvtTable
 .ManualUpdate = True
 .CubeFields("[Country]").LayoutForm = xlOutline
 .CubeFields("[Country]").AddMemberPropertyField _
 Property:="[Country].[Area].[Description]"
 .ManualUpdate = False
 End With

End Sub

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.ClearManualFilter Method (Excel)

 Copy code hover
[image]

CubeField.ClearManualFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

The ClearManualFilter method provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList/VisibleItemsList collections in OLAP PivotTables.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearManualFilter

expression A variable that represents a CubeField object.

Remarks

This method is available for the PivotField object in PivotTables and for the CubeField object in the OLAP PivotTable. Calling it for a PivotField in an OLAP PivotTable will return a run-time error.

After calling this method, the HiddenItemsList/HiddenItems and VisibleItemsList/VisibleItems collections are empty.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.CreatePivotFields Method (Excel)

 Copy code hover
[image]

CubeField.CreatePivotFields Method (Excel)
See also Send feedback

The CreatePivotFields method enables users to apply a filter to PivotFields not yet added to the PivotTable by creating the corresponding PivotField object.

Version Information

Version Added: Excel 2007

Syntax

expression .CreatePivotFields

expression A variable that represents a CubeField object.

Remarks

In OLAP PivotTables, PivotFields do not exist until the corresponding CubeField is added to the PivotTable. The CreatePivotFields method enables users to create all PivotFields of a CubeField. Users can also add filters to the PivotFields and set properties on them before the CubeField is added to the PivotTable.

Example

Copy code Copy code
Sub FilterFieldBeforeAddingItToPivotTable()
 ActiveSheet.PivotTables("PivotTable1").CubeFields("[Date].[Fiscal]").CreatePivotFields

 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Fiscal Year]").VisibleItemsList =

 Array("[Date].[Fiscal].[Fiscal Year].&[2003]", "[Date].[Fiscal].[Fiscal Year].&[2004]", "[Date].[Fiscal].[Fiscal Year].&[2005]")

 ActiveSheet.PivotTables("PivotTable1").PivotFields( _
 "[Date].[Fiscal].[Fiscal Semester]").VisibleItemsList = Array("")

 ActiveSheet.PivotTables("PivotTable1").PivotFields( _
 "[Date].[Fiscal].[Fiscal Quarter]").VisibleItemsList = Array("")

 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Month]"). _
 VisibleItemsList = Array("")

 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Date]"). _
 VisibleItemsList = Array("")
End Sub

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeField.Delete Method (Excel)

 Copy code hover
[image]

CubeField.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a CubeField object.

Remarks

You can delete cube fields only if you have created the cube fields yourself by using the Add method with the xlCalculatedSet argument.

See also

Concepts

CubeField Object

Other resources

CubeField Object Members


CubeFields Object (Excel)

 Copy code hover
[image]

CubeFields Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all CubeField objects in a PivotTable report that is based on an OLAP cube. Each CubeField object represents a hierarchy or measure field from the cube.

Example

Use the CubeFields property to return the CubeFields collection. The following example creates a list of cube field names of the data fields in the first OLAP-based PivotTable report on Sheet1.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
intRow = 1
For Each objCubeFld In _
 Worksheets("Sheet1").PivotTables(1).CubeFields
 If objCubeFld.Orientation = xlDataField Then
 objNewSheet.Cells(intRow, 1).Value = objCubeFld.Name
 intRow = intRow + 1
 End If
Next objCubeFld

Use CubeFields(index), where index is the cube field's index number, to return a single CubeField object. The following example determines the name of the second cube field in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
strAlphaName = _
 ActiveSheet.PivotTables(1).CubeFields(2).Name

See also

Concepts

Excel Object Model Reference

Other resources

CubeFields Object Members


CubeFields Members (Excel)

 Copy code hover
[image]

CubeFields Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all CubeField objects in a PivotTable report that is based on an OLAP cube. Each CubeField object represents a hierarchy or measure field from the cube.

Methods

Name | Description
AddSet | Adds a new CubeField object to the CubeFields collection. The CubeField object corresponds to a set defined on the Online Analytical Processing (OLAP) provider for the cube.
GetMeasure | Given an attribute hierarchy, returns an implicit measure for the given function that corresponds to this attribute. If an "implicit measure" does not exist, a new implicit measure is created and added to the CubeFields Object (Excel) collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CubeFields Properties (Excel)

 Copy code hover
[image]

CubeFields Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CubeFields.Application Property (Excel)

 Copy code hover
[image]

CubeFields.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CubeFields object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields.Count Property (Excel)

 Copy code hover
[image]

CubeFields.Count Property (Excel)
See also Send feedback

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CubeFields object.

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields.Creator Property (Excel)

 Copy code hover
[image]

CubeFields.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CubeFields object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields.Item Property (Excel)

 Copy code hover
[image]

CubeFields.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CubeFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example finds the first PivotTable report whose first cube field name contains the string "Paris". The Boolean variable blnFoundName is set to True if the name is found.

VBA Copy code Copy code
blnFoundName = False
For Each objPT in ActiveSheet.PivotTables
 Set objCubeField = _
 objPT.CubeFields.Item(1)
 If instr(1,objCubeField.Name, "Paris") <> 0 Then
 blnFoundName = True
 Exit For
 End If
Next objPT

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields.Parent Property (Excel)

 Copy code hover
[image]

CubeFields.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CubeFields object.

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields Methods (Excel)

 Copy code hover
[image]

CubeFields Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddSet | Adds a new CubeField object to the CubeFields collection. The CubeField object corresponds to a set defined on the Online Analytical Processing (OLAP) provider for the cube.
GetMeasure | Given an attribute hierarchy, returns an implicit measure for the given function that corresponds to this attribute. If an "implicit measure" does not exist, a new implicit measure is created and added to the CubeFields Object (Excel) collection.


CubeFields.AddSet Method (Excel)

 Copy code hover
[image]

CubeFields.AddSet Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new CubeField object to the CubeFields collection. The CubeField object corresponds to a set defined on the Online Analytical Processing (OLAP) provider for the cube.

Syntax

expression .AddSet(Name, Caption)

expression A variable that represents a CubeFields object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | A valid name in the SETS schema rowset.
Caption | Required | String | A string representing the field that will be displayed in the PivotTable view.

Return Value

CubeField

Remarks

If a set with the name given in the argument Name does not exist, the AddSet method will return a run-time error.

Example

In this example, Microsoft Excel adds a set titled "My Set" to the CubeField object. This example assumes an OLAP PivotTable report exists on the active worksheet. Also, this example assumes a field titled "Product" exists.

VBA Copy code Copy code
Sub UseAddSet()

 Dim pvtOne As PivotTable
 Dim strAdd As String
 Dim strFormula As String
 Dim cbfOne As CubeField

 Set pvtOne = Sheet1.PivotTables(1)

 strAdd = "[MySet]"
 strFormula = "'{[Product].[All Products].[Food].children}'"

 ' Establish connection with data source if necessary.
 If Not pvtOne.PivotCache.IsConnected Then pvtOne.PivotCache.MakeConnection

 ' Add a calculated member titled "[MySet]"
 pvtOne.CalculatedMembers.Add Name:=strAdd, _
 Formula:=strFormula, Type:=xlCalculatedSet

 ' Add a set to the CubeField object.
 Set cbfOne = pvtOne.CubeFields.AddSet(Name:="[MySet]", _
 Caption:="My Set")

End Sub

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CubeFields.GetMeasure Method (Excel)

 Copy code hover
[image]

CubeFields.GetMeasure Method (Excel)
See also Send feedback

Published: July 16, 2012

Given an attribute hierarchy, returns an implicit measure for the given function that corresponds to this attribute. If an "implicit measure" does not exist, a new implicit measure is created and added to the CubeFields Object (Excel) collection.

Version information

Version Added: Excel 2013

Syntax

expression .GetMeasure(AttributeHierarchy,Function,Caption)

expression A variable that represents a CubeFields object.

Parameters

Name | Required/Optional | Data type | Description
AttributeHierarchy | Required | VARIANT | The unique cube field that is an attribute hierarchy (XlCubeFieldType = xlHierarchy and XlCubeFieldSubType = xlCubeAttribute).
Function | Required | XLCONSOLIDATIONFUNCTION | The function performed in the added data field.
Caption | Optional | VARIANT | The label used in the PivotTable report to identify this measure. If the measure already exists, caption will overwrite the existing label of this measure.

Remarks

Important note Important

Getting a measure by using the GetMeasure function will work for these functions only: Count, Sum, Average, Max and Min. For example:

These will work

  • Get CubeField0 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlCount, "NumCarsOwnedCount")

  • Set CubeField1 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlSum, "NumCarsOwnedSum")

  • Set CubeField2 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlAverage, "NumCarsOwnedAverage")

  • Set CubeField4 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlMax, "NumCarsOwnedMax")

  • Set CubeField5 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlMin, "NumCarsOwnedMin")

These will not work

  • Set CubeField3 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlCountNums, "NumCarsOwnedCountNums")

  • Set CubeField6 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlProduct, "NumCarsOwnedProduct")

  • Set CubeField7 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlStDev, "NumCarsOwnedStDev")

  • Set CubeField8 = modelPivotTable.CubeFields.GetMeasure("[customer].[num_cars_owned]", xlStDevP, "NumCarsOwnedStDevP")

Return value

CUBEFIELD

See also

Concepts

CubeFields Object

Other resources

CubeFields Object Members


CustomProperties Object (Excel)

 Copy code hover
[image]

CustomProperties Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of CustomProperty objects that represent additional information. The information can be used as metadata for XML.

Remarks

Use CustomProperties property of the Worksheet object to return a CustomProperties collection.

Once a CustomProperties collection is returned, you can add metadata to worksheets and additional actions depending on which you choose to work with.

To add metadata to a worksheet, use the CustomProperties property with the Add method.

Example

The following example demonstrates this feature. In this example, Microsoft Excel adds identifier information to the active worksheet and returns the name and value to the user.

VBA Copy code Copy code
Sub CheckCustomProperties()

 Dim wksSheet1 As Worksheet

 Set wksSheet1 = Application.ActiveSheet

 ' Add metadata to worksheet.
 wksSheet1.CustomProperties.Add _
 Name:="Market", Value:="Nasdaq"

 ' Display metadata.
 With wksSheet1.CustomProperties.Item(1)
 MsgBox .Name & vbTab & .Value
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

CustomProperties Object Members


CustomProperties Members (Excel)

 Copy code hover
[image]

CustomProperties Members (Excel)
Send feedback

A collection of CustomProperty objects that represent additional information. The information can be used as metadata for XML.

Methods

Name | Description
Add | Adds custom property information.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CustomProperties Properties (Excel)

 Copy code hover
[image]

CustomProperties Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


CustomProperties.Application Property (Excel)

 Copy code hover
[image]

CustomProperties.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CustomProperties object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperties.Count Property (Excel)

 Copy code hover
[image]

CustomProperties.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CustomProperties object.

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperties.Creator Property (Excel)

 Copy code hover
[image]

CustomProperties.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CustomProperties object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperties.Item Property (Excel)

 Copy code hover
[image]

CustomProperties.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CustomProperties object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

The following example demonstrates this feature. In this example, Microsoft Excel adds identifier information to the active worksheet and returns the name and value to the user.

VBA Copy code Copy code
Sub CheckCustomProperties()

 Dim wksSheet1 As Worksheet

 Set wksSheet1 = Application.ActiveSheet

 ' Add metadata to worksheet.
 wksSheet1.CustomProperties.Add _
 Name:="Market", Value:="Nasdaq"

 ' Display metadata.
 With wksSheet1.CustomProperties.Item(1)
 MsgBox .Name & vbTab & .Value
 End With

End Sub

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperties.Parent Property (Excel)

 Copy code hover
[image]

CustomProperties.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CustomProperties object.

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperties Methods (Excel)

 Copy code hover
[image]

CustomProperties Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds custom property information.


CustomProperties.Add Method (Excel)

 Copy code hover
[image]

CustomProperties.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds custom property information.

Syntax

expression .Add(Name, Value)

expression A variable that represents a CustomProperties object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the custom property.
Value | Required | Variant | The value of the custom property.

Return Value

A CustomProperty object that represents the custom property information.

Example

This example adds identifier information to the active worksheet and returns the name and value to the user.

VBA Copy code Copy code
Sub CheckCustomProperties()

 Dim wksSheet1 As Worksheet

 Set wksSheet1 = Application.ActiveSheet

 ' Add metadata to worksheet.
 wksSheet1.CustomProperties.Add _
 Name:="Market", Value:="Nasdaq"

 ' Display metadata.
 With wksSheet1.CustomProperties.Item(1)
 MsgBox .Name & vbTab & .Value
 End With

End Sub

See also

Concepts

CustomProperties Object

Other resources

CustomProperties Object Members


CustomProperty Object (Excel)

 Copy code hover
[image]

CustomProperty Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents identifier information. Identifier information can be used as metadata for XML.

Remarks

Use the Add method or the Item property of the CustomProperties collection to return a CustomProperty object.

Once a CustomProperty object is returned, you can add metadata to worksheets using the CustomProperties property with the Add method.

Example

In this example, Microsoft Excel adds identifier information to the active worksheet and returns the name and value to the user.

VBA Copy code Copy code
Sub CheckCustomProperties()

 Dim wksSheet1 As Worksheet

 Set wksSheet1 = Application.ActiveSheet

 ' Add metadata to worksheet.
 wksSheet1.CustomProperties.Add _
 Name:="Market", Value:="Nasdaq"

 ' Display metadata.
 With wksSheet1.CustomProperties.Item(1)
 MsgBox .Name & vbTab & .Value
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

CustomProperty Object Members


CustomProperty Members (Excel)

 Copy code hover
[image]

CustomProperty Members (Excel)
Send feedback

Published: July 16, 2012

Represents identifier information. Identifier information can be used as metadata for XML.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Value | Synonym for Borders.LineStyle.


CustomProperty Properties (Excel)

 Copy code hover
[image]

CustomProperty Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Value | Synonym for Borders.LineStyle.


CustomProperty.Application Property (Excel)

 Copy code hover
[image]

CustomProperty.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CustomProperty object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Creator Property (Excel)

 Copy code hover
[image]

CustomProperty.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CustomProperty object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Name Property (Excel)

 Copy code hover
[image]

CustomProperty.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Parent Property (Excel)

 Copy code hover
[image]

CustomProperty.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Value Property (Excel)

 Copy code hover
[image]

CustomProperty.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Synonym for Borders.LineStyle.

Syntax

expression .Value

expression A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty Methods (Excel)

 Copy code hover
[image]

CustomProperty Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


CustomProperty.Delete Method (Excel)

 Copy code hover
[image]

CustomProperty.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a CustomProperty object.

Remarks

You can delete custom document properties, but you cannot delete a built-in document property.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomView Object (Excel)

 Copy code hover
[image]

CustomView Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a custom workbook view.

Remarks

The CustomView object is a member of the CustomViews collection.

Example

Use CustomViews(index), where index is the name or index number of the custom view, to return a CustomView object. The following example shows the custom view named "Current Inventory."

VBA Copy code Copy code
ThisWorkbook.CustomViews("Current Inventory").Show

See also

Concepts

Excel Object Model Reference

Other resources

CustomView Object Members


CustomView Members (Excel)

 Copy code hover
[image]

CustomView Members (Excel)
Send feedback

Published: July 16, 2012

Represents a custom workbook view.

Methods

Name | Description
Delete | Deletes the object.
Show |

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PrintSettings | True if print settings are included in the custom view. Read-only Boolean.
RowColSettings | True if the custom view includes settings for hidden rows and columns (including filter information). Read-only Boolean.


CustomView Properties (Excel)

 Copy code hover
[image]

CustomView Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PrintSettings | True if print settings are included in the custom view. Read-only Boolean.
RowColSettings | True if the custom view includes settings for hidden rows and columns (including filter information). Read-only Boolean.


CustomView.Application Property (Excel)

 Copy code hover
[image]

CustomView.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CustomView object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.Creator Property (Excel)

 Copy code hover
[image]

CustomView.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CustomView object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.Name Property (Excel)

 Copy code hover
[image]

CustomView.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a CustomView object.

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.Parent Property (Excel)

 Copy code hover
[image]

CustomView.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CustomView object.

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.PrintSettings Property (Excel)

 Copy code hover
[image]

CustomView.PrintSettings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if print settings are included in the custom view. Read-only Boolean.

Syntax

expression .PrintSettings

expression A variable that represents a CustomView object.

Example

This example creates a list of the custom views in the active workbook and their print settings and row and column settings.

VBA Copy code Copy code
With Worksheets(1)
 .Cells(1,1).Value = "Name"
 .Cells(1,2).Value = "Print Settings"
 .Cells(1,3).Value = "RowColSettings"
 rw = 0
 For Each v In ActiveWorkbook.CustomViews
 rw = rw + 1
 .Cells(rw, 1).Value = v.Name
 .Cells(rw, 2).Value = v.PrintSettings
 .Cells(rw, 3).Value = v.RowColSettings
 Next
End With

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.RowColSettings Property (Excel)

 Copy code hover
[image]

CustomView.RowColSettings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the custom view includes settings for hidden rows and columns (including filter information). Read-only Boolean.

Syntax

expression .RowColSettings

expression A variable that represents a CustomView object.

Example

This example creates a list of the custom views in the active workbook and their print settings and row and column settings.

VBA Copy code Copy code
With Worksheets(1)
 .Cells(1,1).Value = "Name"
 .Cells(1,2).Value = "Print Settings"
 .Cells(1,3).Value = "RowColSettings"
 rw = 0
 For Each v In ActiveWorkbook.CustomViews
 rw = rw + 1
 .Cells(rw, 1).Value = v.Name
 .Cells(rw, 2).Value = v.PrintSettings
 .Cells(rw, 3).Value = v.RowColSettings
 Next
End With

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView Methods (Excel)

 Copy code hover
[image]

CustomView Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Show |


CustomView.Delete Method (Excel)

 Copy code hover
[image]

CustomView.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a CustomView object.

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomView.Show Method (Excel)

 Copy code hover
[image]

CustomView.Show Method (Excel)
See also Send feedback

Published: July 16, 2012

Syntax

expression .Show

expression A variable that represents a CustomView object.

See also

Concepts

CustomView Object

Other resources

CustomView Object Members


CustomViews Object (Excel)

 Copy code hover
[image]

CustomViews Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of custom workbook views.

Remarks

Each view is represented by a CustomView object.

Example

Use the CustomViews property to return the CustomViews collection. Use the Add method to create a new custom view and add it to the CustomViews collection. The following example creates a new custom view named "Summary."

VBA Copy code Copy code
ActiveWorkbook.CustomViews.Add "Summary", True, True

See also

Concepts

Excel Object Model Reference

Other resources

CustomViews Object Members


CustomViews Members (Excel)

 Copy code hover
[image]

CustomViews Members (Excel)
Send feedback

Published: July 16, 2012

A collection of custom workbook views.

Methods

Name | Description
Add | Creates a new custom view.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CustomViews Properties (Excel)

 Copy code hover
[image]

CustomViews Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


CustomViews.Application Property (Excel)

 Copy code hover
[image]

CustomViews.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a CustomViews object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


CustomViews.Count Property (Excel)

 Copy code hover
[image]

CustomViews.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a CustomViews object.

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


CustomViews.Creator Property (Excel)

 Copy code hover
[image]

CustomViews.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CustomViews object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


CustomViews.Parent Property (Excel)

 Copy code hover
[image]

CustomViews.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CustomViews object.

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


CustomViews Methods (Excel)

 Copy code hover
[image]

CustomViews Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new custom view.
Item | Returns a single object from a collection.


CustomViews.Add Method (Excel)

 Copy code hover
[image]

CustomViews.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new custom view.

Syntax

expression .Add(ViewName, PrintSettings, RowColSettings)

expression A variable that represents a CustomViews object.

Parameters

Name | Required/Optional | Data Type | Description
ViewName | Required | String | The name of the new view.
PrintSettings | Optional | Variant | True to include print settings in the custom view.
RowColSettings | Optional | Variant | True to include settings for hidden rows and columns (including filter information) in the custom view.

Return Value

A CustomView object that represents the new custom view.

Example

This example creates a new custom view named "Summary" in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.CustomViews.Add "Summary", True, True

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


CustomViews.Item Method (Excel)

 Copy code hover
[image]

CustomViews.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a CustomViews object.

Parameters

Name | Required/Optional | Data Type | Description
ViewName | Required | Variant | The name or index number for the object.

Return Value

A CustomView object contained by the collection.

Example

This example includes print settings in the custom view named Current Inventory.

VBA Copy code Copy code
ThisWorkbook.CustomViews.Item("Current Inventory") _
 .PrintSettings = True

See also

Concepts

CustomViews Object

Other resources

CustomViews Object Members


Databar Object (Excel)

 Copy code hover
[image]

Databar Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a data bar conditional formating rule. Applying a data bar to a range helps you see the value of a cell relative to other cells.

Version Information

Version Added: Excel 2007

Remarks

All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create a data bar formatting rule by using either the Add or AddDatabar methods of the FormatConditions collection.

You use the MinPoint and MaxPoint properties of the Databar object to set the values of the shortest bar and longest bar of a range of data. These properites return a ConditionValue object, with which you can specify how the thresholds are evaluated.

The Databar object also provides properties that enable you to specify an axis line that is displayed when negative values are present, and to specify the color and formatting of data bars.

Example

The following example creates a range of data and then applies a data bar to the range. You will notice that because there is an extremely low and high value in the range, the middle values have data bars that are of similiar length. To disambiguate the middle values, the sample code uses the ConditionValue object to change how the thresholds are evaluated to percentiles.

VBA Copy code Copy code
Sub CreateDataBarCF()

 Dim cfDataBar As Databar

 ' Create a range of data with a couple of extreme values
 With ActiveSheet
 .Range("D1") = 1
 .Range("D2") = 45
 .Range("D3") = 50
 .Range("D2:D3").AutoFill Destination:=Range("D2:D8")
 .Range("D9") = 500
 End With

 Range("D1:D9").Select

 ' Create a data bar with default behavior
 Set cfDataBar = Selection.FormatConditions.AddDatabar
 MsgBox "Because of the extreme values, middle data bars are very similar"

 ' The MinPoint and MaxPoint properties return a ConditionValue object
 ' which you can use to change threshold parameters
 cfDataBar.MinPoint.Modify newtype:=xlConditionValuePercentile, _
 newvalue:=5
 cfDataBar.MaxPoint.Modify newtype:=xlConditionValuePercentile, _
 newvalue:=75

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Databar Object Members


Databar Members (Excel)

 Copy code hover
[image]

Databar Members (Excel)
Send feedback

Published: July 16, 2012

Represents a data bar conditional formating rule. Applying a data bar to a range helps you see the value of a cell relative to other cells.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
AxisColor | Returns the color of the axis for cells with conditional formatting as data bars. Read-only
AxisPosition | Returns or sets the position of the axis of the data bars specified by a conditional formatting rule. Read/write
BarBorder | Returns an object that specifies the border of a data bar. Read-only
BarColor | Returns a FormatColor object that you can use to modify the color of the bars in a data bar conditional format.
BarFillType | Returns or sets how a data bar is filled with color. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Direction | Returns or sets the direction the databar is displayed. Read/write
Formula | Returns or sets a String representing a formula, which determines the values to which the data bar will be applied.
MaxPoint | Returns a ConditionValue object that specifies how the longest bar is evaluated for a data bar conditional format.
MinPoint | Returns a ConditionValue object that specifies how the shortest bar is evaluated for a data bar conditional format.
NegativeBarFormat | Returns the NegativeBarFormat object associated with a data bar conditional formatting rule. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PercentMax | Returns or sets a Long value that specifies the length of the longest data bar as a percentage of cell width.
PercentMin | Returns or sets a Long value that specifies the length of the shortest data bar as a percentage of cell width.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
ShowValue | Returns or sets a Boolean value that specifies if the value in the cell is displayed if the data bar conditional format is applied to the range.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


Databar Properties (Excel)

 Copy code hover
[image]

Databar Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
AxisColor | Returns the color of the axis for cells with conditional formatting as data bars. Read-only
AxisPosition | Returns or sets the position of the axis of the data bars specified by a conditional formatting rule. Read/write
BarBorder | Returns an object that specifies the border of a data bar. Read-only
BarColor | Returns a FormatColor object that you can use to modify the color of the bars in a data bar conditional format.
BarFillType | Returns or sets how a data bar is filled with color. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Direction | Returns or sets the direction the databar is displayed. Read/write
Formula | Returns or sets a String representing a formula, which determines the values to which the data bar will be applied.
MaxPoint | Returns a ConditionValue object that specifies how the longest bar is evaluated for a data bar conditional format.
MinPoint | Returns a ConditionValue object that specifies how the shortest bar is evaluated for a data bar conditional format.
NegativeBarFormat | Returns the NegativeBarFormat object associated with a data bar conditional formatting rule. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PercentMax | Returns or sets a Long value that specifies the length of the longest data bar as a percentage of cell width.
PercentMin | Returns or sets a Long value that specifies the length of the shortest data bar as a percentage of cell width.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
ShowValue | Returns or sets a Boolean value that specifies if the value in the cell is displayed if the data bar conditional format is applied to the range.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


Databar.Application Property (Excel)

 Copy code hover
[image]

Databar.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Databar object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.AppliesTo Property (Excel)

 Copy code hover
[image]

Databar.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.AxisColor Property (Excel)

 Copy code hover
[image]

Databar.AxisColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the color of the axis for cells with conditional formatting as data bars. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AxisColor

expression A variable that represents a Databar object.

Return Value

FormatColor

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.AxisPosition Property (Excel)

 Copy code hover
[image]

Databar.AxisPosition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the axis of the data bars specified by a conditional formatting rule. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AxisPosition

expression A variable that represents a Databar object.

Return Value

XlDataBarAxisPosition

Remarks

The axis for data bars is displayed only when the AxisPosition property is either xlDataBarAxisAutomatic or xlDataBarAxisMidpoint, and when there are negative values in the range of values specified with a data bar conditional formatting rule. If the conditional formatting rule is created programmatically, the default value for the AxisPosition property is xlDataBarAxisNone. If the conditional formatting rule is created using the user interface, the default value for the AxisPosition property is xlDataBarAxisAutomatic.

Example

The following code example selects a range of cells, adds data bar formatting, and then sets the axis position to display in the middle of the cells when negative values are present.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
myDataBar.AxisPosition = xlDataBarAxisMidpoint

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.BarBorder Property (Excel)

 Copy code hover
[image]

Databar.BarBorder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that specifies the border of a data bar. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .BarBorder

expression A variable that represents a Databar object.

Return Value

DataBarBorder

Example

The following code example selects a range of cells, adds a data bar conditional formatting rule to that range, uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and then sets the data bar's color, tint, and type.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
With myDataBar.BarBorder
 .Type = xlDataBarBorderSolid
 .Color.ThemeColor = xlThemeColorAccent2
 .Color.TintAndShade = 0
End With

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.BarColor Property (Excel)

 Copy code hover
[image]

Databar.BarColor Property (Excel)
See also Send feedback

Returns a FormatColor object that you can use to modify the color of the bars in a data bar conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .BarColor

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.BarFillType Property (Excel)

 Copy code hover
[image]

Databar.BarFillType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how a data bar is filled with color. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .BarFillType

expression A variable that represents a Databar object.

Return Value

XlDataBarFillType

Remarks

The default value of the BarFillType property is xlDataBarFillGradient.

Example

The following code example selects a range of cells, adds a data bar conditional formatting rule to that range, and then sets the data bar's fill color to solid.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
myDataBar.BarFillType = xlDataBarFillSolid

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.Creator Property (Excel)

 Copy code hover
[image]

Databar.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Databar object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.Direction Property (Excel)

 Copy code hover
[image]

Databar.Direction Property (Excel)
Send feedback

Published: July 16, 2012

Returns or sets the direction the databar is displayed. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Direction

expression A variable that represents a Databar object.

Remarks

Can be one of the following constants: xlContext, xlLTR (left-to-right), or xlRTL (right-to-left).


Databar.Formula Property (Excel)

 Copy code hover
[image]

Databar.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String representing a formula, which determines the values to which the data bar will be applied.

Version Information

Version Added: Excel 2007

Syntax

expression .Formula

expression A variable that represents a Databar object.

Remarks

This property is useful to limit the range of values that will display the conditional format. A typical scenario is when you have a range of numbers containing both positive and negative values. You may want to create more than one conditional format for this range of numbers—one for positive values and another for negative values.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.MaxPoint Property (Excel)

 Copy code hover
[image]

Databar.MaxPoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ConditionValue object that specifies how the longest bar is evaluated for a data bar conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .MaxPoint

expression A variable that represents a Databar object.

Remarks

You can specify the type and value of the evaluation by using the Type and Value properties.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.MinPoint Property (Excel)

 Copy code hover
[image]

Databar.MinPoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ConditionValue object that specifies how the shortest bar is evaluated for a data bar conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .MinPoint

expression A variable that represents a Databar object.

Remarks

You can specify the type and value of the evaluation by using the Type and Value properties.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.NegativeBarFormat Property (Excel)

 Copy code hover
[image]

Databar.NegativeBarFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the NegativeBarFormat object associated with a data bar conditional formatting rule. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .NegativeBarFormat

expression A variable that represents a Databar object.

Return Value

NegativeBarFormat

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.Parent Property (Excel)

 Copy code hover
[image]

Databar.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.PercentMax Property (Excel)

 Copy code hover
[image]

Databar.PercentMax Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that specifies the length of the longest data bar as a percentage of cell width.

Version Information

Version Added: Excel 2007

Syntax

expression .PercentMax

expression A variable that represents a Databar object.

Remarks

The value must be a whole number between 0 and 100. The default value is 100.

The effect of the PercentMax property varies depending on the setting of the AxisPosition property of the Databar object. When the AxisPosition property is xlDataBarAxisAutomatic and the range contains both positive and negative values, the sum of the lengths of longest positive data bar and the longest negative data bar will not exceed the value specified by the PercentMax property. When the AxisPosition property is xlDataBarAxisMidpoint, the longest data bar (positive or negative) will be equal to the value of the PercentMax property divided by 2. When the AxisPosition property is xlDataBarAxisNone, the length of the longest data bar is always the percentage of cell width specified by the PercentMax property.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.PercentMin Property (Excel)

 Copy code hover
[image]

Databar.PercentMin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that specifies the length of the shortest data bar as a percentage of cell width.

Version Information

Version Added: Excel 2007

Syntax

expression .PercentMin

expression A variable that represents a Databar object.

Remarks

The value must be a whole number between 0 and 100. The default value is 0.

The effect of the PercentMin property varies depending on the setting of the AxisPosition property of the Databar object. When the AxisPosition property is xlDataBarAxisAutomatic and the range contains both positive and negative values, the minimum length of a positive or negative bar is specified by the PercentMin property, and the axis is displayed using automatic centering rules. When the AxisPosition property is xlDataBarAxisMidpoint, the minimum length of a positive or negative bar is specified by the PercentMin property, and the axis is centered in the middle of the cell. When the AxisPosition property is xlDataBarAxisNone, the length of the shortest data bar is always the percentage of cell width specified by the PercentMin property.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.Priority Property (Excel)

 Copy code hover
[image]

Databar.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a Databar object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.PTCondition Property (Excel)

 Copy code hover
[image]

Databar.PTCondition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.ScopeType Property (Excel)

 Copy code hover
[image]

Databar.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents a Databar object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.ShowValue Property (Excel)

 Copy code hover
[image]

Databar.ShowValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that specifies if the value in the cell is displayed if the data bar conditional format is applied to the range.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowValue

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.StopIfTrue Property (Excel)

 Copy code hover
[image]

Databar.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents a Databar object.

Remarks

To support backward compatibility, the default value for this property is False, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.Type Property (Excel)

 Copy code hover
[image]

Databar.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a Databar object.

Remarks

This property will always return a Long value of "4", which is equivalent to xlDatabar.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar Methods (Excel)

 Copy code hover
[image]

Databar Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


Databar.Delete Method (Excel)

 Copy code hover
[image]

Databar.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a Databar object.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

Databar.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents a Databar object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.SetFirstPriority Method (Excel)

 Copy code hover
[image]

Databar.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents a Databar object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

Databar Object

Other resources

Databar Object Members


Databar.SetLastPriority Method (Excel)

 Copy code hover
[image]

Databar.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents a Databar object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

Databar Object

Other resources

Databar Object Members


DataBarBorder Object (Excel)

 Copy code hover
[image]

DataBarBorder Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the border of the data bars specified by a conditional formatting rule.

Version Information

Version Added: Excel 2010

Remarks

Use the DataBarBorder object to get or set the color and border type for data bars. To access the DataBarBorder object associated with a data bar conditional formatting rule, use the BarBorder property. After retrieving the DataBarBorder object, use its Color property to return a FormatColor object that you can use to set the color of the data bars.

Example

The following code example selects a range of cells, adds a data bar conditional formatting rule to that range, uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and then sets the data bar's color, tint, and type.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
With myDataBar.BarBorder
 .Type = xlDataBarBorderSolid
 .Color.ThemeColor = xlThemeColorAccent2
 .Color.TintAndShade = 0
End With

See also

Concepts

Excel Object Model Reference

Other resources

DataBarBorder Object Members


DataBarBorder Members (Excel)

 Copy code hover
[image]

DataBarBorder Members (Excel)
Send feedback

Published: July 16, 2012

Represents the border of the data bars specified by a conditional formatting rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns an object that specifies the color of the border of data bars specified by a conditional formatting rule. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets the type of border for data bars specified by a conditional formatting rule. Read/write


DataBarBorder Properties (Excel)

 Copy code hover
[image]

DataBarBorder Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns an object that specifies the color of the border of data bars specified by a conditional formatting rule. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets the type of border for data bars specified by a conditional formatting rule. Read/write


DataBarBorder.Application Property (Excel)

 Copy code hover
[image]

DataBarBorder.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a DataBarBorder object.

See also

Concepts

DataBarBorder Object

Other resources

DataBarBorder Object Members


DataBarBorder.Color Property (Excel)

 Copy code hover
[image]

DataBarBorder.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that specifies the color of the border of data bars specified by a conditional formatting rule. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Color

expression A variable that represents a DataBarBorder object.

Return Value

FormatColor

Example

The following code example selects a range of cells and adds a data bar conditional formatting rule to that range. It then uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and uses the Color property of that object to retrieve the FormatColor object to set the color and tint of the data bar borders.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
With myDataBar.BarBorder
 .Type = xlDataBarBorderSolid
 .Color.ThemeColor = xlThemeColorAccent2
 .Color.TintAndShade = 0
End With

See also

Concepts

DataBarBorder Object

Other resources

DataBarBorder Object Members


DataBarBorder.Creator Property (Excel)

 Copy code hover
[image]

DataBarBorder.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DataBarBorder object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DataBarBorder Object

Other resources

DataBarBorder Object Members


DataBarBorder.Parent Property (Excel)

 Copy code hover
[image]

DataBarBorder.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a DataBarBorder object.

See also

Concepts

DataBarBorder Object

Other resources

DataBarBorder Object Members


DataBarBorder.Type Property (Excel)

 Copy code hover
[image]

DataBarBorder.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of border for data bars specified by a conditional formatting rule. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Type

expression A variable that represents a DataBarBorder object.

Return Value

XlDataBarBorderType

Example

The following code example selects a range of cells, adds a data bar conditional formatting rule to that range, uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and then sets the data bar color, tint, and type.

VBA Copy code Copy code
Range("A1:A10").Select
Range("A1:A10").Activate

Set myDataBar = Selection.FormatConditions.AddDatabar
With myDataBar.BarBorder
 .Type = xlDataBarBorderSolid
 .Color.ThemeColor = xlThemeColorAccent2
 .Color.TintAndShade = 0
End With

See also

Concepts

DataBarBorder Object

Other resources

DataBarBorder Object Members


DataFeedConnection Object (Excel)

 Copy code hover
[image]

DataFeedConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains the data and functionality needed to connect to data feeds. The same object is used for all Data Feed types.

Version information

Version Added: Excel 2013

See also

Other resources

DataFeedConnection Object Members


DataFeedConnection Members (Excel)

 Copy code hover
[image]

DataFeedConnection Members (Excel)
Send feedback

Published: July 16, 2012

Contains the data and functionality needed to connect to data feeds. The same object is used for all Data Feed types.

Methods

Name | Description
CancelRefresh | Cancels a refresh operation on a data feed connection.
Refresh | Refreshes the data feed connection.
SaveAsODC | Saves the data feed connection as a Microsoft Office Data Connection file.

Properties

Name | Description
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Boolean. Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets the command string for the specified data source. Variant Read/Write
Connection | Returns or sets a string that contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source. Variant Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Long Read-only
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Boolean Read/Write
Parent | Returns an Object that represents the parent object of the specified DataFeedConnection Object (Excel) object. Read-only.
RefreshDate | Returns the date on which the OLE DB connection was last refreshed. Date. Read-only
Refreshing | True if an OLE DB query is in progress for the specified data source connection. Boolean Read/Write
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Long Read/Write
SavePassword | True if password information in a data feed connection string is saved in the connection string. False if the password is removed.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. XlCredentialsMethod Enumeration (Excel) Read/Write
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/Write
SourceDataFile | A path to the original file used to create the connection. In the case of an OData connection, this is the location of the *.atom or *.atomsvc file used to create the connection. String Read/Write


DataFeedConnection Properties (Excel)

 Copy code hover
[image]

DataFeedConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Boolean. Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets the command string for the specified data source. Variant Read/Write
Connection | Returns or sets a string that contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source. Variant Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Long Read-only
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Boolean Read/Write
Parent | Returns an Object that represents the parent object of the specified DataFeedConnection Object (Excel) object. Read-only.
RefreshDate | Returns the date on which the OLE DB connection was last refreshed. Date. Read-only
Refreshing | True if an OLE DB query is in progress for the specified data source connection. Boolean Read/Write
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Long Read/Write
SavePassword | True if password information in a data feed connection string is saved in the connection string. False if the password is removed.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. XlCredentialsMethod Enumeration (Excel) Read/Write
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/Write
SourceDataFile | A path to the original file used to create the connection. In the case of an OData connection, this is the location of the *.atom or *.atomsvc file used to create the connection. String Read/Write


DataFeedConnection.AlwaysUseConnectionFile Property (Excel)

 Copy code hover
[image]

DataFeedConnection.AlwaysUseConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection file is always used to establish connection to the data source. Boolean. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .AlwaysUseConnectionFile

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

BOOL

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Application Property (Excel)

 Copy code hover
[image]

DataFeedConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a DataFeedConnection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
   MsgBox "This is an Excel Application object."
Else
   MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.CommandText Property (Excel)

 Copy code hover
[image]

DataFeedConnection.CommandText Property (Excel)
See also Send feedback

Returns or sets the command string for the specified data source. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .CommandText

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

VARIANT

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.CommandType Property (Excel)

 Copy code hover
[image]

DataFeedConnection.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .CommandType

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

XLCMDTYPE

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Connection Property (Excel)

 Copy code hover
[image]

DataFeedConnection.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .Connection

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

VARIANT

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Creator Property (Excel)

 Copy code hover
[image]

DataFeedConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Long Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a DataFeedConnection Object (Excel) object (Excel).

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.EnableRefresh Property (Excel)

 Copy code hover
[image]

DataFeedConnection.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection can be refreshed by the user. The default value is True. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .EnableRefresh

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

BOOL

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Parent Property (Excel)

 Copy code hover
[image]

DataFeedConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified DataFeedConnection Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

OBJECT

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.RefreshDate Property (Excel)

 Copy code hover
[image]

DataFeedConnection.RefreshDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the date on which the OLE DB connection was last refreshed. Date. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .RefreshDate

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

DATE

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Refreshing Property (Excel)

 Copy code hover
[image]

DataFeedConnection.Refreshing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if an OLE DB query is in progress for the specified data source connection. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .Refreshing

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

BOOL

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.RefreshOnFileOpen Property (Excel)

 Copy code hover
[image]

DataFeedConnection.RefreshOnFileOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection is automatically updated each time the workbook is opened. The default value is False.

Version information

Version Added: Excel 2013

Syntax

expression .RefreshOnFileOpen

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

BOOL

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.RefreshPeriod Property (Excel)

 Copy code hover
[image]

DataFeedConnection.RefreshPeriod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between refreshes. Long Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .RefreshPeriod

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

INT32

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.SavePassword Property (Excel)

 Copy code hover
[image]

DataFeedConnection.SavePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if password information in a data feed connection string is saved in the connection string. False if the password is removed.

Version information

Version Added: Excel 2013

Syntax

expression .SavePassword

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

BOOL

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.ServerCredentialsMethod Property (Excel)

 Copy code hover
[image]

DataFeedConnection.ServerCredentialsMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of credentials that should be used for server authentication. XlCredentialsMethod Enumeration (Excel) Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ServerCredentialsMethod

expression A variable that represents a DataFeedConnection Object (Excel) object.

Remarks

Following are the types of credentials that may be used:

  • xlCredentialsMethodIntegrated

  • xlCredentialsMethodNone

  • xlCredentialsMethodStored

Property value

XLCREDENTIALSMETHOD

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.SourceConnectionFile Property (Excel)

 Copy code hover
[image]

DataFeedConnection.SourceConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .SourceConnectionFile

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

STRING

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.SourceDataFile Property (Excel)

 Copy code hover
[image]

DataFeedConnection.SourceDataFile Property (Excel)
See also Send feedback

Published: July 16, 2012

A path to the original file used to create the connection. In the case of an OData connection, this is the location of the *.atom or *.atomsvc file used to create the connection. String Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .SourceDataFile

expression A variable that represents a DataFeedConnection Object (Excel) object.

Property value

STRING

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection Methods (Excel)

 Copy code hover
[image]

DataFeedConnection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CancelRefresh | Cancels a refresh operation on a data feed connection.
Refresh | Refreshes the data feed connection.
SaveAsODC | Saves the data feed connection as a Microsoft Office Data Connection file.


DataFeedConnection.CancelRefresh Method (Excel)

 Copy code hover
[image]

DataFeedConnection.CancelRefresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Cancels a refresh operation on a data feed connection.

Version information

Version Added: Excel 2013

Syntax

expression .CancelRefresh

expression A variable that represents a DataFeedConnection Object (Excel) object.

Return value

VOID

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.Refresh Method (Excel)

 Copy code hover
[image]

DataFeedConnection.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes the data feed connection.

Version information

Version Added: Excel 2013

Syntax

expression .Refresh

expression A variable that represents a DataFeedConnection Object (Excel) object.

Return value

VOID

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataFeedConnection.SaveAsODC Method (Excel)

 Copy code hover
[image]

DataFeedConnection.SaveAsODC Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the data feed connection as a Microsoft Office Data Connection file.

Version information

Version Added: Excel 2013

Syntax

expression .SaveAsODC(ODCFileName,Description,Keywords)

expression A variable that represents a DataFeedConnection Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
ODCFileName | Required | STRING | Location to save the file.
Description | Optional | VARIANT | Description that will be saved in the file.
Keywords | Optional | VARIANT | Space-separated keywords that can be used to search for this file.

Example

The following example saves the connection as an ODC file titled "ODCFile". This example assumes data feed connection exists on the active worksheet.

VBA Copy code Copy code
Sub UseSaveAsODC()

   Application.ActiveWorkbook.Connections("Datafeed1").DataFeedConnection.SaveAsODC ("ODCFile")

End Sub

Return value

VOID

See also

Other resources

DataFeedConnection Object Members
DataFeedConnection Object


DataLabel Object (Excel)

 Copy code hover
[image]

DataLabel Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the data label on a chart point or trendline.

Remarks

On a series, the DataLabel object is a member of the DataLabels collection. The DataLabels collection contains a DataLabel object for each point. For a series without definable points (such as an area series), the DataLabels collection contains a single DataLabel object.

Example

Use DataLabels(index), where index is the data-label index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"

Use the DataLabel property to return the DataLabel object for a single point. The following example turns on the data label for the second point in series one on the chart sheet named "Chart1" and sets the data label text to "Saturday."

VBA Copy code Copy code
With Charts("chart1")
 With .SeriesCollection(1).Points(2)
 .HasDataLabel = True
 .DataLabel.Text = "Saturday"
 End With
End With

On a trendline, the DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text to show only the equation and then places the data label text in cell A1 on the worksheet named "Sheet1."

VBA Copy code Copy code
With Charts("chart1").SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = False
 .DisplayEquation = True
 Worksheets("sheet1").Range("a1").Value = .DataLabel.Text
End With

See also

Concepts

Excel Object Model Reference

Other resources

DataLabel Object Members


DataLabel Members (Excel)

 Copy code hover
[image]

DataLabel Members (Excel)
Send feedback

Published: July 16, 2012

Represents the data label on a chart point or trendline.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Caption | Returns or sets a String value that represents the data label text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read/Write.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlDataLabelPosition value that represents the position of the data label.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Separator | Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.
ShowRange | Used to toggle the Range field if it exists on the data label range. Boolean Read/Write
ShowSeriesName | Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.
ShowValue | Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


DataLabel Properties (Excel)

 Copy code hover
[image]

DataLabel Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Caption | Returns or sets a String value that represents the data label text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read/Write.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlDataLabelPosition value that represents the position of the data label.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Separator | Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.
ShowRange | Used to toggle the Range field if it exists on the data label range. Boolean Read/Write
ShowSeriesName | Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.
ShowValue | Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


DataLabel.Application Property (Excel)

 Copy code hover
[image]

DataLabel.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DataLabel object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.AutoText Property (Excel)

 Copy code hover
[image]

DataLabel.AutoText Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object automatically generates appropriate text based on context. Read/write Boolean.

Syntax

expression .AutoText

expression A variable that represents a DataLabel object.

Example

This example sets the data labels for series one in Chart1 to automatically generate appropriate text.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).DataLabels.AutoText = True

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Caption Property (Excel)

 Copy code hover
[image]

DataLabel.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the data label text.

Syntax

expression .Caption

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Characters Property (Excel)

 Copy code hover
[image]

DataLabel.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Syntax

expression .Characters(Start, Length)

expression A variable that represents a DataLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The Characters object isn't a collection.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Creator Property (Excel)

 Copy code hover
[image]

DataLabel.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DataLabel object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Format Property (Excel)

 Copy code hover
[image]

DataLabel.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Formula Property (Excel)

 Copy code hover
[image]

DataLabel.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Formula

expression A variable that represents a DataLabel object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaLocal Property (Excel)

 Copy code hover
[image]

DataLabel.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaLocal

expression A variable that represents a DataLabel object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

DataLabel.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a DataLabel object.

Return Value

String

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

DataLabel.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a DataLabel object.

Return Value

String

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Height Property (Excel)

 Copy code hover
[image]

DataLabel.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read/Write.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a DataLabel object.

Return Value

Double

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

DataLabel.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a DataLabel object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Left Property (Excel)

 Copy code hover
[image]

DataLabel.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Name Property (Excel)

 Copy code hover
[image]

DataLabel.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormat Property (Excel)

 Copy code hover
[image]

DataLabel.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a DataLabel object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormatLinked Property (Excel)

 Copy code hover
[image]

DataLabel.NumberFormatLinked Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Syntax

expression .NumberFormatLinked

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

DataLabel.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a DataLabel object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Orientation Property (Excel)

 Copy code hover
[image]

DataLabel.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a DataLabel object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Parent Property (Excel)

 Copy code hover
[image]

DataLabel.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Position Property (Excel)

 Copy code hover
[image]

DataLabel.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlDataLabelPosition value that represents the position of the data label.

Syntax

expression .Position

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ReadingOrder Property (Excel)

 Copy code hover
[image]

DataLabel.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Separator Property (Excel)

 Copy code hover
[image]

DataLabel.Separator Property (Excel)
See also Send feedback

Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.

Syntax

expression .Separator

expression A variable that represents a DataLabel object.

Remarks

If you use a string, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline, depending on the data label.

When a value of "1" is returned, it indicates that the user has not changed the default separator which is a comma ",". You can also pass a value of "1" to change the separator back to the default separator.

The chart must first be active before you can access the data labels programmatically; otherwise a run-time error occurs.

Example

This example sets the data label separator for the first series on the first chart to a semicolon. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub ChangeSeparator()

 ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1) _
 .DataLabels.Separator = ";"

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Shadow Property (Excel)

 Copy code hover
[image]

DataLabel.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowBubbleSize Property (Excel)

 Copy code hover
[image]

DataLabel.ShowBubbleSize Property (Excel)
See also Send feedback

Published: July 16, 2012

True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowBubbleSize

expression An expression that returns a DataLabel object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example shows the bubble size for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseBubbleSize()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowBubbleSize = True

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowCategoryName Property (Excel)

 Copy code hover
[image]

DataLabel.ShowCategoryName Property (Excel)
See also Send feedback

Published: July 16, 2012

True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowCategoryName

expression An expression that returns a DataLabel object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example shows the category name for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseCategoryName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowCategoryName = True

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowLegendKey Property (Excel)

 Copy code hover
[image]

DataLabel.ShowLegendKey Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Syntax

expression .ShowLegendKey

expression A variable that represents a DataLabel object.

Example

This example sets the data labels for series one in Chart1 to show values and the legend key.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).DataLabels
 .ShowLegendKey = True
 .Type = xlShowValue
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowPercentage Property (Excel)

 Copy code hover
[image]

DataLabel.ShowPercentage Property (Excel)
See also Send feedback

Published: July 16, 2012

True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowPercentage

expression A variable that represents a DataLabel object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the percentage value to be shown for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UsePercentage()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowPercentage = True

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowRange Property (Excel)

 Copy code hover
[image]

DataLabel.ShowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Used to toggle the Range field if it exists on the data label range. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowRange

expression A variable that represents a DataLabel object.

Remarks

The Range object maps an arbitrary range of cells to a range of data labels, so that each data label corresponds to one of the cells in the range.

Property value

BOOL

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowSeriesName Property (Excel)

 Copy code hover
[image]

DataLabel.ShowSeriesName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.

Syntax

expression .ShowSeriesName

expression A variable that represents a DataLabel object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the series name to be shown for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseSeriesName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowSeriesName = True

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowValue Property (Excel)

 Copy code hover
[image]

DataLabel.ShowValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.

Syntax

expression .ShowValue

expression A variable that represents a DataLabel object.

Remarks

The specified chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the value to be shown for the data labels of the first series, on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseValue()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowValue = True

End Sub

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Text Property (Excel)

 Copy code hover
[image]

DataLabel.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Top Property (Excel)

 Copy code hover
[image]

DataLabel.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.VerticalAlignment Property (Excel)

 Copy code hover
[image]

DataLabel.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a DataLabel object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Width Property (Excel)

 Copy code hover
[image]

DataLabel.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a DataLabel object.

Return Value

Double

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel Methods (Excel)

 Copy code hover
[image]

DataLabel Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DataLabel.Delete Method (Excel)

 Copy code hover
[image]

DataLabel.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DataLabel object.

Return Value

Variant

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Select Method (Excel)

 Copy code hover
[image]

DataLabel.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a DataLabel object.

Return Value

Variant

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabels Object (Excel)

 Copy code hover
[image]

DataLabels Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the DataLabel objects for the specified series.

Remarks

Each DataLabel object represents a data label for a point or trendline. For a series without definable points (such as an area series), the DataLabels collection contains a single data label.

Example

Use the DataLabels method to return the DataLabels collection. The following example sets the number format for data labels on series one on chart sheet one.

VBA Copy code Copy code
With Charts(1).SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.NumberFormat = "##.##"
End With

Use DataLabels(index), where index is the data-label index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"

See also

Concepts

Excel Object Model Reference

Other resources

DataLabels Object Members


DataLabels Members (Excel)

 Copy code hover
[image]

DataLabels Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the DataLabel objects for the specified series.

Methods

Name | Description
Delete | Deletes the object.
Item | Returns a single object from a collection.
Propagate | Enables you to take the contents and formatting of a single data label and apply it to every other data label on the series.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlDataLabelPosition value that represents the position of the data label.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Separator | Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.
ShowRange | Used to toggle the Range field if it exists on the data label range. Boolean Read/Write
ShowSeriesName | Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.
ShowValue | Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.


DataLabels Properties (Excel)

 Copy code hover
[image]

DataLabels Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlDataLabelPosition value that represents the position of the data label.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Separator | Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.
ShowRange | Used to toggle the Range field if it exists on the data label range. Boolean Read/Write
ShowSeriesName | Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.
ShowValue | Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.


DataLabels.Application Property (Excel)

 Copy code hover
[image]

DataLabels.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DataLabels object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.AutoText Property (Excel)

 Copy code hover
[image]

DataLabels.AutoText Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object automatically generates appropriate text based on context. Read/write Boolean.

Syntax

expression .AutoText

expression A variable that represents a DataLabels object.

Example

This example sets the data labels for series one in Chart1 to automatically generate appropriate text.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).DataLabels.AutoText = True
Note Note

If you run ?ActiveChart.SeriesCollection(1).DataLabels.AutoText in the Immediate Window you will receive the following:
Excel 2003: Returns nothing.
Excel 2007 and later: Returns True only when all DataLabels have AutoText = True, returns False if all DataLabels have AutoText = False or some DataLabels have AutoText = False.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Count Property (Excel)

 Copy code hover
[image]

DataLabels.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Creator Property (Excel)

 Copy code hover
[image]

DataLabels.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DataLabels object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Format Property (Excel)

 Copy code hover
[image]

DataLabels.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

DataLabels.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a DataLabels object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Name Property (Excel)

 Copy code hover
[image]

DataLabels.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormat Property (Excel)

 Copy code hover
[image]

DataLabels.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a DataLabels object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormatLinked Property (Excel)

 Copy code hover
[image]

DataLabels.NumberFormatLinked Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Syntax

expression .NumberFormatLinked

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

DataLabels.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a DataLabels object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Orientation Property (Excel)

 Copy code hover
[image]

DataLabels.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a DataLabels object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Parent Property (Excel)

 Copy code hover
[image]

DataLabels.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Position Property (Excel)

 Copy code hover
[image]

DataLabels.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlDataLabelPosition value that represents the position of the data label.

Syntax

expression .Position

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ReadingOrder Property (Excel)

 Copy code hover
[image]

DataLabels.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Separator Property (Excel)

 Copy code hover
[image]

DataLabels.Separator Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.

Syntax

expression .Separator

expression A variable that represents a DataLabels object.

Remarks

If you use a string, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline, depending on the data label.

When a value of "1" is returned, it indicates that the user has not changed the default separator which is a comma ",". You can also pass a value of "1" to change the separator back to the default separator.

The chart must first be active before you can access the data labels programmatically; otherwise a run-time error occurs.

Example

This example sets the data label separator for the first series on the first chart to a semicolon. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub ChangeSeparator()

 ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1) _
 .DataLabels.Separator = ";"

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Shadow Property (Excel)

 Copy code hover
[image]

DataLabels.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowBubbleSize Property (Excel)

 Copy code hover
[image]

DataLabels.ShowBubbleSize Property (Excel)
See also Send feedback

Published: July 16, 2012

True to show the bubble size for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowBubbleSize

expression An expression that returns a DataLabels object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example shows the bubble size for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseBubbleSize()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowBubbleSize = True

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowCategoryName Property (Excel)

 Copy code hover
[image]

DataLabels.ShowCategoryName Property (Excel)
See also Send feedback

Published: July 16, 2012

True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowCategoryName

expression An expression that returns a DataLabels object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example shows the category name for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseCategoryName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowCategoryName = True

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowLegendKey Property (Excel)

 Copy code hover
[image]

DataLabels.ShowLegendKey Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Syntax

expression .ShowLegendKey

expression A variable that represents a DataLabels object.

Example

This example sets the data labels for series one in Chart1 to show values and the legend key.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).DataLabels
 .ShowLegendKey = True
 .Type = xlShowValue
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowPercentage Property (Excel)

 Copy code hover
[image]

DataLabels.ShowPercentage Property (Excel)
See also Send feedback

Published: July 16, 2012

True to display the percentage value for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression .ShowPercentage

expression A variable that represents a DataLabels object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the percentage value to be shown for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UsePercentage()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowPercentage = True

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowRange Property (Excel)

 Copy code hover
[image]

DataLabels.ShowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Used to toggle the Range field if it exists on the data label range. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowRange

expression A variable that represents a DataLabels object.

Remarks

The Range object maps an arbitrary range of cells to a range of data labels, so that each data label corresponds to one of the cells in the range.

Property value

BOOL

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowSeriesName Property (Excel)

 Copy code hover
[image]

DataLabels.ShowSeriesName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide. Read/write.

Syntax

expression .ShowSeriesName

expression A variable that represents a DataLabels object.

Remarks

The chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the series name to be shown for the data labels of the first series on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseSeriesName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowSeriesName = True

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowValue Property (Excel)

 Copy code hover
[image]

DataLabels.ShowValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide. Read/write.

Syntax

expression .ShowValue

expression A variable that represents a DataLabels object.

Remarks

The specified chart must first be active before you can access the data labels programmatically or a run-time error will occur.

Example

This example enables the value to be shown for the data labels of the first series, on the first chart. This example assumes a chart exists on the active worksheet.

VBA Copy code Copy code
Sub UseValue()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowValue = True

End Sub

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.VerticalAlignment Property (Excel)

 Copy code hover
[image]

DataLabels.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a DataLabels object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels Methods (Excel)

 Copy code hover
[image]

DataLabels Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Item | Returns a single object from a collection.
Propagate | Enables you to take the contents and formatting of a single data label and apply it to every other data label on the series.
Select | Selects the object.


DataLabels.Delete Method (Excel)

 Copy code hover
[image]

DataLabels.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DataLabels object.

Return Value

Variant

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Item Method (Excel)

 Copy code hover
[image]

DataLabels.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a DataLabels object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A DataLabel object contained by the collection.

Example

This example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).DataLabels.Item(5).NumberFormat = "0.000"

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Propagate Method (Excel)

 Copy code hover
[image]

DataLabels.Propagate Method (Excel)
See also Send feedback

Published: July 16, 2012

Enables you to take the contents and formatting of a single data label and apply it to every other data label on the series.

Version information

Version Added: Excel 2013

Syntax

expression .Propagate(Index)

expression A variable that represents a DataLabels object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number of the data label to propagate.

Remarks

If the source data label supports fields that are incompatible with the destination data label, those fields will be inserted as their [FIELD NAME]. For example, if a data label on a pie series with a percentage field is propagated to a data label on a column chart, that percentage field will become an unresolved field showing [PERCENTAGE].

Note Note

Passing an argument of zero (0) resets the data labels to your current prototype.

Return value

VOID

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Select Method (Excel)

 Copy code hover
[image]

DataLabels.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a DataLabels object.

Return Value

Variant

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataTable Object (Excel)

 Copy code hover
[image]

DataTable Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a chart data table.

Example

Use the DataTable property to return a DataTable object. The following example adds a data table with an outline border to embedded chart one.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 .DataTable.HasBorderOutline = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

DataTable Object Members


DataTable Members (Excel)

 Copy code hover
[image]

DataTable Members (Excel)
Send feedback

Published: July 16, 2012

Represents a chart data table.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
HasBorderHorizontal | True if the chart data table has horizontal cell borders. Read/write Boolean.
HasBorderOutline | True if the chart data table has outline borders. Read/write Boolean.
HasBorderVertical | True if the chart data table has vertical cell borders. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.


DataTable Properties (Excel)

 Copy code hover
[image]

DataTable Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
HasBorderHorizontal | True if the chart data table has horizontal cell borders. Read/write Boolean.
HasBorderOutline | True if the chart data table has outline borders. Read/write Boolean.
HasBorderVertical | True if the chart data table has vertical cell borders. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.


DataTable.Application Property (Excel)

 Copy code hover
[image]

DataTable.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DataTable object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Border Property (Excel)

 Copy code hover
[image]

DataTable.Border Property (Excel)
See also Send feedback

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Creator Property (Excel)

 Copy code hover
[image]

DataTable.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DataTable object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Font Property (Excel)

 Copy code hover
[image]

DataTable.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Format Property (Excel)

 Copy code hover
[image]

DataTable.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderHorizontal Property (Excel)

 Copy code hover
[image]

DataTable.HasBorderHorizontal Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart data table has horizontal cell borders. Read/write Boolean.

Syntax

expression .HasBorderHorizontal

expression A variable that represents a DataTable object.

Example

This example causes the embedded chart data table to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderOutline Property (Excel)

 Copy code hover
[image]

DataTable.HasBorderOutline Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart data table has outline borders. Read/write Boolean.

Syntax

expression .HasBorderOutline

expression A variable that represents a DataTable object.

Example

This example causes the embedded chart data table to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderVertical Property (Excel)

 Copy code hover
[image]

DataTable.HasBorderVertical Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the chart data table has vertical cell borders. Read/write Boolean.

Syntax

expression .HasBorderVertical

expression A variable that represents a DataTable object.

Example

This example causes the embedded chart data table to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Parent Property (Excel)

 Copy code hover
[image]

DataTable.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.ShowLegendKey Property (Excel)

 Copy code hover
[image]

DataTable.ShowLegendKey Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Syntax

expression .ShowLegendKey

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable Methods (Excel)

 Copy code hover
[image]

DataTable Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DataTable.Delete Method (Excel)

 Copy code hover
[image]

DataTable.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Select Method (Excel)

 Copy code hover
[image]

DataTable.Select Method (Excel)
See also Send feedback

Selects the object.

Syntax

expression .Select

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DefaultWebOptions Object (Excel)

 Copy code hover
[image]

DefaultWebOptions Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page. You can return or set attributes either at the application (global) level or at the workbook level.

Remarks

Workbook-level attribute settings override application-level attribute settings. Workbook-level attributes are contained in the WebOptions object.

Note Note

Attribute values can be different from one workbook to another, depending on the attribute value at the time the workbook was saved.

Example

Use the DefaultWebOptions property to return the DefaultWebOptions object. The following example checks to see whether PNG (Portable Network Graphics) is allowed as an image format and sets the strImageFileType variable accordingly.

VBA Copy code Copy code
Set objAppWebOptions = Application.DefaultWebOptions
With objAppWebOptions
 If .AllowPNG = True Then
 strImageFileType = "PNG"
 Else
 strImageFileType = "JPG"
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

DefaultWebOptions Object Members


DefaultWebOptions Members (Excel)

 Copy code hover
[image]

DefaultWebOptions Members (Excel)
Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page. You can return or set attributes either at the application (global) level or at the workbook level.

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
AlwaysSaveInDefaultEncoding | True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. False if the original encoding of the file is used. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CheckIfOfficeIsHTMLEditor | True if Microsoft Excel checks to see whether an Office application is the default HTML editor when you start Excel. False if Excel does not perform this check. The default value is True. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DownloadComponents | True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
Fonts | Returns the WebPageFonts collection representing the set of fonts Microsoft Excel uses when you open a Web page in Excel and there is either no font information specified in the Web page, or the current default font can't display the character set in the Web page. Read-only.
LoadPictures | True if images are loaded when you open a document in Microsoft Excel, usually when the images and document were not created in Microsoft Excel. False if the images are not loaded. The default value is True. Read/write Boolean.
LocationOfComponents | Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
SaveHiddenData | True if data outside of the specified range is saved when you save the document as a Web page. This data may be necessary for maintaining formulas. False if data outside of the specified range is not saved with the Web page. The default value is True. Read/write Boolean.
SaveNewWebPagesAsWebArchives | True if new Web pages can be saved as Web archives. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.
TargetBrowser | Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.
UpdateLinksOnSave | True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page, ensuring that the links are up-to-date at the time the document is saved. False if the links are not updated. The default value is True. Read/write Boolean.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


DefaultWebOptions Properties (Excel)

 Copy code hover
[image]

DefaultWebOptions Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
AlwaysSaveInDefaultEncoding | True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. False if the original encoding of the file is used. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CheckIfOfficeIsHTMLEditor | True if Microsoft Excel checks to see whether an Office application is the default HTML editor when you start Excel. False if Excel does not perform this check. The default value is True. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DownloadComponents | True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
Fonts | Returns the WebPageFonts collection representing the set of fonts Microsoft Excel uses when you open a Web page in Excel and there is either no font information specified in the Web page, or the current default font can't display the character set in the Web page. Read-only.
LoadPictures | True if images are loaded when you open a document in Microsoft Excel, usually when the images and document were not created in Microsoft Excel. False if the images are not loaded. The default value is True. Read/write Boolean.
LocationOfComponents | Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
SaveHiddenData | True if data outside of the specified range is saved when you save the document as a Web page. This data may be necessary for maintaining formulas. False if data outside of the specified range is not saved with the Web page. The default value is True. Read/write Boolean.
SaveNewWebPagesAsWebArchives | True if new Web pages can be saved as Web archives. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.
TargetBrowser | Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.
UpdateLinksOnSave | True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page, ensuring that the links are up-to-date at the time the document is saved. False if the links are not updated. The default value is True. Read/write Boolean.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


DefaultWebOptions.AllowPNG Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.AllowPNG Property (Excel)
See also Send feedback

Published: July 16, 2012

True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.

Syntax

expression .AllowPNG

expression A variable that represents a DefaultWebOptions object.

Remarks

If you save images in the PNG format as opposed to any other file format, you might improve the image quality or reduce the size of those image files, and therefore decrease the download time, assuming that the Web browsers you are targeting support the PNG format.

Example

Alternatively, PNG can be enabled as the global default for the application for newly created documents.

VBA Copy code Copy code
Application.DefaultWebOptions.AllowPNG = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.AlwaysSaveInDefaultEncoding Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.AlwaysSaveInDefaultEncoding Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. False if the original encoding of the file is used. The default value is False. Read/write Boolean.

Syntax

expression .AlwaysSaveInDefaultEncoding

expression A variable that represents a DefaultWebOptions object.

Remarks

The Encoding property can be used to set the default encoding.

Example

This example sets the encoding to the default encoding. The encoding is used when you save the document as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.AlwaysSaveInDefaultEncoding = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Application Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DefaultWebOptions object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.CheckIfOfficeIsHTMLEditor Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.CheckIfOfficeIsHTMLEditor Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel checks to see whether an Office application is the default HTML editor when you start Excel. False if Excel does not perform this check. The default value is True. Read/write Boolean.

Syntax

expression .CheckIfOfficeIsHTMLEditor

expression A variable that represents a DefaultWebOptions object.

Remarks

This property is used only if the Web browser you are using supports HTML editing and HTML editors.

To use a different HTML editor, you must set this property to False and then register the editor as the default system HTML editor.

Example

This example causes Microsoft Excel not to check to see whether it is the default HTML editor.

VBA Copy code Copy code
Application.DefaultWebOptions.CheckIfOfficeIsHTMLEditor = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Creator Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DefaultWebOptions object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.DownloadComponents Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.DownloadComponents Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.

Syntax

expression .DownloadComponents

expression A variable that represents a DefaultWebOptions object.

Remarks

You can set the LocationOfComponents property to a central URL (on the intranet or Web) or path (local or network) to a location from which authorized users can download components when viewing your saved document. The path must be valid and must point to a location that contains the necessary components, and the user must have a valid Microsoft Office license.

Office Web components add interactivity to documents that you save as Web pages. If you view a Web page in a browser on a computer that does not have the components installed, the interactive portions of the page will be static.

Example

This example allows the Office Web components to be downloaded with the specified Web page, if they are not already installed.

VBA Copy code Copy code
Application.DefaultWebOptions.DownloadComponents = True
Application.DefaultWebOptions.LocationOfComponents = _
 Application.Path & Application.PathSeparator & "foo"

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Encoding Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.Encoding Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.

Syntax

expression .Encoding

expression A variable that represents a DefaultWebOptions object.

Remarks

You cannot use any of the constants that have the suffix AutoDetect. These constants are used by the ReloadAs method.

Example

This example checks to see whether the default document encoding is Western, and then it sets the string strDocEncoding accordingly.

VBA Copy code Copy code
If Application.DefaultWebOptions.Encoding = msoEncodingWestern Then
    strDocEncoding = "Western"
Else
    strDocEncoding = "Other"
End If

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.FolderSuffix Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.FolderSuffix Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.

Syntax

expression .FolderSuffix

expression A variable that represents a DefaultWebOptions object.

Remarks

Newly created documents use the suffix returned by the FolderSuffix property of the DefaultWebOptions object. The value of the FolderSuffix property of the WebOptions object may differ from that of the DefaultWebOptions object if the document was previously edited in a different language version of Microsoft Excel. You can use the UseDefaultFolderSuffix method to change the suffix to the language you are currently using in Microsoft Office.

By default, the name of the supporting folder is the name of the Web page plus an underscore (_), a period (.), or a hyphen (-) and the word "files" (appearing in the language of the version of Excel in which the file was saved as a Web page). For example, suppose that you use the Dutch language version of Excel to save a file called "Page1" as a Web page. The default name of the supporting folder is Page1_bestanden.

The following table lists each language version of Office, and gives its corresponding LanguageID property value and folder suffix. For the languages that are not listed in the table, the suffix ".files" is used.

Language | LanguageID | Folder suffix
Arabic | 1025 | .files
Basque | 1069 | _fitxategiak
Portuguese (Brazil) | 1046 | _arquivos
Bulgarian | 1026 | .files
Catalan | 1027 | _fitxers
Chinese - Simplified | 2052 | .files
Chinese - Traditional | 1028 | .files
Croatian | 1050 | _datoteke
Czech | 1029 | _soubory
Danish | 1030 | -filer
Dutch | 1043 | _bestanden
English | 1033 | _files
Estonian | 1061 | _failid
Finnish | 1035 | _tiedostot
French | 1036 | _fichiers
German | 1031 | -Dateien
Greek | 1032 | .files
Hebrew | 1037 | .files
Hungarian | 1038 | _elemei
Italian | 1040 | -file
Japanese | 1041 | .files
Korean | 1042 | .files
Latvian | 1062 | _fails
Lithuanian | 1063 | _bylos
Norwegian | 1044 | -filer
Polish | 1045 | _pliki
Portuguese | 2070 | _ficheiros
Romanian | 1048 | .files
Russian | 1049 | .files
Serbian (Cyrillic) | 3098 | .files
Serbian (Latin) | 2074 | _fajlovi
Slovakian | 1051 | .files
Slovenian | 1060 | _datoteke
Spanish | 3082 | _archivos
Swedish | 1053 | -filer
Thai | 1054 | .files
Turkish | 1055 | _dosyalar
Ukranian | 1058 | .files
Vietnamese | 1066 | .files

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Fonts Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.Fonts Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the WebPageFonts collection representing the set of fonts Microsoft Excel uses when you open a Web page in Excel and there is either no font information specified in the Web page, or the current default font can't display the character set in the Web page. Read-only.

Syntax

expression .Fonts

expression A variable that represents a DefaultWebOptions object.

Example

This example sets the default fixed-width font for the English/Western European/Other Latin Script character set to Courier New, 14 points.

VBA Copy code Copy code
With Application.DefaultWebOptions _
    .Fonts(msoCharacterSetEnglishWesternEuropeanOtherLatinScript)
        .FixedWidthFont = "Courier New"
        .FixedWidthFontSize = 14
End With

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.LoadPictures Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.LoadPictures Property (Excel)
See also Send feedback

True if images are loaded when you open a document in Microsoft Excel, usually when the images and document were not created in Microsoft Excel. False if the images are not loaded. The default value is True. Read/write Boolean.

Syntax

expression .LoadPictures

expression A variable that represents a DefaultWebOptions object.

Example

This example causes images to load when the document is opened in Excel.

VBA Copy code Copy code
Application.DefaultWebOptions.LoadPictures = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.LocationOfComponents Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.LocationOfComponents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.

Syntax

expression .LocationOfComponents

expression A variable that represents a DefaultWebOptions object.

Remarks

Office Web components are automatically downloaded with the specified Web page if the DownloadComponents property is is set to True, the components are not already installed, the path is valid and points to a location that contains the necessary components, and the user has a valid Microsoft Office license.

Example

This example sets the path to the location from which users can download Microsoft Office Web components.

VBA Copy code Copy code
Application.DefaultWebOptions.DownloadComponents = True
Application.DefaultWebOptions.LocationOfComponents = _
 Application.Path & Application.PathSeparator & "foo"

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.OrganizeInFolder Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.OrganizeInFolder Property (Excel)
See also Send feedback

Published: July 16, 2012

True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.

Syntax

expression .OrganizeInFolder

expression A variable that represents a DefaultWebOptions object.

Remarks

The new folder is created in the folder where you have saved the Web page, and is named after the document. If long file names are used, a suffix is added to the folder name. The FolderSuffix property returns the folder suffix for the language support you have selected or installed, or the default folder suffix.

If you save a document that was previously saved with the OrganizeInFolder property set to a different value, Microsoft Excel automatically moves the supporting files into or out of the folder, as appropriate.

If you don't use long file names (that is, if the UseLongFileNames property is set to False), Microsoft Excel automatically saves any supporting files in a separate folder. The files cannot be saved in the same folder as the Web page.

Example

This example specifies that all supporting files are saved in the same folder when the document is saved as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.OrganizeInFolder = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Parent Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DefaultWebOptions object.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.PixelsPerInch Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.PixelsPerInch Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.

Syntax

expression .PixelsPerInch

expression A variable that represents a DefaultWebOptions object.

Remarks

This property determines the size of the images and cells on the specified Web page relative to the size of text whenever you view the saved document in a Web browser. The physical dimensions of the resulting image or cell are the result of the original dimensions (in inches) multiplied by the number of pixels per inch.

You use the ScreenSize property to set the optimum screen size for the targeted Web browsers.

Example

This example sets the pixel density depending on the target screen size of the browser. For 800x600 pixel screens, the density is 72 pixels per inch. For 1024x768 pixel screens, the density is 96 pixels per inch. For all other cases, use a density of 120 pixels per inch.

VBA Copy code Copy code
With Application.DefaultWebOptions
 Select Case .ScreenSize
 Case msoScreenSize800x600
 .PixelsPerInch = 72
 Case msoScreenSize1024x768
 .PixelsPerInch = 96
 Case Else
 .PixelsPerInch = 120
 End Select
End With

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.RelyOnCSS Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.RelyOnCSS Property (Excel)
See also Send feedback

Published: July 16, 2012

True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.

Syntax

expression .RelyOnCSS

expression A variable that represents a DefaultWebOptions object.

Remarks

You should set this property to True if your Web browser supports cascading style sheets, as this will give you more precise layout and formatting control on your Web page and make it look more like your document (as it appears in Microsoft Excel).

Example

This example enables the use of cascading style sheets as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.RelyOnCSS = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.RelyOnVML Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.RelyOnVML Property (Excel)
See also Send feedback

Published: July 16, 2012

True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.

Syntax

expression .RelyOnVML

expression A variable that represents a DefaultWebOptions object.

Remarks

You can reduce file sizes by not generating images for drawing objects, if your Web browser supports Vector Markup Language (VML). For example, Microsoft Internet Explorer 5 supports this feature, and you should set the RelyOnVML property to True if you are targeting this browser. For browsers that do not support VML, the image will not appear when you view a Web page saved with this property enabled.

For example, you should not generate images if your Web page uses image files that you have generated earlier, and if the location where you save the document is different from the final location of the page on the Web server.

Example

This example specifies that images are generated when saving the worksheet to a Web page.

VBA Copy code Copy code
Workbooks(1).DefaultWebOptions.RelyOnVML = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.SaveHiddenData Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.SaveHiddenData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data outside of the specified range is saved when you save the document as a Web page. This data may be necessary for maintaining formulas. False if data outside of the specified range is not saved with the Web page. The default value is True. Read/write Boolean.

Syntax

expression .SaveHiddenData

expression A variable that represents a DefaultWebOptions object.

Remarks

If you choose not to save data outside of the specified range, references to that data in the formula are converted to static values. If the data is in another sheet or workbook, the result of the formula is saved as a static value.

Example

This example prevents hidden data from being saved with Web pages.

VBA Copy code Copy code
Application.DefaultWebOptions.SaveHiddenData = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.SaveNewWebPagesAsWebArchives Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.SaveNewWebPagesAsWebArchives Property (Excel)
See also Send feedback

Published: July 16, 2012

True if new Web pages can be saved as Web archives. Read/write Boolean.

Syntax

expression .SaveNewWebPagesAsWebArchives

expression A variable that represents a DefaultWebOptions object.

Example

In this example, Microsoft Excel determines the settings for saving new Web pages as Web archives and notifies the user.

VBA Copy code Copy code
Sub DetermineSettings()

 ' Determine settings and notify user.
 If Application.DefaultWebOptions.SaveNewWebPagesAsWebArchives = True Then
 MsgBox "New Web pages will be saved as Web archives."
 Else
 MsgBox "New Web pages will not be saved as Web archives."
 End If

End Sub

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.ScreenSize Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.ScreenSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.

Syntax

expression .ScreenSize

expression A variable that represents a DefaultWebOptions object.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.TargetBrowser Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.TargetBrowser Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.

Syntax

expression .TargetBrowser

expression A variable that represents a DefaultWebOptions object.

Remarks

MsoTargetBrowser can be one of these MsoTargetBrowser constants.

msoTargetBrowserIE4 . Microsoft Internet Explorer 4.0 or later.

msoTargetBrowserIE5 . Microsoft Internet Explorer 5.0 or later.

msoTargetBrowserIE6 . Microsoft Internet Explorer 6.0 or later.

msoTargetBrowserV3 . Microsoft Internet Explorer 3.0, Netscape Navigator 3.0, or later.

msoTargetBrowserV4 . Microsoft Internet Explorer 4.0, Netscape Navigator 4.0, or later.

Example

In this example, Microsoft Excel determines if the browser version for Web options is IE5 and notifies the user.

VBA Copy code Copy code
Sub CheckWebOptions()

    Dim wkbOne As Workbook

    Set wkbOne = Application.Workbooks(1)

    ' Determine if IE5 is the target browser.
    If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then
        MsgBox "The target browser is IE5 or later."
    Else
        MsgBox "The target browser is not IE5 or later."
    End If

End Sub

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.UpdateLinksOnSave Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.UpdateLinksOnSave Property (Excel)
See also Send feedback

Published: July 16, 2012

True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page, ensuring that the links are up-to-date at the time the document is saved. False if the links are not updated. The default value is True. Read/write Boolean.

Syntax

expression .UpdateLinksOnSave

expression A variable that represents a DefaultWebOptions object.

Remarks

You should set this property to False if the location where the document is saved is different from the final location on the Web server and the supporting files are not available at the first location.

Example

This example specifies that links are not updated before the document is saved.

VBA Copy code Copy code
Application.DefaultWebOptions.UpdateLinksOnSave = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.UseLongFileNames Property (Excel)

 Copy code hover
[image]

DefaultWebOptions.UseLongFileNames Property (Excel)
See also Send feedback

Published: July 16, 2012

True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.

Syntax

expression .UseLongFileNames

expression A variable that represents a DefaultWebOptions object.

Remarks

If you don't use long file names and your document has supporting files, Microsoft Excel automatically organizes those files in a separate folder. Otherwise, use the OrganizeInFolder property to determine whether supporting files are organized in a separate folder.

Example

This example disallows the use of long file names as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.UseLongFileNames = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


Dialog Object (Excel)

 Copy code hover
[image]

Dialog Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a built-in Microsoft Excel dialog box.

Remarks

The Dialog object is a member of the Dialogs collection. The Dialogs collection contains all the built-in dialog boxes in Microsoft Excel. You cannot create a new built-in dialog box or add one to the collection. The only useful thing you can do with a Dialog object is use it with the Show method to display the corresponding dialog box.

The Microsoft Excel Visual Basic object library includes built-in constants for many of the built-in dialog boxes. Each constant is formed from the prefix "xlDialog" followed by the name of the dialog box. For example, the Apply Names dialog box constant is xlDialogApplyNames, and the Find File dialog box constant is xlDialogFindFile. These constants are members of the XlBuiltinDialog enumerated type.

Example

Use Dialogs(index), where index is a built-in constant identifying the dialog box, to return a single Dialog object. The following example runs the built-in Open dialog box (File menu). The Show method returns True if Microsoft Excel successfully opens a file; it returns False if the user cancels the dialog box.

VBA Copy code Copy code
dlgAnswer = Application.Dialogs(xlDialogOpen).Show

See also

Concepts

Excel Object Model Reference

Other resources

Dialog Object Members


Dialog Members (Excel)

 Copy code hover
[image]

Dialog Members (Excel)
Send feedback

Published: July 16, 2012

Represents a built-in Microsoft Excel dialog box.

Methods

Name | Description
Show | Displays the built-in dialog box, waits for the user to input data and returns a Boolean value that represents the user's response.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Dialog Properties (Excel)

 Copy code hover
[image]

Dialog Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Dialog.Application Property (Excel)

 Copy code hover
[image]

Dialog.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Dialog object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Creator Property (Excel)

 Copy code hover
[image]

Dialog.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Dialog object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Parent Property (Excel)

 Copy code hover
[image]

Dialog.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Dialog object.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog Methods (Excel)

 Copy code hover
[image]

Dialog Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Show | Displays the built-in dialog box, waits for the user to input data and returns a Boolean value that represents the user's response.


Dialog.Show Method (Excel)

 Copy code hover
[image]

Dialog.Show Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the built-in dialog box, waits for the user to input data and returns a Boolean value that represents the user's response.

Syntax

expression .Show(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a Dialog object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1-Arg30 | Optional | Variant | For built-in dialog boxes only, the initial arguments for the command. For more information, see the "Remarks" section.

Return Value

A Boolean value that, for built-in dialog boxes, returns True if the user clicks OK, or it returns False if the user clicks Cancel.

Remarks

For built in dialog boxes, this method returns True if the user clicks OK, or it returns False if the user clicks Cancel.

You can use a single dialog box to change many properties at the same time. For example, you can use the Format Cells dialog box to change all the properties of the Font object.

For some built-in dialog boxes (the Open dialog box, for example), you can set initial values using arg1, arg2, ..., arg30. To find the arguments to set, locate the corresponding dialog box constant in Built-In Dialog Box Argument Lists. For example, search for the xlDialogOpen constant to find the arguments for the Open dialog box. For more information about built-in dialog boxes, see the Dialogs collection.

Example

This example displays the Open dialog box.

VBA Copy code Copy code
Application.Dialogs(xlDialogOpen).Show

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialogs Object (Excel)

 Copy code hover
[image]

Dialogs Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Dialog objects in Microsoft Excel.

Remarks

Each Dialog object represents a built-in dialog box. You cannot create a new built-in dialog box or add one to the collection. The only useful thing you can do with a Dialog object is use it with the Show method to display the dialog corresponding dialog box.

The Microsoft Excel Visual Basic object library includes built-in constants for many of the built-in dialog boxes. Each constant is formed from the prefix "xlDialog" followed by the name of the dialog box. For example, the Apply Names dialog box constant is xlDialogApplyNames, and the Find File dialog box constant is xlDialogFindFile. These constants are members of the XlBuiltinDialog enumerated type.

Example

Use the Dialogs property to return the Dialogs collection. The following code example displays the number of available built-in Microsoft Excel dialog boxes.

VBA Copy code Copy code
MsgBox Application.Dialogs.Count

Use Dialogs(index), where index is a built-in constant identifying the dialog box, to return a single Dialog object. The following example runs the built-in File Open dialog box.

VBA Copy code Copy code
dlgAnswer = Application.Dialogs(xlDialogOpen).Show

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example opens an e-mail message in Microsoft Outlook with the current workbook attached.

VBA Copy code Copy code
Sub SendIt()
    Application.Dialogs(xlDialogSendMail).Show arg1:="ask@mrexcel.com", arg2:="This goes in the subject line"
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Excel Object Model Reference

Other resources

Dialogs Object Members


Dialogs Members (Excel)

 Copy code hover
[image]

Dialogs Members (Excel)
Send feedback

A collection of all the Dialog objects in Microsoft Excel.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Dialogs Properties (Excel)

 Copy code hover
[image]

Dialogs Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Dialogs.Application Property (Excel)

 Copy code hover
[image]

Dialogs.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Dialogs object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Dialogs Object

Other resources

Dialogs Object Members


Dialogs.Count Property (Excel)

 Copy code hover
[image]

Dialogs.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Dialogs object.

See also

Concepts

Dialogs Object

Other resources

Dialogs Object Members


Dialogs.Creator Property (Excel)

 Copy code hover
[image]

Dialogs.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Dialogs object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Dialogs Object

Other resources

Dialogs Object Members


Dialogs.Item Property (Excel)

 Copy code hover
[image]

Dialogs.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Dialogs object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | XlBuiltInDialog | Variant. The name or index number of the object.

Example

This example displays the Open dialog box and selects the Read-Only option.

Copy code Copy code
Application.Dialogs.Item(xlDialogOpen).Show arg3:=True

See also

Concepts

Dialogs Object

Other resources

Dialogs Object Members


Dialogs.Parent Property (Excel)

 Copy code hover
[image]

Dialogs.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Dialogs object.

See also

Concepts

Dialogs Object

Other resources

Dialogs Object Members


DialogSheetView Object (Excel)

 Copy code hover
[image]

DialogSheetView Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the current Dialog sheet view in a workbook.

Remarks

To access this object, you must have a dialog sheet that was developed in the active workbook. Without the dialog sheet, the view properties for the object return an empty string value.

Example

The following example turns on the dialog sheet view for the active workbook.

VBA Copy code Copy code
Worksheets("Sheet1").DialogSheetView.Visible = True

See also

Concepts

Excel Object Model Reference

Other resources

DialogSheetView Object Members


DialogSheetView Members (Excel)

 Copy code hover
[image]

DialogSheetView Members (Excel)
Send feedback

Published: July 16, 2012

Represents the current Dialog sheet view in a workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified DialogSheetView object. Read-only.


DialogSheetView Properties (Excel)

 Copy code hover
[image]

DialogSheetView Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified DialogSheetView object. Read-only.


DialogSheetView.Application Property (Excel)

 Copy code hover
[image]

DialogSheetView.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a DialogSheetView object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

DialogSheetView Object

Other resources

DialogSheetView Object Members


DialogSheetView.Creator Property (Excel)

 Copy code hover
[image]

DialogSheetView.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DialogSheetView object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DialogSheetView Object

Other resources

DialogSheetView Object Members


DialogSheetView.Parent Property (Excel)

 Copy code hover
[image]

DialogSheetView.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a DialogSheetView object.

See also

Concepts

DialogSheetView Object

Other resources

DialogSheetView Object Members


DialogSheetView.Sheet Property (Excel)

 Copy code hover
[image]

DialogSheetView.Sheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sheet name for the specified DialogSheetView object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Sheet

expression A variable that represents a DialogSheetView object.

See also

Concepts

DialogSheetView Object

Other resources

DialogSheetView Object Members


DisplayFormat Object (Excel)

 Copy code hover
[image]

DisplayFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the display settings for an associated Range object. Read only.

Version Information

Version Added: Excel 2010

Remarks

Actions such as changing the conditional formatting or table style of a range can cause what is displayed in the current user interface to be inconsistent with the values in the corresponding properties of the Range object. Use the properties of the DisplayFormat object to return the values as they are displayed in the current user interface.

See also

Concepts

Excel Object Model Reference

Other resources

DisplayFormat Object Members


DisplayFormat Members (Excel)

 Copy code hover
[image]

DisplayFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents the display settings for an associated Range object. Read only.

Properties

Name | Description
AddIndent | Returns a value that indicates if Microsoft Excel automatically indents text of the associated Range object when the text alignment in a cell is set to equal distribution (either horizontally or vertically), as it is displayed in the current user interface. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Borders | Returns a Borders object that represents the borders of the associated Range object as it is displayed in the current user interface. Read-only.
Characters | Returns a Characters object that represents a range of characters within the text of the associated Range object as it is displayed in the current user interface. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the associated Range as it is displayed in the current user interface. Read-only.
FormulaHidden | Returns a value that indicates if the formula of the associated Range object is hidden when the worksheet is protected as it is displayed in the current user interface. Read-only.
HorizontalAlignment | Returns a value that represents the horizontal alignment of the associated Range object as it is displayed in the current user interface. Read-only.
IndentLevel | Returns a value that represents the indent level of the associated Range object as it is displayed in the current user interface. Read-only.
Interior | Returns an Interior object that represents the interior of the associated Range object as it is displayed in the current user interface. Read-only.
Locked | Returns a value that indicates if the associated Range object is locked as it is displayed in the current user interface. Read-only.
MergeCells | Returns a value that indicates if the associated Range object contains merged cells as it is displayed in the current user interface. Read-only.
NumberFormat | Returns a value that represents the format code of the associated Range object as it is displayed in the current user interface. Read-only.
NumberFormatLocal | Returns a value that represents the format code of the associated Range as a string in the language of the user as it is displayed in the current user interface. Read-only.
Orientation | Returns a value that represents the text orientation of the associated Range object as it is displayed in the current user interface. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns the reading order of the associated Range object as it is displayed in the current user interface. Read-only.
ShrinkToFit | Returns a value that indicates if Microsoft Excel automatically shrinks text to fit in the available column width of the associated Range object as it is displayed in the current user interface. Read-only.
Style | Returns a value, containing a Style object, that represents the style of the associated Range object as it is displayed in the current user interface.
VerticalAlignment | Returns a value that represents the vertical alignment of the associated Range object as it is displayed in the current user interface. Read-only.
WrapText | Returns a value that indicates if Microsoft Excel wraps the text of the associated Range object as it is displayed in the current user interface. Read-only.


DisplayFormat Properties (Excel)

 Copy code hover
[image]

DisplayFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddIndent | Returns a value that indicates if Microsoft Excel automatically indents text of the associated Range object when the text alignment in a cell is set to equal distribution (either horizontally or vertically), as it is displayed in the current user interface. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Borders | Returns a Borders object that represents the borders of the associated Range object as it is displayed in the current user interface. Read-only.
Characters | Returns a Characters object that represents a range of characters within the text of the associated Range object as it is displayed in the current user interface. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the associated Range as it is displayed in the current user interface. Read-only.
FormulaHidden | Returns a value that indicates if the formula of the associated Range object is hidden when the worksheet is protected as it is displayed in the current user interface. Read-only.
HorizontalAlignment | Returns a value that represents the horizontal alignment of the associated Range object as it is displayed in the current user interface. Read-only.
IndentLevel | Returns a value that represents the indent level of the associated Range object as it is displayed in the current user interface. Read-only.
Interior | Returns an Interior object that represents the interior of the associated Range object as it is displayed in the current user interface. Read-only.
Locked | Returns a value that indicates if the associated Range object is locked as it is displayed in the current user interface. Read-only.
MergeCells | Returns a value that indicates if the associated Range object contains merged cells as it is displayed in the current user interface. Read-only.
NumberFormat | Returns a value that represents the format code of the associated Range object as it is displayed in the current user interface. Read-only.
NumberFormatLocal | Returns a value that represents the format code of the associated Range as a string in the language of the user as it is displayed in the current user interface. Read-only.
Orientation | Returns a value that represents the text orientation of the associated Range object as it is displayed in the current user interface. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns the reading order of the associated Range object as it is displayed in the current user interface. Read-only.
ShrinkToFit | Returns a value that indicates if Microsoft Excel automatically shrinks text to fit in the available column width of the associated Range object as it is displayed in the current user interface. Read-only.
Style | Returns a value, containing a Style object, that represents the style of the associated Range object as it is displayed in the current user interface.
VerticalAlignment | Returns a value that represents the vertical alignment of the associated Range object as it is displayed in the current user interface. Read-only.
WrapText | Returns a value that indicates if Microsoft Excel wraps the text of the associated Range object as it is displayed in the current user interface. Read-only.


DisplayFormat.AddIndent Property (Excel)

 Copy code hover
[image]

DisplayFormat.AddIndent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if Microsoft Excel automatically indents text of the associated Range object when the text alignment in a cell is set to equal distribution (either horizontally or vertically), as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .AddIndent

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if text is automatically indented when the text alignment in the cell is set, either horizontally or vertically, to equal distribution.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Application Property (Excel)

 Copy code hover
[image]

DisplayFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a DisplayFormat object.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Borders Property (Excel)

 Copy code hover
[image]

DisplayFormat.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders object that represents the borders of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Borders

expression A variable that represents a DisplayFormat object.

Return Value

Borders

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Characters Property (Excel)

 Copy code hover
[image]

DisplayFormat.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the text of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Characters(Start, Length)

expression A variable that represents a DisplayFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Return Value

Characters

Remarks

The Characters object is not a collection.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Creator Property (Excel)

 Copy code hover
[image]

DisplayFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DisplayFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Font Property (Excel)

 Copy code hover
[image]

DisplayFormat.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the associated Range as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Font

expression A variable that represents a DisplayFormat object.

Return Value

Font

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.FormulaHidden Property (Excel)

 Copy code hover
[image]

DisplayFormat.FormulaHidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if the formula of the associated Range object is hidden when the worksheet is protected as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaHidden

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if the formula is hidden when the worksheet is protected, Null if the range contains some cells with FormulaHidden equal to True and some cells with FormulaHidden equal to False.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

DisplayFormat.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the horizontal alignment of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .HorizontalAlignment

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.IndentLevel Property (Excel)

 Copy code hover
[image]

DisplayFormat.IndentLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the indent level of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .IndentLevel

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Interior Property (Excel)

 Copy code hover
[image]

DisplayFormat.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Interior

expression A variable that represents a DisplayFormat object.

Return Value

Interior

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Locked Property (Excel)

 Copy code hover
[image]

DisplayFormat.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if the associated Range object is locked as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Locked

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if the range is locked, False if the range can be modified when the sheet is protected, or Null if the range contains both locked and unlocked cells.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.MergeCells Property (Excel)

 Copy code hover
[image]

DisplayFormat.MergeCells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if the associated Range object contains merged cells as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .MergeCells

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if the range contains merged cells.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.NumberFormat Property (Excel)

 Copy code hover
[image]

DisplayFormat.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the format code of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .NumberFormat

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

This property returns Null if all cells in the specified range do not have the same number format.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

DisplayFormat.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the format code of the associated Range as a string in the language of the user as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .NumberFormatLocal

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Orientation Property (Excel)

 Copy code hover
[image]

DisplayFormat.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the text orientation of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Orientation

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Parent Property (Excel)

 Copy code hover
[image]

DisplayFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a DisplayFormat object.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.ReadingOrder Property (Excel)

 Copy code hover
[image]

DisplayFormat.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the reading order of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .ReadingOrder

expression A variable that represents a DisplayFormat object.

Return Value

Long

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.ShrinkToFit Property (Excel)

 Copy code hover
[image]

DisplayFormat.ShrinkToFit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if Microsoft Excel automatically shrinks text to fit in the available column width of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .ShrinkToFit

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if text automatically shrinks to fit in the available column width.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.Style Property (Excel)

 Copy code hover
[image]

DisplayFormat.Style Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value, containing a Style object, that represents the style of the associated Range object as it is displayed in the current user interface.

Version Information

Version Added: Excel 2010

Syntax

expression .Style

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.VerticalAlignment Property (Excel)

 Copy code hover
[image]

DisplayFormat.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the vertical alignment of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .VerticalAlignment

expression A variable that represents a DisplayFormat object.

Return Value

Variant

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayFormat.WrapText Property (Excel)

 Copy code hover
[image]

DisplayFormat.WrapText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates if Microsoft Excel wraps the text of the associated Range object as it is displayed in the current user interface. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .WrapText

expression A variable that represents a DisplayFormat object.

Return Value

Variant

Remarks

Returns True if text is wrapped in all cells within the range.

See also

Concepts

DisplayFormat Object

Other resources

DisplayFormat Object Members


DisplayUnitLabel Object (Excel)

 Copy code hover
[image]

DisplayUnitLabel Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a unit label on an axis in the specified chart.

Remarks

Unit labels are useful for charting large values—for example, in the millions or billions. You can make the chart more readable by using a single unit label instead of large numbers at each tick mark.

Example

Use the DisplayUnitLabel property to return the DisplayUnitLabel object. The following example sets the display label caption to "Millions" on the value axis in Chart1, and then it turns off automatic font scaling.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlValue)
 .DisplayUnit = xlMillions
 .HasDisplayUnitLabel = True
 With .DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
 End With
End With

See also

Concepts

Excel Object Model Reference

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel Members (Excel)

 Copy code hover
[image]

DisplayUnitLabel Members (Excel)
Send feedback

Published: July 16, 2012

Represents a unit label on an axis in the specified chart.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the display unit label text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


DisplayUnitLabel Properties (Excel)

 Copy code hover
[image]

DisplayUnitLabel Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the display unit label text.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.
FormulaR1C1 | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.
FormulaR1C1Local | Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets a Variant value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns the width, in points, of the object. Read-only.


DisplayUnitLabel.Application Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DisplayUnitLabel object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Caption Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Caption Property (Excel)
See also Send feedback

Returns or sets a String value that represents the display unit label text.

Syntax

expression .Caption

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Characters Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Syntax

expression .Characters(Start, Length)

expression A variable that represents a DisplayUnitLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The Characters object isn't a collection.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Creator Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DisplayUnitLabel object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Format Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Formula Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Formula

expression A variable that represents a DisplayUnitLabel object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaLocal Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaLocal

expression A variable that represents a DisplayUnitLabel object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in English. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a DisplayUnitLabel object.

Return Value

String

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a DisplayUnitLabel object.

Return Value

String

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Height Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a DisplayUnitLabel object.

Return Value

Double

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a DisplayUnitLabel object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Left Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Name Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Orientation Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a DisplayUnitLabel object.

Remarks

The value of this property can be an integer value from -90 to 90 degrees or one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Parent Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Position Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.ReadingOrder Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Shadow Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Text Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Top Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.VerticalAlignment Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a DisplayUnitLabel object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Width Property (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a DisplayUnitLabel object.

Return Value

Double

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel Methods (Excel)

 Copy code hover
[image]

DisplayUnitLabel Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DisplayUnitLabel.Delete Method (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DisplayUnitLabel object.

Return Value

Variant

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Select Method (Excel)

 Copy code hover
[image]

DisplayUnitLabel.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a DisplayUnitLabel object.

Return Value

Variant

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DownBars Object (Excel)

 Copy code hover
[image]

DownBars Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the down bars in a chart group.

Remarks

Down bars connect points on the first series in the chart group with lower values on the last series (the lines go down from the first series). Only 2-D line groups that contain at least two series can have down bars. This object isn't a collection. There's no object that represents a single down bar; you either have up bars and down bars turned on for all points in a chart group or you have them turned off.

If the HasUpDownBars property is False, most properties of the DownBars object are disabled.

Example

Use the DownBars property to return the DownBars object. The following example turns on up and down bars for chart group one in embedded chart one on the worksheet named "Sheet5." The example then sets the up bar color to blue and the down bar color to red.

VBA Copy code Copy code
With Worksheets("sheet5").ChartObjects(1).Chart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
End With

See also

Concepts

Excel Object Model Reference

Other resources

DownBars Object Members


DownBars Members (Excel)

 Copy code hover
[image]

DownBars Members (Excel)
Send feedback

Published: July 16, 2012

Represents the down bars in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


DownBars Properties (Excel)

 Copy code hover
[image]

DownBars Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


DownBars.Application Property (Excel)

 Copy code hover
[image]

DownBars.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DownBars object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Creator Property (Excel)

 Copy code hover
[image]

DownBars.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DownBars object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Format Property (Excel)

 Copy code hover
[image]

DownBars.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Name Property (Excel)

 Copy code hover
[image]

DownBars.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Parent Property (Excel)

 Copy code hover
[image]

DownBars.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars Methods (Excel)

 Copy code hover
[image]

DownBars Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DownBars.Delete Method (Excel)

 Copy code hover
[image]

DownBars.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DownBars object.

Return Value

Variant

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Select Method (Excel)

 Copy code hover
[image]

DownBars.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a DownBars object.

Return Value

Variant

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DropLines Object (Excel)

 Copy code hover
[image]

DropLines Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the drop lines in a chart group.

Remarks

Drop lines connect the points in the chart with the x-axis. Only line and area chart groups can have drop lines. This object isn't a collection. There's no object that represents a single drop line; you either have drop lines turned on for all points in a chart group or you have them turned off.

If the HasDropLines property is False, most properties of the DropLines object are disabled.

Example

Use the DropLines property to return the DropLines object. The following example turns on drop lines for chart group one in embedded chart one and then sets the drop line color to red.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Activate
ActiveChart.ChartGroups(1).HasDropLines = True
ActiveChart.ChartGroups(1).DropLines.Border.ColorIndex = 3

See also

Concepts

Excel Object Model Reference

Other resources

DropLines Object Members


DropLines Members (Excel)

 Copy code hover
[image]

DropLines Members (Excel)
Send feedback

Published: July 16, 2012

Represents the drop lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


DropLines Properties (Excel)

 Copy code hover
[image]

DropLines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


DropLines.Application Property (Excel)

 Copy code hover
[image]

DropLines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a DropLines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Border Property (Excel)

 Copy code hover
[image]

DropLines.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Creator Property (Excel)

 Copy code hover
[image]

DropLines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a DropLines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Format Property (Excel)

 Copy code hover
[image]

DropLines.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Name Property (Excel)

 Copy code hover
[image]

DropLines.Name Property (Excel)
See also Send feedback

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Parent Property (Excel)

 Copy code hover
[image]

DropLines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines Methods (Excel)

 Copy code hover
[image]

DropLines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DropLines.Delete Method (Excel)

 Copy code hover
[image]

DropLines.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a DropLines object.

Return Value

Variant

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Select Method (Excel)

 Copy code hover
[image]

DropLines.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a DropLines object.

Return Value

Variant

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


Error Object (Excel)

 Copy code hover
[image]

Error Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a spreadsheet error for a range.

Remarks

Use the Item property of the Errors object to return an Error object.

Once an Error object is returned, you can use the Value property, in conjunction with the Errors property to check whether a particular error checking option is enabled.

Note Note

Be careful not to confuse the Error object with error handling features of Visual Basic.

Example

The following example creates a formula in cell A1 referencing empty cells, and then it uses Item(index), where index identifies the error type, to display a message stating the situation.

VBA Copy code Copy code
Sub CheckEmptyCells()

 Dim rngFormula As Range
 Set rngFormula = Application.Range("A1")

 ' Place a formula referencing empty cells.
 Range("A1").Formula = "=A2+A3"
 Application.ErrorCheckingOptions.EmptyCellReferences = True

 ' Perform check to see if EmptyCellReferences check is on.
 If rngFormula.Errors.Item(xlEmptyCellReferences).Value = True Then
 MsgBox "The empty cell references error checking feature is enabled."
 Else
 MsgBox "The empty cell references error checking feature is not on."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Error Object Members


Error Members (Excel)

 Copy code hover
[image]

Error Members (Excel)
Send feedback

Published: July 16, 2012

Represents a spreadsheet error for a range.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Ignore | Allows the user to set or return the state of an error checking option for a range. False enables an error checking option for a range. True disables an error checking option for a range. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Value | Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).


Error Properties (Excel)

 Copy code hover
[image]

Error Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Ignore | Allows the user to set or return the state of an error checking option for a range. False enables an error checking option for a range. True disables an error checking option for a range. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Value | Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).


Error.Application Property (Excel)

 Copy code hover
[image]

Error.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Error object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Error Object

Other resources

Error Object Members


Error.Creator Property (Excel)

 Copy code hover
[image]

Error.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Error object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Error Object

Other resources

Error Object Members


Error.Ignore Property (Excel)

 Copy code hover
[image]

Error.Ignore Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows the user to set or return the state of an error checking option for a range. False enables an error checking option for a range. True disables an error checking option for a range. Read/write Boolean.

Syntax

expression .Ignore

expression A variable that represents an Error object.

Remarks

Reference the ErrorCheckingOptions object to view a list of index values associated with error checking options.

Example

This example disables the ignore flag in cell A1 for checking empty cell references.

VBA Copy code Copy code
Sub IgnoreChecking()

 Range("A1").Select

 ' Determine if empty cell references error checking is on, if not turn it on.
 If Application.Range("A1").Errors(xlEmptyCellReferences).Ignore = True Then
 Application.Range("A1").Errors(xlEmptyCellReferences).Ignore = False
 MsgBox "Empty cell references error checking has been enabled for cell A1."
 Else
 MsgBox "Empty cell references error checking is already enabled for cell A1."
 End If

End Sub

See also

Concepts

Error Object

Other resources

Error Object Members


Error.Parent Property (Excel)

 Copy code hover
[image]

Error.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Error object.

See also

Concepts

Error Object

Other resources

Error Object Members


Error.Value Property (Excel)

 Copy code hover
[image]

Error.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).

Syntax

expression .Value

expression A variable that represents an Error object.

See also

Concepts

Error Object

Other resources

Error Object Members


ErrorBars Object (Excel)

 Copy code hover
[image]

ErrorBars Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the error bars on a chart series.

Remarks

Error bars indicate the degree of uncertainty for chart data. Only series in area, bar, column, line, and scatter groups on a 2-D chart can have error bars. Only series in scatter groups can have x and y error bars. This object isn't a collection. There's no object that represents a single error bar; you either have x error bars or y error bars turned on for all points in a series or you have them turned off.

The ErrorBar method changes the error bar format and type.

Example

Use the ErrorBars property to return the ErrorBars object. The following example turns on error bars for series one in embedded chart one and then sets the end style for the error bars.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Activate
ActiveChart.SeriesCollection(1).HasErrorBars = True
ActiveChart.SeriesCollection(1).ErrorBars.EndStyle = xlNoCap

See also

Concepts

Excel Object Model Reference

Other resources

ErrorBars Object Members


ErrorBars Members (Excel)

 Copy code hover
[image]

ErrorBars Members (Excel)
Send feedback

Published: July 16, 2012

Represents the error bars on a chart series.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EndStyle | Returns or sets the end style for the error bars. Can be one of the following XlEndStyleCap constants: xlCap or xlNoCap. Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


ErrorBars Properties (Excel)

 Copy code hover
[image]

ErrorBars Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EndStyle | Returns or sets the end style for the error bars. Can be one of the following XlEndStyleCap constants: xlCap or xlNoCap. Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


ErrorBars.Application Property (Excel)

 Copy code hover
[image]

ErrorBars.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an ErrorBars object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Border Property (Excel)

 Copy code hover
[image]

ErrorBars.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Creator Property (Excel)

 Copy code hover
[image]

ErrorBars.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an ErrorBars object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.EndStyle Property (Excel)

 Copy code hover
[image]

ErrorBars.EndStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the end style for the error bars. Can be one of the following XlEndStyleCap constants: xlCap or xlNoCap. Read/write Long.

Syntax

expression .EndStyle

expression A variable that represents an ErrorBars object.

Example

This example sets the end style for the error bars for series one in Chart1. The example should be run on a 2-D line chart that has Y error bars for the first series.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).ErrorBars.EndStyle = xlCap

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Format Property (Excel)

 Copy code hover
[image]

ErrorBars.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Name Property (Excel)

 Copy code hover
[image]

ErrorBars.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Parent Property (Excel)

 Copy code hover
[image]

ErrorBars.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars Methods (Excel)

 Copy code hover
[image]

ErrorBars Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.


ErrorBars.ClearFormats Method (Excel)

 Copy code hover
[image]

ErrorBars.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents an ErrorBars object.

Return Value

Variant

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Delete Method (Excel)

 Copy code hover
[image]

ErrorBars.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an ErrorBars object.

Return Value

Variant

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Select Method (Excel)

 Copy code hover
[image]

ErrorBars.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents an ErrorBars object.

Return Value

Variant

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorCheckingOptions Object (Excel)

 Copy code hover
[image]

ErrorCheckingOptions Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the error-checking options for an application.

Remarks

Use the ErrorCheckingOptions property of the Application object to return an ErrorCheckingOptions object.

Reference the Item property of the Errors object to view a list of index values associated with error-checking options.

Once an ErrorCheckingOptions object is returned, you can use the following properties, which are members of the ErrorCheckingOptions object, to set or return error checking options.

  • BackgroundChecking

  • EmptyCellReferences

  • EvaluateToError

  • InconsistentFormula

  • IndicatorColorIndex

  • NumberAsText

  • OmittedCells

  • TextDate

  • UnlockedFormulaCells

Example

The following example uses the TextDate property to enable error checking for two-digit-year text dates and notifies the user.

VBA Copy code Copy code
Sub CheckTextDates()

 Dim rngFormula As Range
 Set rngFormula = Application.Range("A1")

 Range("A1").Formula = "'April 23, 00"
 Application.ErrorCheckingOptions.TextDate = True

 ' Perform check to see if 2 digit year TextDate check is on.
 If rngFormula.Errors.Item(xlTextDate).Value = True Then
 MsgBox "The text date error checking feature is enabled."
 Else
 MsgBox "The text date error checking feature is not on."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions Members (Excel)

 Copy code hover
[image]

ErrorCheckingOptions Members (Excel)
Send feedback

Published: July 16, 2012

Represents the error-checking options for an application.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundChecking | Alerts the user for all cells that violate enabled error-checking rules. When this property is set to True (default), the AutoCorrect Options button appears next to all cells that violate enabled errors. False disables background checking for errors. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EmptyCellReferences | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells containing formulas that refer to empty cells. False disables empty cell reference checking. Read/write Boolean.
EvaluateToError | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain formulas evaluating to an error. False disables error checking for cells that evaluate to an error value. Read/write Boolean.
InconsistentFormula | When set to True (default), Microsoft Excel identifies cells containing an inconsistent formula in a region. False disables the inconsistent formula check. Read/write Boolean.
InconsistentTableFormula | Returns True if the table formula is inconsistent. Read/write Boolean.
IndicatorColorIndex | Returns or sets the color of the indicator for error checking options. Read/write XlColorIndex.
ListDataValidation | A Boolean value that is True if data validation is enabled in a list. Read/write Boolean.
NumberAsText | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain numbers written as text. False disables error checking for numbers written as text. Read/write Boolean.
OmittedCells | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, the selected cells that contain formulas referring to a range that omits adjacent cells that could be included. False disables error checking for omitted cells. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
TextDate | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, cells that contain a text date with a two-digit year. False disables error checking for cells containing a text date with a two-digit year. Read/write Boolean.
UnlockedFormulaCells | When set to True (default), Microsoft Excel identifies selected cells that are unlocked and contain a formula. False disables error checking for unlocked cells that contain formulas. Read/write Boolean.


ErrorCheckingOptions Properties (Excel)

 Copy code hover
[image]

ErrorCheckingOptions Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundChecking | Alerts the user for all cells that violate enabled error-checking rules. When this property is set to True (default), the AutoCorrect Options button appears next to all cells that violate enabled errors. False disables background checking for errors. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EmptyCellReferences | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells containing formulas that refer to empty cells. False disables empty cell reference checking. Read/write Boolean.
EvaluateToError | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain formulas evaluating to an error. False disables error checking for cells that evaluate to an error value. Read/write Boolean.
InconsistentFormula | When set to True (default), Microsoft Excel identifies cells containing an inconsistent formula in a region. False disables the inconsistent formula check. Read/write Boolean.
InconsistentTableFormula | Returns True if the table formula is inconsistent. Read/write Boolean.
IndicatorColorIndex | Returns or sets the color of the indicator for error checking options. Read/write XlColorIndex.
ListDataValidation | A Boolean value that is True if data validation is enabled in a list. Read/write Boolean.
NumberAsText | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain numbers written as text. False disables error checking for numbers written as text. Read/write Boolean.
OmittedCells | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, the selected cells that contain formulas referring to a range that omits adjacent cells that could be included. False disables error checking for omitted cells. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
TextDate | When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, cells that contain a text date with a two-digit year. False disables error checking for cells containing a text date with a two-digit year. Read/write Boolean.
UnlockedFormulaCells | When set to True (default), Microsoft Excel identifies selected cells that are unlocked and contain a formula. False disables error checking for unlocked cells that contain formulas. Read/write Boolean.


ErrorCheckingOptions.Application Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an ErrorCheckingOptions object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.BackgroundChecking Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.BackgroundChecking Property (Excel)
See also Send feedback

Published: July 16, 2012

Alerts the user for all cells that violate enabled error-checking rules. When this property is set to True (default), the AutoCorrect Options button appears next to all cells that violate enabled errors. False disables background checking for errors. Read/write Boolean.

Syntax

expression .BackgroundChecking

expression A variable that represents an ErrorCheckingOptions object.

Remarks

Refer to the ErrorCheckingOptions object to view a list of its members that can be enabled.

Example

In the following example, when the user selects cell A1 (which contains a formula referring to empty cells), the AutoCorrect Options button appears.

VBA Copy code Copy code
Sub CheckBackground()

 ' Simulate an error by referring to empty cells.
 Application.ErrorCheckingOptions.BackgroundChecking = True
 Range("A1").Select
 ActiveCell.Formula = "=A2/A3"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.Creator Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an ErrorCheckingOptions object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.EmptyCellReferences Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.EmptyCellReferences Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells containing formulas that refer to empty cells. False disables empty cell reference checking. Read/write Boolean.

Syntax

expression .EmptyCellReferences

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A1 which contains a formula that references empty cells.

VBA Copy code Copy code
Sub CheckEmptyCells()

 Application.ErrorCheckingOptions.EmptyCellReferences = True
 Range("A1").Formula = "=A2+A3"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.EvaluateToError Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.EvaluateToError Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain formulas evaluating to an error. False disables error checking for cells that evaluate to an error value. Read/write Boolean.

Syntax

expression .EvaluateToError

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A3, which contains a divide-by-zero error.

VBA Copy code Copy code
Sub CheckEvaluationError()

 ' Simulate a divide-by-zero error.
 Application.ErrorCheckingOptions.EvaluateToError = True
 Range("A1").Value = 1
 Range("A2").Value = 0
 Range("A3").Formula = "=A1/A2"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.InconsistentFormula Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.InconsistentFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies cells containing an inconsistent formula in a region. False disables the inconsistent formula check. Read/write Boolean.

Syntax

expression .InconsistentFormula

expression A variable that represents an ErrorCheckingOptions object.

Remarks

Consistent formulas in the region must reside to the left and right or above and below the cell containing the inconsistent formula for the InconsistentFormula property to work properly.

Example

In the following example, when the user selects cell B4 (which contains an inconsistent formula), the AutoCorrect Options button appears.

VBA Copy code Copy code
Sub CheckFormula()

 Application.ErrorCheckingOptions.InconsistentFormula = True

 Range("A1:A3").Value = 1
 Range("B1:B3").Value = 2
 Range("C1:C3").Value = 3

 Range("A4").Formula = "=SUM(A1:A3)" ' Consistent formula.
 Range("B4").Formula = "=SUM(B1:B2)" ' Inconsistent formula.
 Range("C4").Formula = "=SUM(C1:C3)" ' Consistent formula.

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.InconsistentTableFormula Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.InconsistentTableFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the table formula is inconsistent. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .InconsistentTableFormula

expression A variable that represents an ErrorCheckingOptions object.

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.IndicatorColorIndex Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.IndicatorColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the indicator for error checking options. Read/write XlColorIndex.

Syntax

expression .IndicatorColorIndex

expression A variable that represents an ErrorCheckingOptions object.

Remarks

XlColorIndex can be one of these XlColorIndex constants.

xlColorIndexAutomatic The default system color.

xlColorIndexNone Not used with this property.

You can specify a particular color for the indicator by entering the corresponding index value. You can use the Colors property to return the current color palette.

Example

In the following example, Microsoft Excel checks to see if the indicator color for error checking is set to the default system color and notifies the user accordingly.

VBA Copy code Copy code
Sub CheckIndexColor()

 If Application.ErrorCheckingOptions.IndicatorColorIndex = xlColorIndexAutomatic Then
 MsgBox "Your indicator color for error checking is set to the default system color."
 Else
 MsgBox "Your indicator color for error checking is not set to the default system color."
 End If

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.ListDataValidation Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.ListDataValidation Property (Excel)
See also Send feedback

Published: July 16, 2012

A Boolean value that is True if data validation is enabled in a list. Read/write Boolean.

Syntax

expression .ListDataValidation

expression A variable that represents an ErrorCheckingOptions object.

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.NumberAsText Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.NumberAsText Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain numbers written as text. False disables error checking for numbers written as text. Read/write Boolean.

Syntax

expression .NumberAsText

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A1, which contains a number stored as text.

VBA Copy code Copy code
Sub CheckNumberAsText()

 ' Simulate an error by referencing a number stored as text.
 Application.ErrorCheckingOptions.NumberAsText = True
 Range("A1").Value = "'1"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.OmittedCells Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.OmittedCells Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, the selected cells that contain formulas referring to a range that omits adjacent cells that could be included. False disables error checking for omitted cells. Read/write Boolean.

Syntax

expression .OmittedCells

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A4, which contains a formula.

VBA Copy code Copy code
Sub CheckOmittedCells()

 Application.ErrorCheckingOptions.OmittedCells = True
 Range("A1").Value = 1
 Range("A2").Value = 2
 Range("A3").Value = 3
 Range("A4").Formula = "=Sum(A1:A2)"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.Parent Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an ErrorCheckingOptions object.

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.TextDate Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.TextDate Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, cells that contain a text date with a two-digit year. False disables error checking for cells containing a text date with a two-digit year. Read/write Boolean.

Syntax

expression .TextDate

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A1, which contains a text date with a two-digit year.

VBA Copy code Copy code
Sub CheckTextDate()

 ' Simulate an error by referencing a text date with a two-digit year.
 Application.ErrorCheckingOptions.TextDate = True
 Range("A1").Formula = "'April 23, 00"

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


ErrorCheckingOptions.UnlockedFormulaCells Property (Excel)

 Copy code hover
[image]

ErrorCheckingOptions.UnlockedFormulaCells Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), Microsoft Excel identifies selected cells that are unlocked and contain a formula. False disables error checking for unlocked cells that contain formulas. Read/write Boolean.

Syntax

expression .UnlockedFormulaCells

expression A variable that represents an ErrorCheckingOptions object.

Example

In the following example, the AutoCorrect Options button appears for cell A3, an unlocked cell containing a formula.

VBA Copy code Copy code
Sub CheckUnlockedCell()

 Application.ErrorCheckingOptions.UnlockedFormulaCells = True
 Range("A1").Value = 1
 Range("A2").Value = 2
 Range("A3").Formula = "=A1+A2"
 Range("A3").Locked = False

End Sub

See also

Concepts

ErrorCheckingOptions Object

Other resources

ErrorCheckingOptions Object Members


Errors Object (Excel)

 Copy code hover
[image]

Errors Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the various spreadsheet errors for a range.

Remarks

Use the Errors property of the Range object to return an Errors object.

Example

Once an Errors object is returned, you can use the Value property of the Error object to check for particular error-checking conditions. The following example places a number as text in cell A1 and then notifies the user when the value of cell A1 contains a number as text.

VBA Copy code Copy code
Sub ErrorValue()

 ' Place a number written as text in cell A1.
 Range("A1").Formula = "'1"

 If Range("A1").Errors.Item(xlNumberAsText).Value = True Then
 MsgBox "Cell A1 has a number as text."
 Else
 MsgBox "Cell A1 is a number."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Errors Object Members


Errors Members (Excel)

 Copy code hover
[image]

Errors Members (Excel)
Send feedback

Published: July 16, 2012

Represents the various spreadsheet errors for a range.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single member of the Error object.
Parent | Returns the parent object for the specified object. Read-only.


Errors Properties (Excel)

 Copy code hover
[image]

Errors Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single member of the Error object.
Parent | Returns the parent object for the specified object. Read-only.


Errors.Application Property (Excel)

 Copy code hover
[image]

Errors.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Errors object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Errors Object

Other resources

Errors Object Members


Errors.Creator Property (Excel)

 Copy code hover
[image]

Errors.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Errors object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Errors Object

Other resources

Errors Object Members


Errors.Item Property (Excel)

 Copy code hover
[image]

Errors.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single member of the Error object.

Syntax

expression .Item(Index)

expression A variable that represents an Errors object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index of the member.

Remarks

Index can also be one the following constants.

xlEvaluateToError The cell evaluates to an error value.

xlTextDate The cell contains a text date with 2 digit years.

xlNumberAsText The cell contains a number stored as text.

xlInconsistentFormula The cell contains an inconsistent formula for a region.

xlOmittedCells The cell contains a formula omitting a cell for a region.

xlUnlockedFormulaCells The cell which is unlocked contains a formula.

xlEmptyCellReferences The cell contains a formula referring to empty cells.

See also

Concepts

Errors Object

Other resources

Errors Object Members


Errors.Parent Property (Excel)

 Copy code hover
[image]

Errors.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Errors object.

See also

Concepts

Errors Object

Other resources

Errors Object Members


FileExportConverter Object (Excel)

 Copy code hover
[image]

FileExportConverter Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a file converter that is used to save files.

Version Information

Version Added: Excel 2007

Remarks

You cannot create a new file converter or add one to the FileExportConverters collection. FileExportConverter objects are added during installation of Microsoft Office or by installing supplemental file converters.

Example

Use FileExportConverters(Index), where Index is an integer, to return a single FileExportConverter object. The following example displays the extensions associated with the second Microsoft Excel worksheet converter in the collection.

VBA Copy code Copy code
MsgBox FileExportConverters(2).Extensions

The index number represents the position of the file converter in the FileExportConverters collection. The following example displays the description for the first file converter in the collection.

VBA Copy code Copy code
MsgBox FileExportConvters(1).Description

See also

Concepts

Excel Object Model Reference

Other resources

FileExportConverter Object Members


FileExportConverter Members (Excel)

 Copy code hover
[image]

FileExportConverter Members (Excel)
Send feedback

Published: July 16, 2012

Represents a file converter that is used to save files.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Description | Returns the description for the file converter. Read-only String.
Extensions | Returns the file name extensions associated with the specified FileExportConverter object. Read-only String.
FileFormat | Returns an integer that identifies the file format associated with the specified FileExportConverter object. Read-only.
Parent | Returns an Object that represents the parent object of the specified FileExportConverter object. Read-only.


FileExportConverter Properties (Excel)

 Copy code hover
[image]

FileExportConverter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Description | Returns the description for the file converter. Read-only String.
Extensions | Returns the file name extensions associated with the specified FileExportConverter object. Read-only String.
FileFormat | Returns an integer that identifies the file format associated with the specified FileExportConverter object. Read-only.
Parent | Returns an Object that represents the parent object of the specified FileExportConverter object. Read-only.


FileExportConverter.Application Property (Excel)

 Copy code hover
[image]

FileExportConverter.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a FileExportConverter object.

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverter.Creator Property (Excel)

 Copy code hover
[image]

FileExportConverter.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a FileExportConverter object.

Remarks

If the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL". The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverter.Description Property (Excel)

 Copy code hover
[image]

FileExportConverter.Description Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the description for the file converter. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Description

expression A variable that represents a FileExportConverter object.

Example

The following example displays the description for the first file converter in the FileExportConverters collection.

VBA Copy code Copy code
Dim fcTemp As FileExportConverter
Set fcTemp = FileExportConverter(1)

MsgBox fcTemp.Description

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverter.Extensions Property (Excel)

 Copy code hover
[image]

FileExportConverter.Extensions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the file name extensions associated with the specified FileExportConverter object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Extensions

expression A variable that represents a FileExportConverter object.

Example

The following example displays the file extensions for the first file converter in the FileExportConverters collection.

VBA Copy code Copy code
Dim fcTemp As FileExportConverter
Set fcTemp = FileExportConverters(1)

MsgBox "The file name extensions for the file converter are: " & fcTemp.Extensions

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverter.FileFormat Property (Excel)

 Copy code hover
[image]

FileExportConverter.FileFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an integer that identifies the file format associated with the specified FileExportConverter object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .FileFormat

expression A variable that represents a FileExportConverter object.

Example

The following example displays the file format identifier for the first file converter in the FileExportConverters collection.

VBA Copy code Copy code
Dim fcTemp As FileExportConverter
Set fcTemp = FileExportConverters(1)

MsgBox "The file format identifier for the file converter is: " & fcTemp.FileFormat

The following example shows how to use the file format identifier as a parameter in the SaveAs method of the Workbook object to save a file using the first file converter in the FileExportConverters collection.

VBA Copy code Copy code
ActiveWorkbook.SaveAs _
 Filename:="C:\temp\myFile.xyz", _
 FileFormat:=Application.FileExportConverters(1).FileFormat, _
 CreateBackup:=False

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverter.Parent Property (Excel)

 Copy code hover
[image]

FileExportConverter.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FileExportConverter object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a FileExportConverter object.

See also

Concepts

FileExportConverter Object

Other resources

FileExportConverter Object Members


FileExportConverters Object (Excel)

 Copy code hover
[image]

FileExportConverters Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of FileExportConverter objects that represent all the file converters available for saving files.

Version Information

Version Added: Excel 2007

Remarks

Use the FileExportConverters property to return the FileExportConverters collection.

The Add method is not available for the FileExportConverters collection. FileExportConverter objects are added during installation of Microsoft Office or by installing supplemental converters.

Example

Use FileExportConverters(Index), where Index is an integer, to return a single FileExportConverter object. The following example displays the extensions associated with the second Microsoft Excel worksheet converter in the collection.

VBA Copy code Copy code
MsgBox FileExportConverters(2).Extensions

The index number represents the position of the file converter in the FileExportConverters collection. The following example displays the description for the first file converter in the collection.

VBA Copy code Copy code
MsgBox FileExportConvters(1).Description

See also

Concepts

Excel Object Model Reference

Other resources

FileExportConverters Object Members


FileExportConverters Members (Excel)

 Copy code hover
[image]

FileExportConverters Members (Excel)
Send feedback

Published: July 16, 2012

A collection of FileExportConverter objects that represent all the file converters available for saving files.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long that represents the number of file converters in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Item | Returns an individual FileExportConverter object from a collection.
Parent | Returns an Object that represents the parent object of the specified FileExportConverters object. Read-only.


FileExportConverters Properties (Excel)

 Copy code hover
[image]

FileExportConverters Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long that represents the number of file converters in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Item | Returns an individual FileExportConverter object from a collection.
Parent | Returns an Object that represents the parent object of the specified FileExportConverters object. Read-only.


FileExportConverters.Application Property (Excel)

 Copy code hover
[image]

FileExportConverters.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a FileExportConverters collection.

See also

Concepts

FileExportConverters Collection

Other resources

FileExportConverters Object Members


FileExportConverters.Count Property (Excel)

 Copy code hover
[image]

FileExportConverters.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of file converters in the collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a FileExportConverters collection.

See also

Concepts

FileExportConverters Collection

Other resources

FileExportConverters Object Members


FileExportConverters.Creator Property (Excel)

 Copy code hover
[image]

FileExportConverters.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a FileExportConverters collection.

Remarks

If the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL". The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FileExportConverters Collection

Other resources

FileExportConverters Object Members


FileExportConverters.Item Property (Excel)

 Copy code hover
[image]

FileExportConverters.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an individual FileExportConverter object from a collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a FileExportConverters object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | An integer that represents the individual object to be returned.

Return Value

FileExportConverter

See also

Concepts

FileExportConverters Collection

Other resources

FileExportConverters Object Members


FileExportConverters.Parent Property (Excel)

 Copy code hover
[image]

FileExportConverters.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FileExportConverters object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a FileExportConverters object.

See also

Concepts

FileExportConverters Collection

Other resources

FileExportConverters Object Members


FillFormat Object (Excel)

 Copy code hover
[image]

FillFormat Object (Excel)
See also Send feedback

Represents fill formatting for a shape.

Remarks

A shape can have a solid, gradient, texture, pattern, picture, or semi-transparent fill.

Many of the properties of the FillFormat object are read-only. To set one of these properties, you have to apply the corresponding method.

Example

Use the Fill property to return a FillFormat object. The following example adds a rectangle to myDocument and then sets the gradient and color for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 80).Fill
 .ForeColor.RGB = RGB(0, 128, 128)
 .OneColorGradient msoGradientHorizontal, 1, 1
End With

See also

Concepts

Excel Object Model Reference

Other resources

FillFormat Object Members


FillFormat Members (Excel)

 Copy code hover
[image]

FillFormat Members (Excel)
Send feedback

Represents fill formatting for a shape.

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill format to a preset texture.
Solid | Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.
TwoColorGradient | Sets the specified fill to a two-color gradient.
UserPicture | Fills the specified shape with an image.
UserTextured | Fills the specified shape with small tiles of an image. If you want to fill the shape with one large image, use the UserPicture method.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackColor | Returns or sets a ColorFormat object that represents the specified fill background color.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write
GradientColorType | Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.
GradientDegree | Returns the gradient degree of the specified one-color shaded fill as a floating-point value from 0.0 (dark) through 1.0 (light). Read-only Single.
GradientStops | Returns the end point for the gradient fill. Read-only.
GradientStyle | Returns the gradient style for the specified fill. Read-only MsoGradientStyle.
GradientVariant | Returns the shade variant for the specified fill as an integer value from 1 through 4. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only Long
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets an MsoPatternType value that represents the fill pattern.
PictureEffects | Returns an object that represents the picture or texture fill for the specified fill format. Read-only
PresetGradientType | Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.
PresetTexture | Returns the preset texture for the specified fill. Read-only MsoPresetTexture.
RotateWithObject | Returns or sets if the fill style should rotate with the object. Read/write MsoTriState.
TextureAlignment | Returns or sets the text alignment for the specified FillFormat object. Read/write.
TextureHorizontalScale | Returns or sets the value for horizontally scaling the text for the FillFormat object. Read/write Single.
TextureName | Returns the name of the custom texture file for the specified fill. Read-only String.
TextureOffsetX | Returns the offset X value for the specified fill. Read/write Single.
TextureOffsetY | Returns the offset Y value for the specified fill. Read/write Single.
TextureTile | Returns the texture tile style for the specified fill. Read/write MsoTriState.
TextureType | Returns the texture type for the specified fill. Read-only MsoTextureType.
TextureVerticalScale | Returns the texture vertical scale for the specified fill. Read/write Single.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Type | Returns a MsoFillType value that represents the fill type.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.


FillFormat Properties (Excel)

 Copy code hover
[image]

FillFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackColor | Returns or sets a ColorFormat object that represents the specified fill background color.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write
GradientColorType | Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.
GradientDegree | Returns the gradient degree of the specified one-color shaded fill as a floating-point value from 0.0 (dark) through 1.0 (light). Read-only Single.
GradientStops | Returns the end point for the gradient fill. Read-only.
GradientStyle | Returns the gradient style for the specified fill. Read-only MsoGradientStyle.
GradientVariant | Returns the shade variant for the specified fill as an integer value from 1 through 4. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only Long
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets an MsoPatternType value that represents the fill pattern.
PictureEffects | Returns an object that represents the picture or texture fill for the specified fill format. Read-only
PresetGradientType | Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.
PresetTexture | Returns the preset texture for the specified fill. Read-only MsoPresetTexture.
RotateWithObject | Returns or sets if the fill style should rotate with the object. Read/write MsoTriState.
TextureAlignment | Returns or sets the text alignment for the specified FillFormat object. Read/write.
TextureHorizontalScale | Returns or sets the value for horizontally scaling the text for the FillFormat object. Read/write Single.
TextureName | Returns the name of the custom texture file for the specified fill. Read-only String.
TextureOffsetX | Returns the offset X value for the specified fill. Read/write Single.
TextureOffsetY | Returns the offset Y value for the specified fill. Read/write Single.
TextureTile | Returns the texture tile style for the specified fill. Read/write MsoTriState.
TextureType | Returns the texture type for the specified fill. Read-only MsoTextureType.
TextureVerticalScale | Returns the texture vertical scale for the specified fill. Read/write Single.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Type | Returns a MsoFillType value that represents the fill type.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.


FillFormat.Application Property (Excel)

 Copy code hover
[image]

FillFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a FillFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.BackColor Property (Excel)

 Copy code hover
[image]

FillFormat.BackColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the specified fill background color.

Syntax

expression .BackColor

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Creator Property (Excel)

 Copy code hover
[image]

FillFormat.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a FillFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.ForeColor Property (Excel)

 Copy code hover
[image]

FillFormat.ForeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.

Syntax

expression .ForeColor

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientAngle Property (Excel)

 Copy code hover
[image]

FillFormat.GradientAngle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the gradient fill for the specified fill format. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .GradientAngle

expression A variable that represents a FillFormat object.

Return Value

Single

Remarks

A gradient fill can be specified in the formatting for various elements (shapes) in a chart. For example, you can use the Format Data Series dialog box to format the columns in a Column chart to a gradient fill. In this case, the GradientAngle property corresponds to the setting of the Angle box in the Fill category of the Format Data Series dialog box. The valid range of values for the GradientAngle property is from 0 to 359.9.

Example

The following code example sets the angle of the gradient fill for Series 1 in Chart 1 to 45 degrees.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Format.Fill.GradientAngle = 45

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientColorType Property (Excel)

 Copy code hover
[image]

FillFormat.GradientColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.

Syntax

expression .GradientColorType

expression A variable that represents a FillFormat object.

Remarks

MsoGradientColorMixed is a return value only which indicates a combination of the other states in the specified range. Use the OneColorGradient, PresetGradient, or TwoColorGradient method to set the gradient type for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillGradient And _
        c1f.GradientColorType = msoGradientOneColor Then
    With Charts(2).ChartArea.Fill
        .Visible = True
        .OneColorGradient c1f.GradientStyle, _
            c1f.GradientVariant, c1f.GradientDegree
    End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientDegree Property (Excel)

 Copy code hover
[image]

FillFormat.GradientDegree Property (Excel)
See also Send feedback

Returns the gradient degree of the specified one-color shaded fill as a floating-point value from 0.0 (dark) through 1.0 (light). Read-only Single.

Syntax

expression .GradientDegree

expression A variable that represents a FillFormat object.

Remarks

This property is read-only. Use the OneColorGradient method to set the gradient degree for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillGradient And _
 c1f.GradientColorType = msoGradientOneColor Then
 With Charts(2).ChartArea.Fill
 .Visible = True
 .OneColorGradient c1f.GradientStyle, _
 c1f.GradientVariant, c1f.GradientDegree
 End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientStops Property (Excel)

 Copy code hover
[image]

FillFormat.GradientStops Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the end point for the gradient fill. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .GradientStops

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientStyle Property (Excel)

 Copy code hover
[image]

FillFormat.GradientStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the gradient style for the specified fill. Read-only MsoGradientStyle.

Syntax

expression .GradientStyle

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientVariant Property (Excel)

 Copy code hover
[image]

FillFormat.GradientVariant Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the shade variant for the specified fill as an integer value from 1 through 4. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only Long

Syntax

expression .GradientVariant

expression A variable that represents a FillFormat object.

Remarks

This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient variant for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillGradient And _
 c1f.GradientColorType = msoGradientOneColor Then
 With Charts(2).ChartArea.Fill
 .Visible = True
 .OneColorGradient c1f.GradientStyle, _
 c1f.GradientVariant, c1f.GradientDegree
 End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Parent Property (Excel)

 Copy code hover
[image]

FillFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Pattern Property (Excel)

 Copy code hover
[image]

FillFormat.Pattern Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoPatternType value that represents the fill pattern.

Syntax

expression .Pattern

expression A variable that represents a FillFormat object.

Remarks

Use the Patterned method to set the pattern type for the fill.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PictureEffects Property (Excel)

 Copy code hover
[image]

FillFormat.PictureEffects Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the picture or texture fill for the specified fill format. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PictureEffects

expression A variable that repressents a FillFormat object.

Return Value

PictureEffects

Remarks

A picture or texture fill can be specified in the formatting for various elements (shapes) in a chart. For example, you can use the Format Data Series dialog box to format the columns in a Column chart to a picture or texture fill. In this case, the PictureEffects property returns a PictureEffects collection that corresponds to the settings associated with the Picture or texture fili option in the Fill category of the Format Data Series dialog box.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetGradientType Property (Excel)

 Copy code hover
[image]

FillFormat.PresetGradientType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.

Syntax

expression .PresetGradientType

expression A variable that represents a FillFormat object.

Remarks

Use the PresetGradient method to set the preset gradient type for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillGradient Then
    With Charts(2).ChartArea.Fill
        .Visible = True
        .PresetGradient c1f.GradientStyle, _
            c1f.GradientVariant, c1f.PresetGradientType
    End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetTexture Property (Excel)

 Copy code hover
[image]

FillFormat.PresetTexture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the preset texture for the specified fill. Read-only MsoPresetTexture.

Syntax

expression .PresetTexture

expression A variable that represents a FillFormat object.

Remarks

Use the PresetTextured method to set the preset texture for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillTextured Then
    With Charts(2).ChartArea.Fill
        .Visible = True
        If c1f.TextureType = msoTexturePreset Then
            .PresetTextured c1f.PresetTexture
        Else
            .UserTextured c1f.TextureName
        End If
    End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.RotateWithObject Property (Excel)

 Copy code hover
[image]

FillFormat.RotateWithObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the fill style should rotate with the object. Read/write MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .RotateWithObject

expression A variable that represents a FillFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureAlignment Property (Excel)

 Copy code hover
[image]

FillFormat.TextureAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text alignment for the specified FillFormat object. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureAlignment

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureHorizontalScale Property (Excel)

 Copy code hover
[image]

FillFormat.TextureHorizontalScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the value for horizontally scaling the text for the FillFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureHorizontalScale

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureName Property (Excel)

 Copy code hover
[image]

FillFormat.TextureName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the custom texture file for the specified fill. Read-only String.

Syntax

expression .TextureName

expression A variable that represents a FillFormat object.

Remarks

Use the UserPicture or UserTextured method to set the texture file for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillTextured Then
 With Charts(2).ChartArea.Fill
 .Visible = True
 If c1f.TextureType = msoTexturePreset Then
 .PresetTextured c1f.PresetTexture
 Else
 .UserTextured c1f.TextureName
 End If
 End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureOffsetX Property (Excel)

 Copy code hover
[image]

FillFormat.TextureOffsetX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the offset X value for the specified fill. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureOffsetX

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureOffsetY Property (Excel)

 Copy code hover
[image]

FillFormat.TextureOffsetY Property (Excel)
See also Send feedback

Returns the offset Y value for the specified fill. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureOffsetY

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureTile Property (Excel)

 Copy code hover
[image]

FillFormat.TextureTile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the texture tile style for the specified fill. Read/write MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureTile

expression A variable that represents a FillFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureType Property (Excel)

 Copy code hover
[image]

FillFormat.TextureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the texture type for the specified fill. Read-only MsoTextureType.

Syntax

expression .TextureType

expression A variable that represents a FillFormat object.

Remarks

Use the UserTextured method to set the texture type for the fill.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillTextured Then
    With Charts(2).ChartArea.Fill
        .Visible = True
        If c1f.TextureType = msoTexturePreset Then
            .PresetTextured c1f.PresetTexture
        Else
            .UserTextured c1f.TextureName
        End If
    End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureVerticalScale Property (Excel)

 Copy code hover
[image]

FillFormat.TextureVerticalScale Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the texture vertical scale for the specified fill. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .TextureVerticalScale

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Transparency Property (Excel)

 Copy code hover
[image]

FillFormat.Transparency Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.

Syntax

expression .Transparency

expression A variable that represents a FillFormat object.

Remarks

The value of this property affects the appearance of solid-colored fills and lines only; it has no effect on the appearance of patterned lines or patterned, gradient, picture, or textured fills.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Type Property (Excel)

 Copy code hover
[image]

FillFormat.Type Property (Excel)
See also Send feedback

Returns a MsoFillType value that represents the fill type.

Syntax

expression .Type

expression A variable that represents a FillFormat object.

Remarks

This property can also return xlAutomatic or xlNone.

The msoFillBackground constant is not used in Microsoft Excel.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Visible Property (Excel)

 Copy code hover
[image]

FillFormat.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat Methods (Excel)

 Copy code hover
[image]

FillFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill format to a preset texture.
Solid | Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.
TwoColorGradient | Sets the specified fill to a two-color gradient.
UserPicture | Fills the specified shape with an image.
UserTextured | Fills the specified shape with small tiles of an image. If you want to fill the shape with one large image, use the UserPicture method.


FillFormat.OneColorGradient Method (Excel)

 Copy code hover
[image]

FillFormat.OneColorGradient Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a one-color gradient.

Syntax

expression .OneColorGradient(Style, Variant, Degree)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style.
Variant | Required | Integer | The gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If GradientStyle is msoGradientFromCenter, the Variant argument can only be 1 or 2.
Degree | Required | Single | The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Patterned Method (Excel)

 Copy code hover
[image]

FillFormat.Patterned Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a pattern.

Syntax

expression .Patterned(Pattern)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Pattern | Required | MsoPatternType | The type of pattern.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetGradient Method (Excel)

 Copy code hover
[image]

FillFormat.PresetGradient Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a preset gradient.

Syntax

expression .PresetGradient(Style, Variant, PresetGradientType)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style.
Variant | Required | Integer | The gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If GradientStyle is msoGradientFromCenter, the Variant argument can only be 1 or 2.
PresetGradientType | Required | MsoPresetGradientType | The preset gradient type.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetTextured Method (Excel)

 Copy code hover
[image]

FillFormat.PresetTextured Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill format to a preset texture.

Syntax

expression .PresetTextured(PresetTexture)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetTexture | Required | MsoPresetTexture | The type of texture to apply.

Example

This example sets the fill format for chart two to the same style used for chart one.

VBA Copy code Copy code
Set c1f = Charts(1).ChartArea.Fill
If c1f.Type = msoFillTextured Then
    With Charts(2).ChartArea.Fill
        .Visible = True
        If c1f.TextureType = msoTexturePreset Then
            .PresetTextured c1f.PresetTexture
        Else
            .UserTextured c1f.TextureName
        End If
    End With
End If

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Solid Method (Excel)

 Copy code hover
[image]

FillFormat.Solid Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.

Syntax

expression .Solid

expression A variable that represents a FillFormat object.

Example

This example converts all fills on myDocument to uniform red fills.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 With s.Fill
 .Solid
 .ForeColor.RGB = RGB(255, 0, 0)
 End With
Next

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TwoColorGradient Method (Excel)

 Copy code hover
[image]

FillFormat.TwoColorGradient Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a two-color gradient.

Syntax

expression .TwoColorGradient(Style, Variant)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style.
Variant | Required | Integer | The gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.UserPicture Method (Excel)

 Copy code hover
[image]

FillFormat.UserPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills the specified shape with an image.

Syntax

expression .UserPicture(PictureFile)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PictureFile | Required | String | The name of the picture file.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.UserTextured Method (Excel)

 Copy code hover
[image]

FillFormat.UserTextured Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills the specified shape with small tiles of an image. If you want to fill the shape with one large image, use the UserPicture method.

Syntax

expression .UserTextured(TextureFile)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
TextureFile | Required | String | The name of the picture file.

Example

This example sets the fill format for chart two.

VBA Copy code Copy code
Charts(2).ChartArea.Fill.UserTextured "brick.gif"

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


Filter Object (Excel)

 Copy code hover
[image]

Filter Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a filter for a single column.

Remarks

The Filter object is a member of the Filters collection. The Filters collection contains all the filters in an autofiltered range.

Example

Use Filters(index), where index is the filter title or index number, to return a single Filter object. The following example sets a variable to the value of the On property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
Set w = Worksheets("Crew")
If w.AutoFilterMode Then
 filterIsOn = w.AutoFilter.Filters(1).On
End If

Note that all the properties of the Filter object are read-only. To set these properties, apply autofiltering manually or using the AutoFilter method of the Range object, as shown in the following example.

VBA Copy code Copy code
Set w = Worksheets("Crew")
w.Cells.AutoFilter field:=2, Criteria1:="Crucial", _
 Operator:=xlOr, Criteria2:="Important"

See also

Concepts

Excel Object Model Reference

Other resources

Filter Object Members


Filter Members (Excel)

 Copy code hover
[image]

Filter Members (Excel)
Send feedback

Published: July 16, 2012

Represents a filter for a single column.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Criteria1 | Returns the first filtered value for the specified column in a filtered range. Read-only Variant.
Criteria2 | Returns the second filtered value for the specified column in a filtered range. Read-only Variant.
On | True if the specified filter is on. Read-only Boolean.
Operator | Returns an XlAutoFilterOperator value that represents the operator that associates the two criteria applied by the specified filter.
Parent | Returns the parent object for the specified object. Read-only.


Filter Properties (Excel)

 Copy code hover
[image]

Filter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Criteria1 | Returns the first filtered value for the specified column in a filtered range. Read-only Variant.
Criteria2 | Returns the second filtered value for the specified column in a filtered range. Read-only Variant.
On | True if the specified filter is on. Read-only Boolean.
Operator | Returns an XlAutoFilterOperator value that represents the operator that associates the two criteria applied by the specified filter.
Parent | Returns the parent object for the specified object. Read-only.


Filter.Application Property (Excel)

 Copy code hover
[image]

Filter.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Filter object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Count Property (Excel)

 Copy code hover
[image]

Filter.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a Filter object.

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Creator Property (Excel)

 Copy code hover
[image]

Filter.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Filter object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Criteria1 Property (Excel)

 Copy code hover
[image]

Filter.Criteria1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the first filtered value for the specified column in a filtered range. Read-only Variant.

Syntax

expression .Criteria1

expression A variable that represents a Filter object.

Example

The following example sets a variable to the value of the Criteria1 property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
With Worksheets("Crew")
 If .AutoFilterMode Then
 With .AutoFilter.Filters(1)
 If .On Then c1 = .Criteria1
 End With
 End If
End With

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Criteria2 Property (Excel)

 Copy code hover
[image]

Filter.Criteria2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the second filtered value for the specified column in a filtered range. Read-only Variant.

Syntax

expression .Criteria2

expression A variable that represents a Filter object.

Remarks

If you try to access the Criteria2 property for a filter that does not use two criteria, an error will occur. Check that the Operator property of a Filter object doesn't equal zero (0) before trying to access the Criteria2 property.

Example

The following example sets a variable to the value of the Criteria2 property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
With Worksheets("Crew")
 If .AutoFilterMode Then
 With .AutoFilter.Filters(1)
 If .On And .Operator Then
 c2 = .Criteria2
 Else
 c2 = "Not set"
 End If
 End With
 End If
End With

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.On Property (Excel)

 Copy code hover
[image]

Filter.On Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified filter is on. Read-only Boolean.

Syntax

expression .On

expression A variable that represents a Filter object.

Example

The following example sets a variable to the value of the Criteria1 property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
With Worksheets("Crew")
 If .AutoFilterMode Then
 With .AutoFilter.Filters(1)
 If .On Then c1 = .Criteria1
 End With
 End If
End With

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Operator Property (Excel)

 Copy code hover
[image]

Filter.Operator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlAutoFilterOperator value that represents the operator that associates the two criteria applied by the specified filter.

Syntax

expression .Operator

expression A variable that represents a Filter object.

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filter.Parent Property (Excel)

 Copy code hover
[image]

Filter.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Filter object.

See also

Concepts

Filter Object

Other resources

Filter Object Members


Filters Object (Excel)

 Copy code hover
[image]

Filters Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of Filter objects that represents all the filters in an autofiltered range.

Example

Use the Filters property to return the Filters collection. The following example creates a list that contains the criteria and operators for the filters in the autofiltered range on the Crew worksheet.

VBA Copy code Copy code
Dim f As Filter
Dim w As Worksheet
Const ns As String = "Not set"

Set w = Worksheets("Crew")
Set w2 = Worksheets("FilterData")
rw = 1
For Each f In w.AutoFilter.Filters
 If f.On Then
 c1 = Right(f.Criteria1, Len(f.Criteria1) - 1)
 If f.Operator Then
 op = f.Operator
 c2 = Right(f.Criteria2, Len(f.Criteria2) - 1)
 Else
 op = ns
 c2 = ns
 End If
 Else
 c1 = ns
 op = ns
 c2 = ns
 End If
 w2.Cells(rw, 1) = c1
 w2.Cells(rw, 2) = op
 w2.Cells(rw, 3) = c2
 rw = rw + 1
Next

Use Filters(index), where index is the filter title or index number, to return a single Filter object. The following example sets a variable to the value of the On property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
Set w = Worksheets("Crew")
If w.AutoFilterMode Then
 filterIsOn = w.AutoFilter.Filters(1).On
End If

See also

Concepts

Excel Object Model Reference

Other resources

Filters Object Members


Filters Members (Excel)

 Copy code hover
[image]

Filters Members (Excel)
Send feedback

Published: July 16, 2012

A collection of Filter objects that represents all the filters in an autofiltered range.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Filters Properties (Excel)

 Copy code hover
[image]

Filters Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Filters.Application Property (Excel)

 Copy code hover
[image]

Filters.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Filters object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Filters Object

Other resources

Filters Object Members


Filters.Count Property (Excel)

 Copy code hover
[image]

Filters.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Filters object.

See also

Concepts

Filters Object

Other resources

Filters Object Members


Filters.Creator Property (Excel)

 Copy code hover
[image]

Filters.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Filters object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Filters Object

Other resources

Filters Object Members


Filters.Item Property (Excel)

 Copy code hover
[image]

Filters.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Filters object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

The following example sets a variable to the value of the On property of the filter for the first column in the filtered range on the Crew worksheet.

VBA Copy code Copy code
Set w = Worksheets("Crew")
If w.AutoFilterMode Then
 filterIsOn = w.AutoFilter.Filters.Item(1).On
End If

See also

Concepts

Filters Object

Other resources

Filters Object Members


Filters.Parent Property (Excel)

 Copy code hover
[image]

Filters.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Filters object.

See also

Concepts

Filters Object

Other resources

Filters Object Members


Floor Object (Excel)

 Copy code hover
[image]

Floor Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the floor of a 3-D chart.

Example

Use the Floor property to return the Floor object. The following example sets the floor color for embedded chart one to cyan. The example will fail if the chart isn't a 3-D chart.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Activate
ActiveChart.Floor.Interior.Color = RGB(0, 255, 255)

See also

Concepts

Excel Object Model Reference

Other resources

Floor Object Members


Floor Members (Excel)

 Copy code hover
[image]

Floor Members (Excel)
Send feedback

Published: July 16, 2012

Represents the floor of a 3-D chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the floor of the specified chart.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.
Thickness | Returns or sets a Long, specifying the thickness of the floor. Read/write.


Floor Properties (Excel)

 Copy code hover
[image]

Floor Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.
Thickness | Returns or sets a Long, specifying the thickness of the floor. Read/write.


Floor.Application Property (Excel)

 Copy code hover
[image]

Floor.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Floor object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Creator Property (Excel)

 Copy code hover
[image]

Floor.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Floor object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Format Property (Excel)

 Copy code hover
[image]

Floor.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Name Property (Excel)

 Copy code hover
[image]

Floor.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Parent Property (Excel)

 Copy code hover
[image]

Floor.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.PictureType Property (Excel)

 Copy code hover
[image]

Floor.PictureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.

Syntax

expression .PictureType

expression A variable that represents a Floor object.

Remarks

This property can be set to one of the following constants: xlStack or xlStretch.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Thickness Property (Excel)

 Copy code hover
[image]

Floor.Thickness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long, specifying the thickness of the floor. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Thickness

expression A variable that represents a Floor object.

Remarks

Use this property to set the thickness of the floor. The default thickness is zero (0).

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor Methods (Excel)

 Copy code hover
[image]

Floor Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the floor of the specified chart.
Select | Selects the object.


Floor.ClearFormats Method (Excel)

 Copy code hover
[image]

Floor.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Floor object.

Return Value

Variant

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Paste Method (Excel)

 Copy code hover
[image]

Floor.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard on the floor of the specified chart.

Syntax

expression .Paste

expression A variable that represents a Floor object.

Remarks

This method can be used on column, bar, line, or radar charts.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Select Method (Excel)

 Copy code hover
[image]

Floor.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Floor object.

Return Value

Variant

See also

Concepts

Floor Object

Other resources

Floor Object Members


Font Object (Excel)

 Copy code hover
[image]

Font Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains the font attributes (font name, font size, color, and so on) for an object.

Remarks

If you don't want to format all the text in a cell or graphic the same way, use the Characters property to return a subset of the text.

Example

Use the Font property to return the Font object. The following example formats cells A1:C5 as bold.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:C5").Font.Bold = True

See also

Concepts

Excel Object Model Reference

Other resources

Font Object Members


Font Members (Excel)

 Copy code hover
[image]

Font Members (Excel)
Send feedback

Published: July 16, 2012

Contains the font attributes (font name, font size, color, and so on) for an object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Background | Returns or sets the type of background for text used in charts. Read/write Variant which is set to one of the constants of XlBackground.
Bold | True if the font is bold. Read/write Variant.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the font.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FontStyle | Returns or sets the font style. Read/write String.
Italic | True if the font style is italic. Read/write Boolean.
Name | Returns or sets a Variant value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Size | Returns or sets the size of the font. Read/write Variant.
Strikethrough | True if the font is struck through with a horizontal line. Read/write Boolean.
Subscript | True if the font is formatted as subscript. False by default. Read/write Variant.
Superscript | True if the font is formatted as superscript; False by default. Read/write Variant.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
ThemeFont | Returns or sets the theme font in the applied font scheme that is associated with the specified object. Read/write XlThemeFont.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Underline | Returns or sets the type of underline applied to the font. Can be one of the following XlUnderlineStyle constants. Read/write Variant.


Font Properties (Excel)

 Copy code hover
[image]

Font Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Background | Returns or sets the type of background for text used in charts. Read/write Variant which is set to one of the constants of XlBackground.
Bold | True if the font is bold. Read/write Variant.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the font.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FontStyle | Returns or sets the font style. Read/write String.
Italic | True if the font style is italic. Read/write Boolean.
Name | Returns or sets a Variant value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Size | Returns or sets the size of the font. Read/write Variant.
Strikethrough | True if the font is struck through with a horizontal line. Read/write Boolean.
Subscript | True if the font is formatted as subscript. False by default. Read/write Variant.
Superscript | True if the font is formatted as superscript; False by default. Read/write Variant.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
ThemeFont | Returns or sets the theme font in the applied font scheme that is associated with the specified object. Read/write XlThemeFont.
TintAndShade | Returns or sets a Single that lightens or darkens a color.
Underline | Returns or sets the type of underline applied to the font. Can be one of the following XlUnderlineStyle constants. Read/write Variant.


Font.Application Property (Excel)

 Copy code hover
[image]

Font.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Font object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Background Property (Excel)

 Copy code hover
[image]

Font.Background Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of background for text used in charts. Read/write Variant which is set to one of the constants of XlBackground.

Syntax

expression .Background

expression A variable that represents a Font object.

Remarks

XlBackground can be one of the following constants | Description of text background
xlBackgroundAutomatic | Font background will automatically change the background area around the text to a color that best displays the chart text on the color applied to elements under the text
xlBackgroundOpaque | Font background will set the font bacground to black if the text color and fill color underneath the text are very close or the same color, such that the text would not appear
xlBackgroundTransparent | Font background is set to transparent so that text background does not change if the text color is close to the color underneath the text

Example

This example adds a chart title to embedded chart one on the first worksheet and then sets the font size and background type for the title. This example assumes a chart exists on the first worksheet.

VBA Copy code Copy code
Sub UseBackground()

 With Worksheets(1).ChartObjects(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "Rainfall Totals by Month"
 With .ChartTitle.Font
 .Size = 10
 .Background = xlBackgroundTransparent
 End With
 End With

End Sub

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Bold Property (Excel)

 Copy code hover
[image]

Font.Bold Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font is bold. Read/write Variant.

Syntax

expression .Bold

expression A variable that represents a Font object.

Example

This example sets the font to bold for the range A1:A5 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A5").Font.Bold = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Color Property (Excel)

 Copy code hover
[image]

Font.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.

Syntax

expression .Color

expression An expression that returns a Font object.

Remarks

Object | Color
Border | The color of the border.
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero).
Font | The color of the font.
Interior | The cell shading color or the drawing object fill color.
Tab | The color of the tab.

Example

This example sets the color of the tick-mark labels on the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ColorIndex Property (Excel)

 Copy code hover
[image]

Font.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the color of the font.

Syntax

expression .ColorIndex

expression A variable that represents a Font object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

Example

This example changes the font color in cell A1 on Sheet1 to red.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Font.ColorIndex = 3

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Creator Property (Excel)

 Copy code hover
[image]

Font.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Font object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.FontStyle Property (Excel)

 Copy code hover
[image]

Font.FontStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the font style. Read/write String.

Syntax

expression .FontStyle

expression A variable that represents a Font object.

Remarks

Changing this property may affect other Font properties (such as Bold and Italic).

Example

This example sets the font style for cell A1 on Sheet1 to bold and italic.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Font.FontStyle = "Bold Italic"

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Italic Property (Excel)

 Copy code hover
[image]

Font.Italic Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font style is italic. Read/write Boolean.

Syntax

expression .Italic

expression A variable that represents a Font object.

Example

This example sets the font style to italic for the range A1:A5 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A5").Font.Italic = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Name Property (Excel)

 Copy code hover
[image]

Font.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Font object.

Remarks

The name of a Font object is a String.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Parent Property (Excel)

 Copy code hover
[image]

Font.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Size Property (Excel)

 Copy code hover
[image]

Font.Size Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the font. Read/write Variant.

Syntax

expression .Size

expression A variable that represents a Font object.

Example

This example sets the font size for cells A1:D10 on Sheet1 to 12 points.

VBA Copy code Copy code
With Worksheets("Sheet1").Range("A1:D10")
 .Value = "Test"
 .Font.Size = 12
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Strikethrough Property (Excel)

 Copy code hover
[image]

Font.Strikethrough Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font is struck through with a horizontal line. Read/write Boolean.

Syntax

expression .Strikethrough

expression A variable that represents a Font object.

Example

This example sets the font in the active cell on Sheet1 to strikethrough.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Font.Strikethrough = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Subscript Property (Excel)

 Copy code hover
[image]

Font.Subscript Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as subscript. False by default. Read/write Variant.

Syntax

expression .Subscript

expression A variable that represents a Font object.

Example

This example makes the second character in cell A1 a subscript character.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1") _
 .Characters(2, 1).Font.Subscript = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Superscript Property (Excel)

 Copy code hover
[image]

Font.Superscript Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as superscript; False by default. Read/write Variant.

Syntax

expression .Superscript

expression A variable that represents a Font object.

Example

This example makes the last character in cell A1 a superscript character.

VBA Copy code Copy code
n = Worksheets("Sheet1").Range("A1").Characters.Count
Worksheets("Sheet1").Range("A1") _
 .Characters(n, 1).Font.Superscript = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ThemeColor Property (Excel)

 Copy code hover
[image]

Font.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a Font object.

Remarks

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ThemeFont Property (Excel)

 Copy code hover
[image]

Font.ThemeFont Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme font in the applied font scheme that is associated with the specified object. Read/write XlThemeFont.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeFont

expression A variable that represents a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.TintAndShade Property (Excel)

 Copy code hover
[image]

Font.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens a color.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a Font object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1 results in a run-time error: "The specified value is out of range." This property works for both theme colors and nontheme colors.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Underline Property (Excel)

 Copy code hover
[image]

Font.Underline Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of underline applied to the font. Can be one of the following XlUnderlineStyle constants. Read/write Variant.

Syntax

expression .Underline

expression A variable that represents a Font object.

Remarks

XlUnderlineStyle can be one of these XlUnderlineStyle constants.

xlUnderlineStyleNone

xlUnderlineStyleSingle

xlUnderlineStyleDouble

xlUnderlineStyleSingleAccounting

xlUnderlineStyleDoubleAccounting

Example

This example sets the font in the active cell on Sheet1 to single underline.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Font.Underline = xlUnderlineStyleSingle

See also

Concepts

Font Object

Other resources

Font Object Members


FormatColor Object (Excel)

 Copy code hover
[image]

FormatColor Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the fill color specified for a threshold of a color scale conditional format or the color of the bar in a data bar conditional format.

Version Information

Version Added: Excel 2007

Remarks

You can choose a color by passing an RGB value in the Color property or designate the color by indexing into the theme color palette using the ThemeColor property.

Example

The following code example creates a range of numbers and then applies a two-color scale conditional formatting rule to that range. The color for the minimum threshold is then assigned to red and the maximum threshold to blue by indexing into the ColorScaleCriteria collection to set individual criteria.

VBA Copy code Copy code
Sub CreateColorScaleCF()

 Dim cfColorScale As ColorScale

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 1
 .Range("C2") = 2
 .Range("C1:C2").AutoFill Destination:=Range("C1:C10")
 End With

 Range("C1:C10").Select

 'Create a two-color ColorScale object for the created sample data range
 Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=2)

 'Set the minimum threshold to red and maximum threshold to blue
 cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(255, 0, 0)
 cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(0, 0, 255)

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

FormatColor Object Members


FormatColor Members (Excel)

 Copy code hover
[image]

FormatColor Members (Excel)
Send feedback

Published: July 16, 2012

Represents the fill color specified for a threshold of a color scale conditional format or the color of the bar in a data bar conditional format.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns or sets the fill color associated with a threshold for a data bar or color scale conditional formatting rule.
ColorIndex | Returns or sets one of the constants of the XlColorIndex enumeration, specifying if the fill color is expressed as an index value into the current color palette.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets one of the constants of the XlThemeColor enumeration, specifying the theme color used in a threshold of a data bar or color scale conditional format.
TintAndShade | Returns or sets a Single that lightens or darkens the fill color of a cell for a threshold of a data bar or color scale conditional formatting rule.


FormatColor Properties (Excel)

 Copy code hover
[image]

FormatColor Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns or sets the fill color associated with a threshold for a data bar or color scale conditional formatting rule.
ColorIndex | Returns or sets one of the constants of the XlColorIndex enumeration, specifying if the fill color is expressed as an index value into the current color palette.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets one of the constants of the XlThemeColor enumeration, specifying the theme color used in a threshold of a data bar or color scale conditional format.
TintAndShade | Returns or sets a Single that lightens or darkens the fill color of a cell for a threshold of a data bar or color scale conditional formatting rule.


FormatColor.Application Property (Excel)

 Copy code hover
[image]

FormatColor.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a FormatColor object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.Color Property (Excel)

 Copy code hover
[image]

FormatColor.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the fill color associated with a threshold for a data bar or color scale conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .Color

expression A variable that represents a FormatColor object.

Remarks

The format color is expressed as an RGB function. For example, to set the color to red, use RGB(255,0,0).

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.ColorIndex Property (Excel)

 Copy code hover
[image]

FormatColor.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlColorIndex enumeration, specifying if the fill color is expressed as an index value into the current color palette.

Version Information

Version Added: Excel 2007

Syntax

expression .ColorIndex

expression A variable that represents a FormatColor object.

Remarks

This property is used for each threshold of a color scale or data bar conditional formatting rule.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.Creator Property (Excel)

 Copy code hover
[image]

FormatColor.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a FormatColor object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.Parent Property (Excel)

 Copy code hover
[image]

FormatColor.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a FormatColor object.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.ThemeColor Property (Excel)

 Copy code hover
[image]

FormatColor.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlThemeColor enumeration, specifying the theme color used in a threshold of a data bar or color scale conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a FormatColor object.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatColor.TintAndShade Property (Excel)

 Copy code hover
[image]

FormatColor.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens the fill color of a cell for a threshold of a data bar or color scale conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a FormatColor object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

See also

Concepts

FormatColor Object

Other resources

FormatColor Object Members


FormatCondition Object (Excel)

 Copy code hover
[image]

FormatCondition Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a conditional format.

Remarks

The FormatCondition object is a member of the FormatConditions collection. The FormatConditions collection can now contain more than three conditional formats for a given range.

Use the Add method to create a new conditional format. If a range has mulitple formats, you can use the Modify method to change one of the formats, or you can use the Delete method to delete a format and then use the Add method to create a new format.

Use the Font, Borders, and Interior properties of the FormatCondition object to control the appearance of formatted cells. Some properties of these objects aren't supported by the conditional format object model. Some of the properties that can be used with conditional formatting are listed in the following table.

Object | Properties
Font | BoldColorColorIndexFontStyleItalicStrikethroughUnderline The accounting underline styles cannot be used.
Border | BottomColorLeftRightStyle The following border styles can be used (all others aren't supported): xlNone, xlSolid, xlDash, xlDot, xlDashDot, xlDashDotDot, xlGray50, xlGray75, and xlGray25. TopWeight The following border weights can be used (all others aren't supported): xlWeightHairline and xlWeightThin.
Interior | ColorColorIndexPatternPatternColorIndex

Example

Use FormatConditions(index), where index is the index number of the conditional format, to return a FormatCondition object. The following example sets format properties for an existing conditional format for cells E1:E10.

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions(1)
 With .Borders
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 6
 End With
 With .Font
 .Bold = True
 .ColorIndex = 3
 End With
End With

See also

Concepts

Excel Object Model Reference

Other resources

FormatCondition Object Members


FormatCondition Members (Excel)

 Copy code hover
[image]

FormatCondition Members (Excel)
Send feedback

Published: July 16, 2012

Represents a conditional format.

Methods

Name | Description
Delete | Deletes the object.
Modify | Modifies an existing conditional format.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DateOperator | Specifies the Date operator used in the format condition. Read/write.
Font | Returns a Font object that represents the font of the specified object.
Formula1 | Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Formula2 | Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Interior | Returns an Interior object that represents the interior of the specified object.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Operator | Returns a Long value that represents the operator for the conditional format.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Text | Returns or sets a String value specifying the text string used by the conditional formatting rule.
TextOperator | Returns or sets one of the constants of the XlContainsOperator enumeration, specifying the text search performed by the conditional formatting rule.
Type | Returns a Long value, containing a xlFormatConditionType value, that represents the object type.


FormatCondition Properties (Excel)

 Copy code hover
[image]

FormatCondition Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DateOperator | Specifies the Date operator used in the format condition. Read/write.
Font | Returns a Font object that represents the font of the specified object.
Formula1 | Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Formula2 | Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Interior | Returns an Interior object that represents the interior of the specified object.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Operator | Returns a Long value that represents the operator for the conditional format.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Text | Returns or sets a String value specifying the text string used by the conditional formatting rule.
TextOperator | Returns or sets one of the constants of the XlContainsOperator enumeration, specifying the text search performed by the conditional formatting rule.
Type | Returns a Long value, containing a xlFormatConditionType value, that represents the object type.


FormatCondition.Application Property (Excel)

 Copy code hover
[image]

FormatCondition.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a FormatCondition object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.AppliesTo Property (Excel)

 Copy code hover
[image]

FormatCondition.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Borders Property (Excel)

 Copy code hover
[image]

FormatCondition.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).

Syntax

expression .Borders

expression A variable that represents a FormatCondition object.

Example

This example sets the color of the bottom border of cell B2 on Sheet1 to a thin red border.

VBA Copy code Copy code
Sub SetRangeBorder()

 With Worksheets("Sheet1").Range("B2").Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 3
 End With

End Sub

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Creator Property (Excel)

 Copy code hover
[image]

FormatCondition.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a FormatCondition object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.DateOperator Property (Excel)

 Copy code hover
[image]

FormatCondition.DateOperator Property (Excel)
See also Send feedback

Specifies the Date operator used in the format condition. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .DateOperator

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Font Property (Excel)

 Copy code hover
[image]

FormatCondition.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Formula1 Property (Excel)

 Copy code hover
[image]

FormatCondition.Formula1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.

Syntax

expression .Formula1

expression A variable that represents a FormatCondition object.

Example

This example changes the formula for conditional format one for cells E1:E10 if the formula specifies "less than 5."

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions(1)
 If .Operator = xlLess And .Formula1 = "5" Then
 .Modify xlCellValue, xlLess, "10"
 End If
End With

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Formula2 Property (Excel)

 Copy code hover
[image]

FormatCondition.Formula2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.

Syntax

expression .Formula2

expression A variable that represents a FormatCondition object.

Example

This example changes the formula for conditional format one for cells E1:E10 if the formula specifies "between 5 and 10"

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions(1)
 If .Operator = xlBetween And _
 .Formula1 = "5" And _
 .Formula2 = "10" Then
 .Modify xlCellValue, xlLess, "10"
 End If
End With

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Interior Property (Excel)

 Copy code hover
[image]

FormatCondition.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object.

Syntax

expression .Interior

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.NumberFormat Property (Excel)

 Copy code hover
[image]

FormatCondition.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .NumberFormat

expression A variable that represents a FormatCondition object.

Remarks

The number format is specified using the same format codes displayed on the Number tab of the Format Cells dialog box. You can use a built-in number format, for example "General", or create a custom number format.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Operator Property (Excel)

 Copy code hover
[image]

FormatCondition.Operator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the operator for the conditional format.

Syntax

expression .Operator

expression A variable that represents a FormatCondition object.

Example

This example changes the formula for conditional format one, for cells E1:E10 if the formula specifies "less than 5."

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions(1)
 If .Operator = xlLess And .Formula1 = "5" Then
 .Modify xlCellValue, xlBetween, "5", "15"
 End If
End With

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Parent Property (Excel)

 Copy code hover
[image]

FormatCondition.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Priority Property (Excel)

 Copy code hover
[image]

FormatCondition.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a FormatCondition object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.PTCondition Property (Excel)

 Copy code hover
[image]

FormatCondition.PTCondition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.ScopeType Property (Excel)

 Copy code hover
[image]

FormatCondition.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents a FormatCondition object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.StopIfTrue Property (Excel)

 Copy code hover
[image]

FormatCondition.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents a FormatCondition object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Text Property (Excel)

 Copy code hover
[image]

FormatCondition.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value specifying the text string used by the conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .Text

expression A variable that represents a FormatCondition object.

Remarks

This property is ignored if the Type property is not set to xlTextString.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.TextOperator Property (Excel)

 Copy code hover
[image]

FormatCondition.TextOperator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlContainsOperator enumeration, specifying the text search performed by the conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .TextOperator

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Type Property (Excel)

 Copy code hover
[image]

FormatCondition.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value, containing a xlFormatConditionType value, that represents the object type.

Syntax

expression .Type

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition Methods (Excel)

 Copy code hover
[image]

FormatCondition Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Modify | Modifies an existing conditional format.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


FormatCondition.Delete Method (Excel)

 Copy code hover
[image]

FormatCondition.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a FormatCondition object.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.Modify Method (Excel)

 Copy code hover
[image]

FormatCondition.Modify Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies an existing conditional format.

Syntax

expression .Modify(Type, Operator, Formula1, Formula2)

expression A variable that represents a FormatCondition object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFormatConditionType | Specifies whether the conditional format is based on a cell value or an expression.
Operator | Optional | Variant | An XlFormatConditionOperator value that represents the conditional format operator. This parameter is ignored if Type is set to xlExpression.
Formula1 | Optional | Variant | The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula.
Formula2 | Optional | Variant | The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula..

Example

This example modifies an existing conditional format for cells E1:E10.

VBA Copy code Copy code
Worksheets(1).Range("e1:e10").FormatConditions(1) _
 .Modify xlCellValue, xlLess, "=$a$1"

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

FormatCondition.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents a FormatCondition object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.SetFirstPriority Method (Excel)

 Copy code hover
[image]

FormatCondition.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents a FormatCondition object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatCondition.SetLastPriority Method (Excel)

 Copy code hover
[image]

FormatCondition.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents a FormatCondition object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

FormatCondition Object

Other resources

FormatCondition Object Members


FormatConditions Object (Excel)

 Copy code hover
[image]

FormatConditions Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of conditional formats for a single range.

Remarks

The FormatConditions collection can contain multiple conditional formats. Each format is represented by a FormatCondition object.

For more information about conditional formats, see the FormatCondition object.

Use the FormatConditions property to return a FormatConditions object. Use the Add method to create a new conditional format, and use the Modify method to change an existing conditional format.

Example

The following example adds a conditional format to cells E1:E10.

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions _
 .Add(xlCellValue, xlGreater, "=$a$1")
 With .Borders
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 6
 End With
 With .Font
 .Bold = True
 .ColorIndex = 3
 End With
End With

See also

Concepts

Excel Object Model Reference

Other resources

FormatConditions Object Members


FormatConditions Members (Excel)

 Copy code hover
[image]

FormatConditions Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of conditional formats for a single range.

Methods

Name | Description
Add | Adds a new conditional format.
AddAboveAverage | Returns a new AboveAverage object representing a conditional formatting rule for the specified range.
AddColorScale | Returns a new ColorScale object representing a conditional formatting rule that uses gradations in cell colors to indicate relative differences in the values of cells included in a selected range.
AddDatabar | Returns a Databar object representing a data bar conditional formatting rule for the specified range.
AddIconSetCondition | Returns a new IconSetCondition object which represents an icon set conditional formatting rule for the specified range.
AddTop10 | Returns a Top10 object representing a conditional formatting rule for the specified range.
AddUniqueValues | Returns a new UniqueValues object representing a conditional formatting rule for the specified range.
Delete | Deletes the object.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


FormatConditions Properties (Excel)

 Copy code hover
[image]

FormatConditions Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


FormatConditions.Application Property (Excel)

 Copy code hover
[image]

FormatConditions.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a FormatConditions object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.Count Property (Excel)

 Copy code hover
[image]

FormatConditions.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a FormatConditions object.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.Creator Property (Excel)

 Copy code hover
[image]

FormatConditions.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a FormatConditions object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.Parent Property (Excel)

 Copy code hover
[image]

FormatConditions.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a FormatConditions object.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions Methods (Excel)

 Copy code hover
[image]

FormatConditions Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new conditional format.
AddAboveAverage | Returns a new AboveAverage object representing a conditional formatting rule for the specified range.
AddColorScale | Returns a new ColorScale object representing a conditional formatting rule that uses gradations in cell colors to indicate relative differences in the values of cells included in a selected range.
AddDatabar | Returns a Databar object representing a data bar conditional formatting rule for the specified range.
AddIconSetCondition | Returns a new IconSetCondition object which represents an icon set conditional formatting rule for the specified range.
AddTop10 | Returns a Top10 object representing a conditional formatting rule for the specified range.
AddUniqueValues | Returns a new UniqueValues object representing a conditional formatting rule for the specified range.
Delete | Deletes the object.
Item | Returns a single object from a collection.


FormatConditions.Add Method (Excel)

 Copy code hover
[image]

FormatConditions.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new conditional format.

Syntax

expression .Add(Type, Operator, Formula1, Formula2)

expression A variable that represents a FormatConditions object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFormatConditionType | . Specifies whether the conditional format is based on a cell value or an expression.
Operator | Optional | Variant | The conditional format operator. Can be one of the following XlFormatConditionOperator constants: xlBetween, xlEqual, xlGreater, xlGreaterEqual, xlLess, xlLessEqual, xlNotBetween, or xlNotEqual. If Type is xlExpression, the Operator argument is ignored.
Formula1 | Optional | Variant | The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula.
Formula2 | Optional | Variant | The value or expression associated with the second part of the conditional format when Operator is xlBetween or xlNotBetween (otherwise, this argument is ignored). Can be a constant value, a string value, a cell reference, or a formula.

Return Value

A FormatCondition object that represents the new conditional format.

Remarks

You cannot define more than three conditional formats for a range. Use the Modify method to modify an existing conditional format, or use the Delete method to delete an existing format before adding a new one.

Example

This example adds a conditional format to cells E1:E10.

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions _
 .Add(xlCellValue, xlGreater, "=$a$1")
 With .Borders
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 6
 End With
 With .Font
 .Bold = True
 .ColorIndex = 3
 End With
End With

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddAboveAverage Method (Excel)

 Copy code hover
[image]

FormatConditions.AddAboveAverage Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a new AboveAverage object representing a conditional formatting rule for the specified range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddAboveAverage

expression A variable that represents a FormatConditions object.

Return Value

AboveAverage object

Remarks

The AboveAverage object is used to find values above or below an average or standard deviation in a range of cells. For example, you can find the above average performers in an annual performance review or you can locate manufactured materials that fall below two standard deviations in a quality rating.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddColorScale Method (Excel)

 Copy code hover
[image]

FormatConditions.AddColorScale Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a new ColorScale object representing a conditional formatting rule that uses gradations in cell colors to indicate relative differences in the values of cells included in a selected range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddColorScale(ColorScaleType)

expression A variable that represents a FormatConditions object.

Parameters

Name | Required/Optional | Data Type | Description
ColorScaleType | Required | Long | The type of color scale.

Return Value

ColorScale object

Remarks

Color scales are visual guides that help you understand data distribution and variation. A color scale helps you identify relative differences in the values of cells in a given range by using color variation. Different colors and gradations between colors represent differences in cell values. For example, in a three-color scale, you can specify that cells with the highest relative data values are green, cells with intermediate values are yellow, and cells with the lowest values are red.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddDatabar Method (Excel)

 Copy code hover
[image]

FormatConditions.AddDatabar Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Databar object representing a data bar conditional formatting rule for the specified range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddDatabar

expression A variable that represents a FormatConditions object.

Return Value

Databar object

Remarks

Data bars help you see the value of a cell relative to other cells. The length of the data bar represents the value in the cell. A longer bar represents a higher value and a shorter bar represents a lower value. Data bars are useful in spotting higher and lower numbers especially with large amounts of data, such as top and bottom selling toys in a holiday sales report.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddIconSetCondition Method (Excel)

 Copy code hover
[image]

FormatConditions.AddIconSetCondition Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a new IconSetCondition object which represents an icon set conditional formatting rule for the specified range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddIconSetCondition

expression A variable that represents a FormatConditions object.

Return Value

IconSetCondition object

Remarks

Use an icon set to annotate and classify data into three to five categories separated by a threshold value. Each icon represents a range of values. For example, in the 3 Arrows icon set, the red up arrow represents higher values, the yellow sideways arrow represents middle values, and the green down arrow represents lower values.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddTop10 Method (Excel)

 Copy code hover
[image]

FormatConditions.AddTop10 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Top10 object representing a conditional formatting rule for the specified range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddTop10

expression A variable that represents a FormatConditions object.

Return Value

Top10 object

Remarks

Using the Top10 object, you can find the highest and lowest values in a range of cells based on a cutoff value that you specify. For example, you can find the top five selling products in a regional report, the bottom 15 percent of products in a customer survey, or the top 25 salaries in a department personnel analysis.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.AddUniqueValues Method (Excel)

 Copy code hover
[image]

FormatConditions.AddUniqueValues Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a new UniqueValues object representing a conditional formatting rule for the specified range.

Version Information

Version Added: Excel 2007

Syntax

expression .AddUniqueValues

expression A variable that represents a FormatConditions object.

Return Value

UniqueValues object

Remarks

You can use the UniqueValues object to quickly visualize cells that contain either unique or duplicate values.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.Delete Method (Excel)

 Copy code hover
[image]

FormatConditions.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a FormatConditions object.

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FormatConditions.Item Method (Excel)

 Copy code hover
[image]

FormatConditions.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a FormatConditions object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

An Object value that represents an object contained by the collection.

Example

This example sets format properties for an existing conditional format for cells E1:E10.

VBA Copy code Copy code
With Worksheets(1).Range("e1:e10").FormatConditions.Item(1)
 With .Borders
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 6
 End With
End With

See also

Concepts

FormatConditions Object

Other resources

FormatConditions Object Members


FreeformBuilder Object (Excel)

 Copy code hover
[image]

FreeformBuilder Object (Excel)
See also Send feedback

Represents the geometry of a freeform while it's being built.

Remarks

Use the BuildFreeform method to return a FreeformBuilder object. Use the AddNodes method to add nodes to the freefrom. Use the ConvertToShape method to create the shape defined in the FreeformBuilder object and add it to the Shapes collection.

Example

The following example adds a freeform with four segments to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

Excel Object Model Reference

Other resources

FreeformBuilder Object Members


FreeformBuilder Members (Excel)

 Copy code hover
[image]

FreeformBuilder Members (Excel)
Send feedback

Published: July 16, 2012

Represents the geometry of a freeform while it's being built.

Methods

Name | Description
AddNodes | Adds a point in the current shape and then draws a line from the current node to last node that was added.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


FreeformBuilder Properties (Excel)

 Copy code hover
[image]

FreeformBuilder Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


FreeformBuilder.Application Property (Excel)

 Copy code hover
[image]

FreeformBuilder.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a FreeformBuilder object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.Creator Property (Excel)

 Copy code hover
[image]

FreeformBuilder.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a FreeformBuilder object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.Parent Property (Excel)

 Copy code hover
[image]

FreeformBuilder.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a FreeformBuilder object.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder Methods (Excel)

 Copy code hover
[image]

FreeformBuilder Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddNodes | Adds a point in the current shape and then draws a line from the current node to last node that was added.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.


FreeformBuilder.AddNodes Method (Excel)

 Copy code hover
[image]

FreeformBuilder.AddNodes Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a point in the current shape and then draws a line from the current node to last node that was added.

Syntax

expression .AddNodes(SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression A variable that represents a FreeformBuilder object.

Parameters

Name | Required/Optional | Data Type | Description
SegmentType | Required | MsoSegmentType | The type of segment to be added.
EditingType | Required | MsoEditingType | The editing property of the vertex.
X1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the first control point for the new segment.
Y1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the first control point for the new segment.
X2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
X3 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Remarks

MsoSegmentType can be one of these MsoSegmentType constants.

msoSegmentLine

msoSegmentCurve

MsoEditingType can be one of these MsoEditingType constants.

msoEditingAuto

msoEditingCorner

Cannot be msoEditingSmooth or msoEditingSymmetric If SegmentType is msoSegmentLine, EditingType must be msoEditingAuto.

Example

This example adds a freeform with four segments to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
    .AddNodes msoSegmentCurve, msoEditingCorner, _
        380, 230, 400, 250, 450, 300
    .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
    .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
    .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
    .ConvertToShape
End With

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.ConvertToShape Method (Excel)

 Copy code hover
[image]

FreeformBuilder.ConvertToShape Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.

Syntax

expression .ConvertToShape

expression A variable that represents a FreeformBuilder object.

Return Value

Shape

Remarks

You must apply the AddNodes method to a FreeformBuilder object at least once before you use the ConvertToShape method.

Example

This example adds a freeform with five vertices to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FullSeriesCollection Object (Excel)

 Copy code hover
[image]

FullSeriesCollection Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the full set of Series Object (Excel) objects in a chart.

Version information

Version Added: Excel 2013

Remarks

The FullSeriesCollection Object (Excel) object enables you to get a filtered out Series Object (Excel) object and filter it back in. It also enables you to iterate over the full set of Series object, filtered out or visible, programmatically. By having the existing SeriesCollection Object (Excel) object contain only the visible series you can programmatically perform operations on only the visible series. It also prevents Microsoft Excel from breaking existing chart solutions on charts with filtered out data.

Example

The following example displays a message box with the name of the second Series Object (Excel) object in the second chart.

Visual Basic Copy code Copy code
MsgBox Chart(1).FullSeriesCollection.Item(2).Name

See also

Concepts

Excel Object Model Reference
SeriesCollection

Other resources

FullSeriesCollection Object Members


FullSeriesCollection Members (Excel)

 Copy code hover
[image]

FullSeriesCollection Members (Excel)
Send feedback

Published: July 16, 2012

Represents the full set of Series Object (Excel) objects in a chart.

Methods

Name | Description
Item | Returns a single object from the FullSeriesCollection Object (Excel) object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of Series Object (Excel) objects in the FullSeriesCollection Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FullSeriesCollection object. Read-only.


FullSeriesCollection Properties (Excel)

 Copy code hover
[image]

FullSeriesCollection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of Series Object (Excel) objects in the FullSeriesCollection Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FullSeriesCollection object. Read-only.


FullSeriesCollection.Application Property (Excel)

 Copy code hover
[image]

FullSeriesCollection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a FullSeriesCollection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

FullSeriesCollection Object Members
FullSeriesCollection Object


FullSeriesCollection.Count Property (Excel)

 Copy code hover
[image]

FullSeriesCollection.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of Series Object (Excel) objects in the FullSeriesCollection Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a FullSeriesCollection Object (Excel)object.

Property value

INT32

See also

Other resources

FullSeriesCollection Object Members
FullSeriesCollection Object


FullSeriesCollection.Creator Property (Excel)

 Copy code hover
[image]

FullSeriesCollection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a FullSeriesCollection Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

FullSeriesCollection Object Members
FullSeriesCollection Object


FullSeriesCollection.Parent Property (Excel)

 Copy code hover
[image]

FullSeriesCollection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FullSeriesCollection object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a FullSeriesCollection Object (Excel) object.

Remarks

Typically the chart to which this FullSeriesCollection object belongs is returned as the parent.

Property value

OBJECT

See also

Other resources

FullSeriesCollection Object Members
FullSeriesCollection Object


FullSeriesCollection Methods (Excel)

 Copy code hover
[image]

FullSeriesCollection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the FullSeriesCollection Object (Excel) object.


FullSeriesCollection.Item Method (Excel)

 Copy code hover
[image]

FullSeriesCollection.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the FullSeriesCollection Object (Excel) object.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a FullSeriesCollection Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | Variant | The index number for the object.
Index | Required | VARIANT |

Return value

A Series Object (Excel) object contained in the collection.

See also

Other resources

FullSeriesCollection Object Members
FullSeriesCollection Object


Graphic Object (Excel)

 Copy code hover
[image]

Graphic Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains properties that apply to header and footer picture objects.

Remarks

There are several properties of the PageSetup object that return the Graphic object.

Use the CenterFooterPicture , CenterHeaderPicture , LeftFooterPicture , LeftHeaderPicture , RightFooterPicture , or RightHeaderPicture properties to return a Graphic object.

Note Note

It is required that "&G" is a part of the LeftFooter string in order for the image to show up in the left footer.

Example

The following example adds a picture titled: Sample.jpg from the C:\ drive to the left section of the footer. This example assumes that a file called Sample.jpg exists on the C:\ drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.LeftFooterPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the left footer.
 ActiveSheet.PageSetup.LeftFooter = "&G"

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Graphic Object Members


Graphic Members (Excel)

 Copy code hover
[image]

Graphic Members (Excel)
Send feedback

Published: July 16, 2012

Contains properties that apply to header and footer picture objects.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Filename | Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.
Height | Returns or sets a Single value that represents the height, in points, of the object.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Parent | Returns the parent object for the specified object. Read-only.
Width | Returns or sets a Single value that represents the width, in points, of the object.


Graphic Properties (Excel)

 Copy code hover
[image]

Graphic Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Filename | Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.
Height | Returns or sets a Single value that represents the height, in points, of the object.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Parent | Returns the parent object for the specified object. Read-only.
Width | Returns or sets a Single value that represents the width, in points, of the object.


Graphic.Application Property (Excel)

 Copy code hover
[image]

Graphic.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Graphic object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Brightness Property (Excel)

 Copy code hover
[image]

Graphic.Brightness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.

Syntax

expression .Brightness

expression A variable that represents a Graphic object.

Example

This example sets the brightness for shape one on myDocument. Shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).PictureFormat.Brightness = 0.3

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.ColorType Property (Excel)

 Copy code hover
[image]

Graphic.ColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.

Syntax

expression .ColorType

expression An expression that returns a Graphic object.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Contrast Property (Excel)

 Copy code hover
[image]

Graphic.Contrast Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.

Syntax

expression .Contrast

expression An expression that returns a Graphic object.

Example

This example sets the contrast for shape one on myDocument. Shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).PictureFormat.Contrast = 0.8

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Creator Property (Excel)

 Copy code hover
[image]

Graphic.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Graphic object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.CropBottom Property (Excel)

 Copy code hover
[image]

Graphic.CropBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropBottom

expression An expression that returns a Graphic object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the CropBottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture.

Example

This example crops 20 points off the bottom of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropBottom = 20

Using this example, you can specify the percentage you want to crop off the bottom of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop off" & _
 " the bottom of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleHeight 1, True
 origHeight = .Height
 .Delete
End With
cropPoints = origHeight * percentToCrop / 100
shapeToCrop.PictureFormat.CropBottom = cropPoints

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.CropLeft Property (Excel)

 Copy code hover
[image]

Graphic.CropLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropLeft

expression An expression that returns a Graphic object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the CropLeft property to 50, 100 points (not 50) will be cropped off the left side of your picture.

Example

This example crops 20 points off the left side of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropLeft = 20

Using this example, you can specify the percentage you want to crop off the left side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the left of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleWidth 1, True
 origWidth = .Width
 .Delete
End With
cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropLeft = cropPoints

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.CropRight Property (Excel)

 Copy code hover
[image]

Graphic.CropRight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropRight

expression An expression that returns a Graphic object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the CropRight property to 50, 100 points (not 50) will be cropped off the right side of your picture.

Example

This example crops 20 points off the right side of shape three on myDocument. For this example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropRight = 20

Using this example, you can specify the percentage you want to cropp off the right side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the right of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleWidth 1, True
 origWidth = .Width
 .Delete
End With
cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropRight = cropPoints

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.CropTop Property (Excel)

 Copy code hover
[image]

Graphic.CropTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropTop

expression An expression that returns a Graphic object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the CropTop property to 50, 100 points (not 50) will be cropped off the top of your picture.

Example

This example crops 20 points off the top of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropTop = 20

This example allows you to specify the percentage you want to crop off the top of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the top of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleHeight 1, True
 origHeight = .Height
 .Delete
End With
cropPoints = origHeight * percentToCrop / 100
shapeToCrop.PictureFormat.CropTop = cropPoints

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Filename Property (Excel)

 Copy code hover
[image]

Graphic.Filename Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.

Syntax

expression .Filename

expression A variable that represents a Graphic object.

Remarks

The FileName property generates an error if a folder in the specified path doesn't exist.

Example

This example sets the location where the first item in the active workbook is to be saved.

VBA Copy code Copy code
ActiveWorkbook.PublishObjects(1).FileName = _
 "\\Server2\Q1\StockReport.htm"

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Height Property (Excel)

 Copy code hover
[image]

Graphic.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a Graphic object.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.LockAspectRatio Property (Excel)

 Copy code hover
[image]

Graphic.LockAspectRatio Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression A variable that represents a Graphic object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse. You can change the height and width of the shape independently of one another when you resize it.

msoTriStateMixed

msoTriStateToggle

msoTrue. The specified shape retains its original proportions when you resize it.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Parent Property (Excel)

 Copy code hover
[image]

Graphic.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Graphic object.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Graphic.Width Property (Excel)

 Copy code hover
[image]

Graphic.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a Graphic object.

See also

Concepts

Graphic Object

Other resources

Graphic Object Members


Gridlines Object (Excel)

 Copy code hover
[image]

Gridlines Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents major or minor gridlines on a chart axis.

Remarks

Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. This object isn't a collection. There's no object that represents a single gridline; you either have all gridlines for an axis turned on or all of them turned off.

Use the MajorGridlines property to return the GridLines object that represents the major gridlines for the axis. Use the MinorGridlines property to return the GridLines object that represents the minor gridlines. It's possible to return both major and minor gridlines at the same time.

Example

The following example turns on major gridlines for the category axis on the chart sheet named "Chart1" and then formats the gridlines to be blue dashed lines.

VBA Copy code Copy code
With Charts("chart1").Axes(xlCategory)
 .HasMajorGridlines = True
 .MajorGridlines.Border.Color = RGB(0, 0, 255)
 .MajorGridlines.Border.LineStyle = xlDash
End With

See also

Concepts

Excel Object Model Reference

Other resources

Gridlines Object Members


Gridlines Members (Excel)

 Copy code hover
[image]

Gridlines Members (Excel)
Send feedback

Published: July 16, 2012

Represents major or minor gridlines on a chart axis.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


Gridlines Properties (Excel)

 Copy code hover
[image]

Gridlines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


Gridlines.Application Property (Excel)

 Copy code hover
[image]

Gridlines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Gridlines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Border Property (Excel)

 Copy code hover
[image]

Gridlines.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a Gridlines object.

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Creator Property (Excel)

 Copy code hover
[image]

Gridlines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Gridlines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Format Property (Excel)

 Copy code hover
[image]

Gridlines.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Gridlines object.

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Name Property (Excel)

 Copy code hover
[image]

Gridlines.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Gridlines object.

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Parent Property (Excel)

 Copy code hover
[image]

Gridlines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Gridlines object.

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines Methods (Excel)

 Copy code hover
[image]

Gridlines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


Gridlines.Delete Method (Excel)

 Copy code hover
[image]

Gridlines.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Gridlines object.

Return Value

Variant

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


Gridlines.Select Method (Excel)

 Copy code hover
[image]

Gridlines.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Gridlines object.

Return Value

Variant

See also

Concepts

Gridlines Object

Other resources

Gridlines Object Members


GroupShapes Object (Excel)

 Copy code hover
[image]

GroupShapes Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the individual shapes within a grouped shape.

Remarks

Each shape is represented by a Shape object. Using the Item method with this object, you can work with single shapes within a group without having to ungroup them.

Example

Use the GroupItems property to return the GroupShapes collection. Use GroupItems(index), where index is the number of the individual shape within the grouped shape, to return a single shape from the GroupShapes collection. The following example adds three triangles to myDocument, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 10, 10, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 150, 10, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 300, 10, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
End With

See also

Concepts

Excel Object Model Reference

Other resources

GroupShapes Object Members


GroupShapes Members (Excel)

 Copy code hover
[image]

GroupShapes Members (Excel)
Send feedback

Published: July 16, 2012

Represents the individual shapes within a grouped shape.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.


GroupShapes Properties (Excel)

 Copy code hover
[image]

GroupShapes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.


GroupShapes.Application Property (Excel)

 Copy code hover
[image]

GroupShapes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a GroupShapes object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


GroupShapes.Count Property (Excel)

 Copy code hover
[image]

GroupShapes.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a GroupShapes object.

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


GroupShapes.Creator Property (Excel)

 Copy code hover
[image]

GroupShapes.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a GroupShapes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


GroupShapes.Parent Property (Excel)

 Copy code hover
[image]

GroupShapes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a GroupShapes object.

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


GroupShapes.Range Property (Excel)

 Copy code hover
[image]

GroupShapes.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Syntax

expression .Range(Index)

expression A variable that represents a GroupShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual shapes to be included in the range. Can be an integer that specifies the index number of the shape, a string that specifies the name of the shape, or an array that contains either integers or strings.

Remarks

Although you can use the Range property to return any number of shapes, it is simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).

Example

This example sets the fill pattern for shapes one and three on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.Range(Array(1, 3)) _
 .Fill.Patterned msoPatternHorizontalBrick

To specify an array of integers or strings for Index, you can use the Array function. For example, the following instruction returns two shapes specified by name.

VBA Copy code Copy code
Dim arShapes() As Variant
Dim objRange As Object
arShapes = Array("Oval 4", "Rectangle 5")
Set objRange = ActiveSheet.Shapes.Range(arShapes)

In Microsoft Excel, you cannot use this property to return a ShapeRange object containing all the Shape objects on a worksheet. Instead, use the following code:

VBA Copy code Copy code
Worksheets(1).Shapes.SelectAll ' select all shapes
set sr = Selection.ShapeRange ' create ShapeRange

This example sets the fill pattern for the shapes named "Oval 4" and "Rectangle 5" on myDocument.

VBA Copy code Copy code
Dim arShapes() As Variant
Dim objRange As Object
Set myDocument = Worksheets(1)
arShapes = Array("Oval 4", "Rectangle 5")
Set objRange = myDocument.Shapes.Range(arShapes)
objRange.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myRange = myDocument.Shapes.Range(1)
myRange.Fill.Patterned msoPatternHorizontalBrick

This example creates an array that contains all the AutoShapes on myDocument, uses that array to define a shape range, and then distributes all the shapes in that range horizontally.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 numShapes = .Count
 If numShapes > 1 Then
 numAutoShapes = 1
 ReDim autoShpArray(1 To numShapes)
 For i = 1 To numShapes
 If .Item(i).Type = msoAutoShape Then
 autoShpArray(numAutoShapes) = .Item(i).Name
 numAutoShapes = numAutoShapes + 1
 End If
 Next
 If numAutoShapes > 1 Then
 ReDim Preserve autoShpArray(1 To numAutoShapes)
 Set asRange = .Range(autoShpArray)
 asRange.Distribute msoDistributeHorizontally, False
 End If
 End If
End With

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


GroupShapes Methods (Excel)

 Copy code hover
[image]

GroupShapes Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


GroupShapes.Item Method (Excel)

 Copy code hover
[image]

GroupShapes.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a GroupShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Shape object contained by the collection.

Example

This example sets the OnAction property for shape two in a shape range. If the sr variable doesn't represent a ShapeRange object, this example fails.

VBA Copy code Copy code
Dim sr As Shape
sr.Item(2).OnAction = "ShapeAction"

See also

Concepts

GroupShapes Object

Other resources

GroupShapes Object Members


HeaderFooter Object (Excel)

 Copy code hover
[image]

HeaderFooter Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single header or footer. The HeaderFooter object is a member of the HeadersFooters collection.

Version Information

Version Added: Excel 2007

Remarks

You can also return a single HeaderFooter object by using the HeaderFooter property with a Selection object.

Note Note

You cannot add HeaderFooter objects to the HeadersFooters collection.

Use the DifferentFirstPageHeaderFooter property with the PageSetup object to specify a different first page.

Example

The following example adds the date and time to the center header in the active worksheet.

Copy code Copy code
With ActiveSheet.PageSetup
 .CenterHeader = "&D&T"
 .OddAndEvenPagesHeaderFooter = False
 .DifferentFirstPageHeaderFooter = False
 .ScaleWithDocHeaderFooter = True
 .AlignMarginsHeaderFooter = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

HeaderFooter Object Members


HeaderFooter Members (Excel)

 Copy code hover
[image]

HeaderFooter Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single header or footer. The HeaderFooter object is a member of the HeadersFooters collection.

Properties

Name | Description
Picture | Returns a Picture object that represents a picture field included in the specified header or footer. Read-only.
Text | Returns or sets a Text object that represents text included in the specified header or footer. Read/write.


HeaderFooter Properties (Excel)

 Copy code hover
[image]

HeaderFooter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Picture | Returns a Picture object that represents a picture field included in the specified header or footer. Read-only.
Text | Returns or sets a Text object that represents text included in the specified header or footer. Read/write.


HeaderFooter.Picture Property (Excel)

 Copy code hover
[image]

HeaderFooter.Picture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Picture object that represents a picture field included in the specified header or footer. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Picture

expression A variable that represents a HeaderFooter object.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Text Property (Excel)

 Copy code hover
[image]

HeaderFooter.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Text object that represents text included in the specified header or footer. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Text

expression A variable that represents a HeaderFooter object.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HiLoLines Object (Excel)

 Copy code hover
[image]

HiLoLines Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the high-low lines in a chart group.

Remarks

High-low lines connect the highest point with the lowest point in every category in the chart group. Only 2-D line groups can have high-low lines. This object isn't a collection. There's no object that represents a single high-low line; you either have high-low lines turned on for all points in a chart group or you have them turned off.

If the HasHiLoLines property is False, most properties of the HiLoLines object are disabled.

Example

Use the HiLoLines property to return the HiLoLines object. The following example uses the HasHiLowLines property to add HiLowLines to embedded chart one (the chart must be a line chart) on worksheet one. The example then makes the high-low lines blue.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Activate
ActiveChart.ChartGroups(1).HasHiLoLines = True
ActiveChart.ChartGroups(1).HiLoLines.Border.Color = RGB(0, 0, 255)

See also

Concepts

Excel Object Model Reference

Other resources

HiLoLines Object Members


HiLoLines Members (Excel)

 Copy code hover
[image]

HiLoLines Members (Excel)
Send feedback

Published: July 16, 2012

Represents the high-low lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


HiLoLines Properties (Excel)

 Copy code hover
[image]

HiLoLines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


HiLoLines.Application Property (Excel)

 Copy code hover
[image]

HiLoLines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a HiLoLines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Border Property (Excel)

 Copy code hover
[image]

HiLoLines.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Creator Property (Excel)

 Copy code hover
[image]

HiLoLines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a HiLoLines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Format Property (Excel)

 Copy code hover
[image]

HiLoLines.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Name Property (Excel)

 Copy code hover
[image]

HiLoLines.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Parent Property (Excel)

 Copy code hover
[image]

HiLoLines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines Methods (Excel)

 Copy code hover
[image]

HiLoLines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


HiLoLines.Delete Method (Excel)

 Copy code hover
[image]

HiLoLines.Delete Method (Excel)
See also Send feedback

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a HiLoLines object.

Return Value

Variant

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Select Method (Excel)

 Copy code hover
[image]

HiLoLines.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a HiLoLines object.

Return Value

Variant

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HPageBreak Object (Excel)

 Copy code hover
[image]

HPageBreak Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a horizontal page break.

Remarks

The HPageBreak object is a member of the HPageBreaks collection.

Note Note

There is a limit of 1026 horizontal page breaks per sheet.

Example

Use HPageBreaks(index), where index is the index number of the page break, to return an HPageBreak object. The following example changes the location of horizontal page break one.

VBA Copy code Copy code
Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")

See also

Concepts

Excel Object Model Reference

Other resources

HPageBreak Object Members


HPageBreak Members (Excel)

 Copy code hover
[image]

HPageBreak Members (Excel)
Send feedback

Published: July 16, 2012

Represents a horizontal page break.

Methods

Name | Description
Delete | Deletes the object.
DragOff | Drags a page break out of the print area.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Extent | Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.
Location | Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a XlPageBreak value that represents the page break type.


HPageBreak Properties (Excel)

 Copy code hover
[image]

HPageBreak Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Extent | Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.
Location | Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a XlPageBreak value that represents the page break type.


HPageBreak.Application Property (Excel)

 Copy code hover
[image]

HPageBreak.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a HPageBreak object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.Creator Property (Excel)

 Copy code hover
[image]

HPageBreak.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a HPageBreak object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.Extent Property (Excel)

 Copy code hover
[image]

HPageBreak.Extent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.

Syntax

expression .Extent

expression A variable that represents a HPageBreak object.

Example

This example displays the total number of full-screen and print-area horizontal page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).HPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.Location Property (Excel)

 Copy code hover
[image]

HPageBreak.Location Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.

Syntax

expression .Location

expression A variable that represents a HPageBreak object.

Example

This example moves the horizontal page-break location.

VBA Copy code Copy code
Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.Parent Property (Excel)

 Copy code hover
[image]

HPageBreak.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a HPageBreak object.

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.Type Property (Excel)

 Copy code hover
[image]

HPageBreak.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPageBreak value that represents the page break type.

Syntax

expression .Type

expression A variable that represents a HPageBreak object.

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak Methods (Excel)

 Copy code hover
[image]

HPageBreak Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
DragOff | Drags a page break out of the print area.


HPageBreak.Delete Method (Excel)

 Copy code hover
[image]

HPageBreak.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a HPageBreak object.

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreak.DragOff Method (Excel)

 Copy code hover
[image]

HPageBreak.DragOff Method (Excel)
See also Send feedback

Published: July 16, 2012

Drags a page break out of the print area.

Syntax

expression .DragOff(Direction, RegionIndex)

expression A variable that represents a HPageBreak object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | XlDirection | The direction in which the page break is dragged.
RegionIndex | Required | Long | The print-area region index for the page break (the region where the mouse pointer is located when the mouse button is pressed if the user drags the page break). If the print area is contiguous, there's only one print region. If the print area is discontiguous, there's more than one print region.

Remarks

This method exists primarily for the macro recorder. You can use the Delete method to delete a page break in Visual Basic.

Example

This example deletes vertical page break one from the active sheet by dragging it off the right edge of print region one.

VBA Copy code Copy code
ActiveSheet.VPageBreaks(1).DragOff xlToRight, 1

See also

Concepts

HPageBreak Object

Other resources

HPageBreak Object Members


HPageBreaks Object (Excel)

 Copy code hover
[image]

HPageBreaks Object (Excel)
See also Send feedback

Published: July 16, 2012

The collection of horizontal page breaks within the print area.

Remarks

Each horizontal page break is represented by an HPageBreak object.

If you add a page break that does not intersect the print area, then the newly-added HPageBreak object will not appear in the HPageBreaks collection for the print area. The contents of the collection may change if the print area is resized or redefined.

When the Application property, Count property, Item property, Parent property or Add method is used in conjunction with the HPageBreaks property:

  • For an automatic print area, the HPageBreaks property applies only to the page breaks within the print area.

  • For a user-defined print area of the same range, the HPageBreaks property applies to all of the page breaks.

Note Note

There is a limit of 1026 horizontal page breaks per sheet.

Example

Use the HPageBreaks property to return the HPageBreaks collection. Use the Add method to add a horizontal page break. The following example adds a horizontal page break above the active cell.

VBA Copy code Copy code
ActiveSheet.HPageBreaks.Add Before:=ActiveCell

See also

Concepts

Excel Object Model Reference

Other resources

HPageBreaks Object Members


HPageBreaks Members (Excel)

 Copy code hover
[image]

HPageBreaks Members (Excel)
Send feedback

Published: July 16, 2012

The collection of horizontal page breaks within the print area.

Methods

Name | Description
Add | Adds a horizontal page break.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


HPageBreaks Properties (Excel)

 Copy code hover
[image]

HPageBreaks Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


HPageBreaks.Application Property (Excel)

 Copy code hover
[image]

HPageBreaks.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a HPageBreaks object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


HPageBreaks.Count Property (Excel)

 Copy code hover
[image]

HPageBreaks.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a HPageBreaks object.

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


HPageBreaks.Creator Property (Excel)

 Copy code hover
[image]

HPageBreaks.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a HPageBreaks object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


HPageBreaks.Item Property (Excel)

 Copy code hover
[image]

HPageBreaks.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a HPageBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example changes the location of horizontal page break one.

VBA Copy code Copy code
Worksheets(1).HPageBreaks.Item(1).Location = .Range("e5")

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


HPageBreaks.Parent Property (Excel)

 Copy code hover
[image]

HPageBreaks.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a HPageBreaks object.

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


HPageBreaks Methods (Excel)

 Copy code hover
[image]

HPageBreaks Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a horizontal page break.


HPageBreaks.Add Method (Excel)

 Copy code hover
[image]

HPageBreaks.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a horizontal page break.

Syntax

expression .Add(Before)

expression A variable that represents a HPageBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Required | Object | A Range object. The range above which the new page break will be added.

Return Value

A HPageBreak object that represents the new horizontal page break.

Example

This example adds a horizontal page break above cell F25 and adds a vertical page break to the left of this cell.

VBA Copy code Copy code
With Worksheets(1)
 .HPageBreaks.Add.Range("F25")
 .VPageBreaks.Add .Range("F25")
End With

See also

Concepts

HPageBreaks Object

Other resources

HPageBreaks Object Members


Hyperlink Object (Excel)

 Copy code hover
[image]

Hyperlink Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a hyperlink.

Remarks

The Hyperlink object is a member of the Hyperlinks collection.

Example

Use the Hyperlink property to return the hyperlink for a shape (a shape can have only one hyperlink). The following example activates the hyperlink for shape one.

VBA Copy code Copy code
Worksheets(1).Shapes(1).Hyperlink.Follow NewWindow:=True

A range or worksheet can have more than one hyperlink. Use Hyperlinks(index), where index is the hyperlink number, to return a single Hyperlink object. The folllowing example activates hyperlink two in the range A1:B2.

VBA Copy code Copy code
Worksheets(1).Range("A1:B2").Hyperlinks(2).Follow

See also

Concepts

Excel Object Model Reference

Other resources

Hyperlink Object Members


Hyperlink Members (Excel)

 Copy code hover
[image]

Hyperlink Members (Excel)
Send feedback

Published: July 16, 2012

Represents a hyperlink.

Methods

Name | Description
AddToFavorites | Adds a shortcut to the workbook or hyperlink to the Favorites folder.
CreateNewDocument | Creates a new document linked to the specified hyperlink.
Delete | Deletes the object.
Follow | Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Properties

Name | Description
Address | Returns or sets a String value that represents the address of the target document.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EmailSubject | Returns or sets the text string of the specified hyperlink's e-mail subject line. The subject line is appended to the hyperlink's address. Read/write String.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range the specified hyperlink is attached to.
ScreenTip | Returns or sets the ScreenTip text for the specified hyperlink. Read/write String.
Shape | Returns a Shape object that represents the shape attached to the specified hyperlink.
SubAddress | Returns or sets the location within the document associated with the hyperlink. Read/write String.
TextToDisplay | Returns or sets the text to be displayed for the specified hyperlink. The default value is the address of the hyperlink. Read/write String.
Type | Returns a Long value, containing a MsoHyperlinkType constant, that represents the location of the HTML frame.


Hyperlink Properties (Excel)

 Copy code hover
[image]

Hyperlink Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Address | Returns or sets a String value that represents the address of the target document.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EmailSubject | Returns or sets the text string of the specified hyperlink's e-mail subject line. The subject line is appended to the hyperlink's address. Read/write String.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range the specified hyperlink is attached to.
ScreenTip | Returns or sets the ScreenTip text for the specified hyperlink. Read/write String.
Shape | Returns a Shape object that represents the shape attached to the specified hyperlink.
SubAddress | Returns or sets the location within the document associated with the hyperlink. Read/write String.
TextToDisplay | Returns or sets the text to be displayed for the specified hyperlink. The default value is the address of the hyperlink. Read/write String.
Type | Returns a Long value, containing a MsoHyperlinkType constant, that represents the location of the HTML frame.


Hyperlink.Address Property (Excel)

 Copy code hover
[image]

Hyperlink.Address Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the address of the target document.

Syntax

expression .Address

expression A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Application Property (Excel)

 Copy code hover
[image]

Hyperlink.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Hyperlink object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Creator Property (Excel)

 Copy code hover
[image]

Hyperlink.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Hyperlink object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.EmailSubject Property (Excel)

 Copy code hover
[image]

Hyperlink.EmailSubject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text string of the specified hyperlink's e-mail subject line. The subject line is appended to the hyperlink's address. Read/write String.

Syntax

expression .EmailSubject

expression A variable that represents a Hyperlink object.

Remarks

This property is usually used with e-mail hyperlinks.

The value of this property takes precedence over any e-mail subject line you have specified by using the Address property of the same Hyperlink object.

Example

This example sets the e-mail subject line for the first hyperlink in the first worksheet.

VBA Copy code Copy code
Worksheets(1).Hyperlinks(1).EmailSubject = "Quote Request"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Name Property (Excel)

 Copy code hover
[image]

Hyperlink.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Parent Property (Excel)

 Copy code hover
[image]

Hyperlink.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Range Property (Excel)

 Copy code hover
[image]

Hyperlink.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range the specified hyperlink is attached to.

Syntax

expression .Range

expression A variable that represents a Hyperlink object.

Example

The following example stores in a variable the address for the AutoFilter applied to the Crew worksheet.

VBA Copy code Copy code
rAddress = Worksheets("Crew").AutoFilter.Range.Address

This example scrolls through the workbook window until the hyperlink range is in the upper-left corner of the active window.

VBA Copy code Copy code
Workbooks(1).Activate
Set hr = ActiveSheet.Hyperlinks(1).Range
ActiveWindow.ScrollRow = hr.Row
ActiveWindow.ScrollColumn = hr.Column

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.ScreenTip Property (Excel)

 Copy code hover
[image]

Hyperlink.ScreenTip Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ScreenTip text for the specified hyperlink. Read/write String.

Syntax

expression .ScreenTip

expression A variable that represents a Hyperlink object.

Remarks

After the document has been saved to a Web page, the ScreenTip text may appear (for example) when the mouse pointer is positioned over the hyperlink while the document is being viewed in a Web browser. Some Web browsers may not support ScreenTips.

Example

This example sets the screen tip for the first hyperlink on the active worksheet.

VBA Copy code Copy code
ActiveSheet.Hyperlinks(1).ScreenTip = "Return to the home page"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Shape Property (Excel)

 Copy code hover
[image]

Hyperlink.Shape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the shape attached to the specified hyperlink.

Syntax

expression .Shape

expression An expression that returns a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.SubAddress Property (Excel)

 Copy code hover
[image]

Hyperlink.SubAddress Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location within the document associated with the hyperlink. Read/write String.

Syntax

expression .SubAddress

expression A variable that represents a Hyperlink object.

Example

This example topic adds a range location to the hyperlink for shape one.

VBA Copy code Copy code
Worksheets(1).Shapes(1).Hyperlink.SubAddress = "A1:B10"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.TextToDisplay Property (Excel)

 Copy code hover
[image]

Hyperlink.TextToDisplay Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text to be displayed for the specified hyperlink. The default value is the address of the hyperlink. Read/write String.

Syntax

expression .TextToDisplay

expression A variable that represents a Hyperlink object.

Example

This example sets the text to be displayed for the first hyperlink on the active worksheet.

VBA Copy code Copy code
ActiveSheet.Hyperlinks(1).TextToDisplay = _
 "Company Home Page"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Type Property (Excel)

 Copy code hover
[image]

Hyperlink.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value, containing a MsoHyperlinkType constant, that represents the location of the HTML frame.

Syntax

expression .Type

expression A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink Methods (Excel)

 Copy code hover
[image]

Hyperlink Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddToFavorites | Adds a shortcut to the workbook or hyperlink to the Favorites folder.
CreateNewDocument | Creates a new document linked to the specified hyperlink.
Delete | Deletes the object.
Follow | Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.


Hyperlink.AddToFavorites Method (Excel)

 Copy code hover
[image]

Hyperlink.AddToFavorites Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a shortcut to the workbook or hyperlink to the Favorites folder.

Syntax

expression .AddToFavorites

expression A variable that represents a Hyperlink object.

Example

This example adds a shortcut to the active workbook to the Favorites folder.

VBA Copy code Copy code
ActiveWorkbook.AddToFavorites

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.CreateNewDocument Method (Excel)

 Copy code hover
[image]

Hyperlink.CreateNewDocument Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new document linked to the specified hyperlink.

Syntax

expression .CreateNewDocument(Filename, EditNow, Overwrite)

expression A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The file name of the specified document.
EditNow | Required | Boolean | True to have the specified document open immediately in its associated editing environment.. The default value is True.
Overwrite | Required | Boolean | True to overwrite any existing file of the same name in the same folder. False if any existing file of the same name is preserved and the Filename argument specifies a new file name. The default value is False.

Example

This example creates a new document based on the new hyperlink in the first worksheet and then loads the document into Microsoft Excel for editing. The document is called "Report.xls," and it overwrites any file of the same name in the \\Server1\Annual folder.

VBA Copy code Copy code
With Worksheets(1)
 Set objHyper = _
 .Hyperlinks.Add(Anchor:=.Range("A10"), _
 Address:="\\Server1\Annual\Report.xls")
 objHyper.CreateNewDocument _
 FileName:="\\Server1\Annual\Report.xls", _
 EditNow:=True, Overwrite:=True
End With

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Delete Method (Excel)

 Copy code hover
[image]

Hyperlink.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Follow Method (Excel)

 Copy code hover
[image]

Hyperlink.Follow Method (Excel)
See also Send feedback

Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Syntax

expression .Follow(NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)

expression A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
NewWindow | Optional | Variant | True to display the target application in a new window. The default value is False.
AddHistory | Optional | Variant | Not used. Reserved for future use.
ExtraInfo | Optional | Variant | A String or byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name.
Method | Optional | Variant | Specifies the way ExtraInfo is attached. Can be one of the MsoExtraInfoMethod constants.
HeaderInfo | Optional | Variant | A String that specifies header information for the HTTP request. The defaut value is an empty string.

Example

This example loads the document attached to the hyperlink on shape one on worksheet one.

VBA Copy code Copy code
Worksheets(1).Shapes(1).Hyperlink.Follow NewWindow:=True

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlinks Object (Excel)

 Copy code hover
[image]

Hyperlinks Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of hyperlinks for a worksheet or range.

Remarks

Each hyperlink is represented by a Hyperlink object.

Example

Use the Hyperlinks property to return the Hyperlinks collection. The following example checks the hyperlinks on worksheet one for a link that contains the word Microsoft.

VBA Copy code Copy code
For Each h in Worksheets(1).Hyperlinks
 If Instr(h.Name, "Microsoft") <> 0 Then h.Follow
Next

Use the Add method to create a hyperlink and add it to the Hyperlinks collection. The following example creates a new hyperlink for cell E5.

VBA Copy code Copy code
With Worksheets(1)
 .Hyperlinks.Add .Range("E5"), "http://example.microsoft.com"
End With

See also

Concepts

Excel Object Model Reference

Other resources

Hyperlinks Object Members


Hyperlinks Members (Excel)

 Copy code hover
[image]

Hyperlinks Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of hyperlinks for a worksheet or range.

Methods

Name | Description
Add | Adds a hyperlink to the specified range or shape.
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Hyperlinks Properties (Excel)

 Copy code hover
[image]

Hyperlinks Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Hyperlinks.Application Property (Excel)

 Copy code hover
[image]

Hyperlinks.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Hyperlinks object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks.Count Property (Excel)

 Copy code hover
[image]

Hyperlinks.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Hyperlinks object.

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks.Creator Property (Excel)

 Copy code hover
[image]

Hyperlinks.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Hyperlinks object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks.Item Property (Excel)

 Copy code hover
[image]

Hyperlinks.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Hyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

The following example activates hyperlink one on cell E5.

VBA Copy code Copy code
Worksheets(1).Range("E5").Hyperlinks.Item(1).Follow

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks.Parent Property (Excel)

 Copy code hover
[image]

Hyperlinks.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Hyperlinks object.

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks Methods (Excel)

 Copy code hover
[image]

Hyperlinks Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a hyperlink to the specified range or shape.
Delete | Deletes the object.


Hyperlinks.Add Method (Excel)

 Copy code hover
[image]

Hyperlinks.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a hyperlink to the specified range or shape.

Syntax

expression .Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay)

expression A variable that represents a Hyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Anchor | Required | Object | The anchor for the hyperlink. Can be either a Range or Shape object.
Address | Required | String | The address of the hyperlink.
SubAddress | Optional | Variant | The subaddress of the hyperlink.
ScreenTip | Optional | Variant | The screen tip to be displayed when the mouse pointer is paused over the hyperlink.
TextToDisplay | Optional | Variant | The text to be displayed for the hyperlink.

Return Value

A Hyperlink object that represents the new hyperlink.

Remarks

When you specify the TextToDisplay argument, the text must be a string.

Example

This example adds a hyperlink to cell A5.

VBA Copy code Copy code
With Worksheets(1)
 .Hyperlinks.Add Anchor:=.Range("a5"), _
 Address:="http://example.microsoft.com", _
 ScreenTip:="Microsoft Web Site", _
 TextToDisplay:="Microsoft"
End With

This example adds an e-mail hyperlink to cell A5.

VBA Copy code Copy code
With Worksheets(1)
 .Hyperlinks.Add Anchor:=.Range("a5"), _
 Address:="mailto:someone@example.com?subject=hello", _
 ScreenTip:="Write us today", _
 TextToDisplay:="Support"
End With

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Hyperlinks.Delete Method (Excel)

 Copy code hover
[image]

Hyperlinks.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Hyperlinks object.

See also

Concepts

Hyperlinks Object

Other resources

Hyperlinks Object Members


Icon Object (Excel)

 Copy code hover
[image]

Icon Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single icon in an icon set used in a conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

The Icon object is returned from the Item property of the IconSet object.

See also

Concepts

Excel Object Model Reference

Other resources

Icon Object Members


Icon Members (Excel)

 Copy code hover
[image]

Icon Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single icon in an icon set used in a conditional formatting rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value specifying the index number of the Icon object within the IconSet object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Icon Properties (Excel)

 Copy code hover
[image]

Icon Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value specifying the index number of the Icon object within the IconSet object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Icon.Application Property (Excel)

 Copy code hover
[image]

Icon.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an Icon object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Icon Object

Other resources

Icon Object Members


Icon.Creator Property (Excel)

 Copy code hover
[image]

Icon.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Icon object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Icon Object

Other resources

Icon Object Members


Icon.Index Property (Excel)

 Copy code hover
[image]

Icon.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value specifying the index number of the Icon object within the IconSet object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Index

expression A variable that represents an Icon object.

See also

Concepts

Icon Object

Other resources

Icon Object Members


Icon.Parent Property (Excel)

 Copy code hover
[image]

Icon.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an Icon object.

See also

Concepts

Icon Object

Other resources

Icon Object Members


IconCriteria Object (Excel)

 Copy code hover
[image]

IconCriteria Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of IconCriterion objects. Each IconCriterion represents the values and threshold type for each icon in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

The IconCriteria collection is returned from the IconCriteria property of the IconSetCondition object. You can access each IconCriterion object in the collection by passing an index into the collection. See the example for details.

Example

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a five-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

VBA Copy code Copy code
Sub CreateIconSetCF()

 Dim cfIconSet As IconSetCondition

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 55
 .Range("C2") = 92
 .Range("C3") = 88
 .Range("C4") = 77
 .Range("C5") = 66
 .Range("C6") = 93
 .Range("C7") = 76
 .Range("C8") = 80
 .Range("C9") = 79
 .Range("C10") = 83
 .Range("C11") = 66
 .Range("C12") = 74
 End With

 Range("C1:C12").Select

 'Create an icon set conditional format for the created sample data range
 Set cfIconSet = Selection.FormatConditions.AddIconSetCondition

 'Change the icon set to a five-arrow icon set
 cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)

 'The IconCriterion collection contains all IconCriteria
 'By indexing into the collection you can modify each criterion

 With cfIconSet.IconCriteria(2)
 .Type = xlConditionValueNumber
 .Value = 60
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(3)
 .Type = xlConditionValueNumber
 .Value = 70
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(4)
 .Type = xlConditionValueNumber
 .Value = 80
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(5)
 .Type = xlConditionValueNumber
 .Value = 90
 .Operator = 7
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

IconCriteria Object Members


IconCriteria Members (Excel)

 Copy code hover
[image]

IconCriteria Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of IconCriterion objects. Each IconCriterion represents the values and threshold type for each icon in an icon set conditional formatting rule.

Properties

Name | Description
Count | Returns a Long value that specifies the number of criteria for an icon set conditional format rule. Read-only.
Item | Returns a single IconCriterion object from the IconCriteria collection. Read-only.


IconCriteria Properties (Excel)

 Copy code hover
[image]

IconCriteria Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns a Long value that specifies the number of criteria for an icon set conditional format rule. Read-only.
Item | Returns a single IconCriterion object from the IconCriteria collection. Read-only.


IconCriteria.Count Property (Excel)

 Copy code hover
[image]

IconCriteria.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that specifies the number of criteria for an icon set conditional format rule. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents an IconCriteria object.

Remarks

The number of criteria is equivalent to the number of threshold values assigned for an icon set.

See also

Concepts

IconCriteria Collection

Other resources

IconCriteria Object Members


IconCriteria.Item Property (Excel)

 Copy code hover
[image]

IconCriteria.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single IconCriterion object from the IconCriteria collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents an IconCriteria object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number of the IconCriterion object.

Remarks

The value of the Index parameter cannot be greater than the number of criteria set for an icon set conditional format. The criteria are equivalent to the threshold values assigned for an icon set. To find the number of threshold values, use the Count property.

See also

Concepts

IconCriteria Collection

Other resources

IconCriteria Object Members


IconCriterion Object (Excel)

 Copy code hover
[image]

IconCriterion Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the criterion for an individual icon in an icon set. The criterion specifies the range of values and the threshold type associated with the icon in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

All of the criteria for an icon set conditional format are contained in an IconCriteria collection. You can access each IconCriterion object in the collection by passing an index into the collection. See the example for details.

Example

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a five-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

VBA Copy code Copy code
Sub CreateIconSetCF()

    Dim cfIconSet As IconSetCondition

    'Fill cells with sample data
    With ActiveSheet
        .Range("C1") = 55
        .Range("C2") = 92
        .Range("C3") = 88
        .Range("C4") = 77
        .Range("C5") = 66
        .Range("C6") = 93
        .Range("C7") = 76
        .Range("C8") = 80
        .Range("C9") = 79
        .Range("C10") = 83
        .Range("C11") = 66
        .Range("C12") = 74
    End With

    Range("C1:C12").Select

    'Create an icon set conditional format for the created sample data range
    Set cfIconSet = Selection.FormatConditions.AddIconSetCondition

    'Change the icon set to a five-arrow icon set
    cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)

    'The IconCriterion collection contains all IconCriteria
    'By indexing into the collection you can modify each criterion

    With cfIconSet.IconCriteria(1)
        .Type = xlConditionValueNumber
        .Value = 0
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(2)
        .Type = xlConditionValueNumber
        .Value = 60
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(3)
        .Type = xlConditionValueNumber
        .Value = 70
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(4)
        .Type = xlConditionValueNumber
        .Value = 80
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(5)
        .Type = xlConditionValueNumber
        .Value = 90
        .Operator = 7
    End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

IconCriterion Object Members


IconCriterion Members (Excel)

 Copy code hover
[image]

IconCriterion Members (Excel)
Send feedback

Published: July 16, 2012

Represents the criterion for an individual icon in an icon set. The criterion specifies the range of values and the threshold type associated with the icon in an icon set conditional formatting rule.

Properties

Name | Description
Icon | Returns or specifies the icon for a criterion in an icon set conditional formatting rule. Read/write
Index | Returns a Long value indicating which threshold the criteria represents. Read-only.
Operator | Returns or sets one of the constants of the XlFormatConditionOperator enumeration, which specifes if the threshold is "greater than" or "greater than or equal to" the threshold value.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold value for an icon set is determined. Read-only.
Value | Returns or sets the threshold value for an icon in a conditional format. Read/write Variant.


IconCriterion Properties (Excel)

 Copy code hover
[image]

IconCriterion Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Icon | Returns or specifies the icon for a criterion in an icon set conditional formatting rule. Read/write
Index | Returns a Long value indicating which threshold the criteria represents. Read-only.
Operator | Returns or sets one of the constants of the XlFormatConditionOperator enumeration, which specifes if the threshold is "greater than" or "greater than or equal to" the threshold value.
Type | Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold value for an icon set is determined. Read-only.
Value | Returns or sets the threshold value for an icon in a conditional format. Read/write Variant.


IconCriterion.Icon Property (Excel)

 Copy code hover
[image]

IconCriterion.Icon Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or specifies the icon for a criterion in an icon set conditional formatting rule. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Icon

expression A variable that represents an IconCriterion object.

Remarks

After you set the Icon property for the icon criterion in an icon set conditional formatting rule, the IconSet property is changed to xlCustomSet.

Example

The following code example creates an icon set conditional formatting rule that displays four icons split across the specified percentages. The icon set is initially set to use the 4 Arrows (Colored) icon set, but the Icon property is used to override which icons are used for the first and third criteria. After running the code, the icon for the first criterion is the Red Cross icon, the icon for the second criterion is the second arrow from the 4 Arrows (Colored) icon set, the icon for the third criterion is the Yellow Traffic Light icon, and the icon for the fourth criterion is the fourth arrow from 4 Arrows (Colored) icon set.

VBA Copy code Copy code
Range("A1:A10").Select
Selection.FormatConditions.AddIconSetCondition
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority

With Selection.FormatConditions(1)
 .ReverseOrder = False
 .ShowIconOnly = False
 .IconSet = ActiveWorkbook.IconSets(xl4Arrows)
End With

With Selection.FormatConditions(1).IconCriteria(1)
 .Icon = xlIconRedCross
End With

With Selection.FormatConditions(1).IconCriteria(2)
 .Type = xlConditionValuePercent
 .Value = 25
 .Operator = 7
End With

With Selection.FormatConditions(1).IconCriteria(3)
 .Type = xlConditionValuePercent
 .Value = 50
 .Operator = 7
 .Icon = xlIconYellowTrafficLight
End With

With Selection.FormatConditions(1).IconCriteria(4)
 .Type = xlConditionValuePercent
 .Value = 75
 .Operator = 7
End With

See also

Concepts

IconCriterion Object

Other resources

IconCriterion Object Members


IconCriterion.Index Property (Excel)

 Copy code hover
[image]

IconCriterion.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value indicating which threshold the criteria represents. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Index

expression A variable that represents an IconCriterion object.

Remarks

For an icon set, this property will return a value of "1" for the minimum threshold, "2" for the next threshold, and so on.

See also

Concepts

IconCriterion Object

Other resources

IconCriterion Object Members


IconCriterion.Operator Property (Excel)

 Copy code hover
[image]

IconCriterion.Operator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlFormatConditionOperator enumeration, which specifes if the threshold is "greater than" or "greater than or equal to" the threshold value.

Version Information

Version Added: Excel 2007

Syntax

expression .Operator

expression A variable that represents an IconCriterion object.

Remarks

For an icon set conditional formatting rule, this property can be set to only one of the following two constants: xlGreater or xlGreaterEqual.

See also

Concepts

IconCriterion Object

Other resources

IconCriterion Object Members


IconCriterion.Type Property (Excel)

 Copy code hover
[image]

IconCriterion.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold value for an icon set is determined. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents an IconCriterion object.

Remarks

The type of threshold value for an icon set can be a number, percent, formula, or percentile. Setting the type to percentile will use the Percentile function in Excel to determine the threshold value.

See also

Concepts

IconCriterion Object

Other resources

IconCriterion Object Members


IconCriterion.Value Property (Excel)

 Copy code hover
[image]

IconCriterion.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the threshold value for an icon in a conditional format. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Value

expression A variable that represents an IconCriterion object.

Remarks

You can set the value only if the IconCriterion.Type property for the conditional format is set to one of the following constants: xlConditionValueNumber, xlConditionValuePercent, xlConditionValuePercentile, or xlConditionValueFormula.

If the type of threshold is a formula, you can set the formula as a String. The formula must return a single number.

See also

Concepts

IconCriterion Object

Other resources

IconCriterion Object Members


IconSet Object (Excel)

 Copy code hover
[image]

IconSet Object (Excel)
See also Send feedback

Represents a single set of icons that are used in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

The IconSet object is a child object of the IconSets collection.

The icon set for the conditional format is assigned by using the IconSet property of the IconSetCondition object. You set this property to one of the built-in icon sets by passing one of the constants of the XlIconSet enumeration as an index of the IconSets property of the Workbook object. See the example for details.

Example

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a 5-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

VBA Copy code Copy code
Sub CreateIconSetCF()

 Dim cfIconSet As IconSetCondition

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 55
 .Range("C2") = 92
 .Range("C3") = 88
 .Range("C4") = 77
 .Range("C5") = 66
 .Range("C6") = 93
 .Range("C7") = 76
 .Range("C8") = 80
 .Range("C9") = 79
 .Range("C10") = 83
 .Range("C11") = 66
 .Range("C12") = 74
 End With

 Range("C1:C12").Select

 'Create an icon set conditional format for the created sample data range
 Set cfIconSet = Selection.FormatConditions.AddIconSetCondition

 'Change the icon set to a 5-arrow icon set
 cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)

 'The IconCriterion collection contains all of IconCriteria
 'By indexing into the collection you can modify each criteria

 With cfIconSet.IconCriteria(1)
 .Type = xlConditionValueNumber
 .Value = 0
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(2)
 .Type = xlConditionValueNumber
 .Value = 60
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(3)
 .Type = xlConditionValueNumber
 .Value = 70
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(4)
 .Type = xlConditionValueNumber
 .Value = 80
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(5)
 .Type = xlConditionValueNumber
 .Value = 90
 .Operator = 7
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

IconSet Object Members


IconSet Members (Excel)

 Copy code hover
[image]

IconSet Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single set of icons that are used in an icon set conditional formatting rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that specifies the number of icons in the icon set. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ID | Returns one of the constants of the XlIconSet enumeration, which specifies the name of the icon set used in an icon set conditional formatting rule.
Item | Returns an Icon object that represents a single icon from an icon set. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


IconSet Properties (Excel)

 Copy code hover
[image]

IconSet Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that specifies the number of icons in the icon set. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ID | Returns one of the constants of the XlIconSet enumeration, which specifies the name of the icon set used in an icon set conditional formatting rule.
Item | Returns an Icon object that represents a single icon from an icon set. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


IconSet.Application Property (Excel)

 Copy code hover
[image]

IconSet.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an IconSet object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSet.Count Property (Excel)

 Copy code hover
[image]

IconSet.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that specifies the number of icons in the icon set. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents an IconSet object.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSet.Creator Property (Excel)

 Copy code hover
[image]

IconSet.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an IconSet object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSet.ID Property (Excel)

 Copy code hover
[image]

IconSet.ID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlIconSet enumeration, which specifies the name of the icon set used in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .ID

expression A variable that represents an IconSet object.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSet.Item Property (Excel)

 Copy code hover
[image]

IconSet.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Icon object that represents a single icon from an icon set. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents an IconSet object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number of the Icon object.

Remarks

The value of the Index parameter cannot be greater than the number of icons in an icon set. To find the total number of icons in an icon set, use the IconSet.Count property.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSet.Parent Property (Excel)

 Copy code hover
[image]

IconSet.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an IconSet object.

See also

Concepts

IconSet Object

Other resources

IconSet Object Members


IconSetCondition Object (Excel)

 Copy code hover
[image]

IconSetCondition Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create an icon set formatting rule by using either the Add method or AddIconSetCondition method of the FormatConditions collection.

Each icon set contains three, four, or five icons. You use the IconSets property of the Workbook object to return an IconSets object to specify one of the built-in icon sets. Each individual icon in the icon set is then assigned to a subset of the values of the range by the members of the IconCriteria object. The type of threshold is also specified by this object.

Example

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a five-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

VBA Copy code Copy code
Sub CreateIconSetCF()

    Dim cfIconSet As IconSetCondition

    'Fill cells with sample data from 1 to 10
    With ActiveSheet
        .Range("C1") = 55
        .Range("C2") = 92
        .Range("C3") = 88
        .Range("C4") = 77
        .Range("C5") = 66
        .Range("C6") = 93
        .Range("C7") = 76
        .Range("C8") = 80
        .Range("C9") = 79
        .Range("C10") = 83
        .Range("C11") = 66
        .Range("C12") = 74
    End With

    Range("C1:C12").Select

    'Create an icon set conditional format for the created sample data range
    Set cfIconSet = Selection.FormatConditions.AddIconSetCondition

    'Change the icon set to a five-arrow icon set
    cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)

    'The IconCriterion collection contains all IconCriteria
    'By indexing into the collection you can modify each criterion

    With cfIconSet.IconCriteria(1)
        .Type = xlConditionValueNumber
        .Value = 0
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(2)
        .Type = xlConditionValueNumber
        .Value = 60
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(3)
        .Type = xlConditionValueNumber
        .Value = 70
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(4)
        .Type = xlConditionValueNumber
        .Value = 80
        .Operator = 7
    End With
    With cfIconSet.IconCriteria(5)
        .Type = xlConditionValueNumber
        .Value = 90
        .Operator = 7
    End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

IconSetCondition Object Members


IconSetCondition Members (Excel)

 Copy code hover
[image]

IconSetCondition Members (Excel)
Send feedback

Published: July 16, 2012

Represents an icon set conditional formatting rule.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String representing a formula, which determines the values to which the icon set will be applied.
IconCriteria | Returns an IconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule.
IconSet | Returns or sets an IconSets collection, which specifies the icon set used in the conditional format.
Parent | Returns the parent object for the specified object. Read-only.
PercentileValues | Returns or sets a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ReverseOrder | Returns or sets a Boolean value indicating if the order of icons is reversed for an icon set.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
ShowIconOnly | Returns or sets a Boolean value indicating if only the icon is displayed for an icon set conditional format.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


IconSetCondition Properties (Excel)

 Copy code hover
[image]

IconSetCondition Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String representing a formula, which determines the values to which the icon set will be applied.
IconCriteria | Returns an IconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule.
IconSet | Returns or sets an IconSets collection, which specifies the icon set used in the conditional format.
Parent | Returns the parent object for the specified object. Read-only.
PercentileValues | Returns or sets a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ReverseOrder | Returns or sets a Boolean value indicating if the order of icons is reversed for an icon set.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
ShowIconOnly | Returns or sets a Boolean value indicating if only the icon is displayed for an icon set conditional format.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


IconSetCondition.Application Property (Excel)

 Copy code hover
[image]

IconSetCondition.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an IconSetCondition object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.AppliesTo Property (Excel)

 Copy code hover
[image]

IconSetCondition.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents an IconSetCondition object.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.Creator Property (Excel)

 Copy code hover
[image]

IconSetCondition.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an IconSetCondition object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.Formula Property (Excel)

 Copy code hover
[image]

IconSetCondition.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String representing a formula, which determines the values to which the icon set will be applied.

Version Information

Version Added: Excel 2007

Syntax

expression .Formula

expression A variable that represents an IconSetCondition object.

Remarks

This property is useful to limit the range of values that will display the conditional format. A typical scenario is when you have a range of numbers containing both positive and negative values. You may want to create more than one conditional format for this range of numbers—one for positive values and another for negative values.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.IconCriteria Property (Excel)

 Copy code hover
[image]

IconSetCondition.IconCriteria Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an IconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Syntax

expression .IconCriteria

expression A variable that represents an IconSetCondition object.

Remarks

After you have the IconCriteria collection, you can use the Item property of the collection to return an IconCriterion object. The IconCriterion object represents a single criterion of an icon set.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.IconSet Property (Excel)

 Copy code hover
[image]

IconSetCondition.IconSet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an IconSets collection, which specifies the icon set used in the conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .IconSet

expression A variable that represents an IconSetCondition object.

Remarks

You can assign the icon set by using the IconSets property of the Workbook object. For example, Selection.FormatConditions(1).IconSet = ActiveWorkbook.IconSets(xl3TrafficLights1) will apply the three-traffic-light icon set to the conditional format.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.Parent Property (Excel)

 Copy code hover
[image]

IconSetCondition.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an IconSetCondition object.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.PercentileValues Property (Excel)

 Copy code hover
[image]

IconSetCondition.PercentileValues Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.

Version Information

Version Added: Excel 2007

Syntax

expression .PercentileValues

expression A variable that represents an IconSetCondition object.

Remarks

This property will return False if not every threshold is set to percentile. Setting this property to True will set every threshold type to percentile.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.Priority Property (Excel)

 Copy code hover
[image]

IconSetCondition.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents an IconSetCondition object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.PTCondition Property (Excel)

 Copy code hover
[image]

IconSetCondition.PTCondition Property (Excel)
See also Send feedback

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents an IconSetCondition object.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.ReverseOrder Property (Excel)

 Copy code hover
[image]

IconSetCondition.ReverseOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value indicating if the order of icons is reversed for an icon set.

Version Information

Version Added: Excel 2007

Syntax

expression .ReverseOrder

expression A variable that represents an IconSetCondition object.

Remarks

By default, most of the icon sets you can use associate positive images with higher values. For example, the "3 Traffic Lights" icon set applies a green circle to the upper value threshold and a red circle to the lowest values in the range. If your data is such that lower values are more desirable, such as marathon time results, you may want to reverse the order that icons are applied to the range to associate the green circle to the lowest values.

If the IconSet property of the IconSetCondition object is xlCustomSet, the ReverseOrder property will return False. Additionally, if you attempt to set the ReverseOrder property to True when the IconSet property of the IconSetCondition object is xlCustomSet, Excel will return a runtime error.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.ScopeType Property (Excel)

 Copy code hover
[image]

IconSetCondition.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents an IconSetCondition object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.ShowIconOnly Property (Excel)

 Copy code hover
[image]

IconSetCondition.ShowIconOnly Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value indicating if only the icon is displayed for an icon set conditional format.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowIconOnly

expression A variable that represents an IconSetCondition object.

Remarks

The default value for this property is False.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.StopIfTrue Property (Excel)

 Copy code hover
[image]

IconSetCondition.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents an IconSetCondition object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.Type Property (Excel)

 Copy code hover
[image]

IconSetCondition.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents an IconSetCondition object.

Remarks

This property will always return a Long value of "6", which is equivalent to xlIconSet.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition Methods (Excel)

 Copy code hover
[image]

IconSetCondition Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


IconSetCondition.Delete Method (Excel)

 Copy code hover
[image]

IconSetCondition.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents an IconSetCondition object.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

IconSetCondition.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents an IconSetCondition object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.SetFirstPriority Method (Excel)

 Copy code hover
[image]

IconSetCondition.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents an IconSetCondition object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSetCondition.SetLastPriority Method (Excel)

 Copy code hover
[image]

IconSetCondition.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents an IconSetCondition object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

IconSetCondition Object

Other resources

IconSetCondition Object Members


IconSets Object (Excel)

 Copy code hover
[image]

IconSets Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a collection of icon sets used in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2007

Remarks

The icon set for the conditional format is assigned using the IconSet property of the IconSetCondition object. You set this property to one of the built-in icon sets by passing one of the constants of the XlIconSet enumeration as an index of the IconSets property of the Workbook object. See the example for details.

Example

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a five-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

VBA Copy code Copy code
Sub CreateIconSetCF()

 Dim cfIconSet As IconSetCondition

 'Fill cells with sample data from 1 to 10
 With ActiveSheet
 .Range("C1") = 55
 .Range("C2") = 92
 .Range("C3") = 88
 .Range("C4") = 77
 .Range("C5") = 66
 .Range("C6") = 93
 .Range("C7") = 76
 .Range("C8") = 80
 .Range("C9") = 79
 .Range("C10") = 83
 .Range("C11") = 66
 .Range("C12") = 74
 End With

 Range("C1:C12").Select

 'Create an icon set conditional format for the created sample data range
 Set cfIconSet = Selection.FormatConditions.AddIconSetCondition

 'Change the icon set to a five-arrow icon set
 cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)

 'The IconCriterion collection contains all IconCriteria
 'By indexing into the collection you can modify each criterion

 With cfIconSet.IconCriteria(1)
 .Type = xlConditionValueNumber
 .Value = 0
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(2)
 .Type = xlConditionValueNumber
 .Value = 60
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(3)
 .Type = xlConditionValueNumber
 .Value = 70
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(4)
 .Type = xlConditionValueNumber
 .Value = 80
 .Operator = 7
 End With
 With cfIconSet.IconCriteria(5)
 .Type = xlConditionValueNumber
 .Value = 90
 .Operator = 7
 End With

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

IconSets Object Members


IconSets Members (Excel)

 Copy code hover
[image]

IconSets Members (Excel)
Send feedback

Published: July 16, 2012

Represents a collection of icon sets used in an icon set conditional formatting rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that specifies the number of icon sets available in the workbook. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single IconSet object from the IconSets collection. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


IconSets Properties (Excel)

 Copy code hover
[image]

IconSets Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that specifies the number of icon sets available in the workbook. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single IconSet object from the IconSets collection. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


IconSets.Application Property (Excel)

 Copy code hover
[image]

IconSets.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an IconSets object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

IconSets Object

Other resources

IconSets Object Members


IconSets.Count Property (Excel)

 Copy code hover
[image]

IconSets.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that specifies the number of icon sets available in the workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents an IconSets object.

See also

Concepts

IconSets Object

Other resources

IconSets Object Members


IconSets.Creator Property (Excel)

 Copy code hover
[image]

IconSets.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an IconSets object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

IconSets Object

Other resources

IconSets Object Members


IconSets.Item Property (Excel)

 Copy code hover
[image]

IconSets.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single IconSet object from the IconSets collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents an IconSets object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number of the IconSet object.

Remarks

The value of the Index parameter cannot be greater than the number of icon sets available. To find the number of icon sets available to the workbook, use the IconSets property.

See also

Concepts

IconSets Object

Other resources

IconSets Object Members


IconSets.Parent Property (Excel)

 Copy code hover
[image]

IconSets.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an IconSets object.

See also

Concepts

IconSets Object

Other resources

IconSets Object Members


Interior Object (Excel)

 Copy code hover
[image]

Interior Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the interior of an object.

Example

Use the Interior property to return the Interior object. The following example sets the color for the interior of cell A1 to red.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 3

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example gets the value of the color of a cell in column A using the ColorIndex property, and then uses that value to sort the range by color.

VBA Copy code Copy code
Sub ColorSort()
   'Set up your variables and turn off screen updating.
   Dim iCounter As Integer
   Application.ScreenUpdating = False

   'For each cell in column A, go through and place the color index value of the cell in column C.
   For iCounter = 2 To 55
      Cells(iCounter, 3) = _
         Cells(iCounter, 1).Interior.ColorIndex
   Next iCounter

   'Sort the rows based on the data in column C
   Range("C1") = "Index"
   Columns("A:C").Sort key1:=Range("C2"), _
      order1:=xlAscending, header:=xlYes

   'Clear out the temporary sorting value in column C, and turn screen updating back on.
   Columns(3).ClearContents
   Application.ScreenUpdating = True
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Excel Object Model Reference

Other resources

Interior Object Members


Interior Members (Excel)

 Copy code hover
[image]

Interior Members (Excel)
Send feedback

Published: July 16, 2012

Represents the interior of an object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the interior.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Gradient | Returns or sets the Gradient property of an Interior object of a selection. Read-only
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets a Variant value, containing an xlPattern constant, that represents the interior pattern.
PatternColor | Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.
PatternColorIndex | Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
PatternThemeColor | Returns or sets a theme color pattern for an Interior object. Read/write Variant.
PatternTintAndShade | Returns or sets a tint and shade pattern for an Interior object. Read/write Variant.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.


Interior Properties (Excel)

 Copy code hover
[image]

Interior Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the interior.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Gradient | Returns or sets the Gradient property of an Interior object of a selection. Read-only
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets a Variant value, containing an xlPattern constant, that represents the interior pattern.
PatternColor | Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.
PatternColorIndex | Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
PatternThemeColor | Returns or sets a theme color pattern for an Interior object. Read/write Variant.
PatternTintAndShade | Returns or sets a tint and shade pattern for an Interior object. Read/write Variant.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.
TintAndShade | Returns or sets a Single that lightens or darkens a color.


Interior.Application Property (Excel)

 Copy code hover
[image]

Interior.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Interior object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Color Property (Excel)

 Copy code hover
[image]

Interior.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.

Syntax

expression .Color

expression An expression that returns a Interior object.

Remarks

Object | Color
Border | The color of the border.
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero).
Font | The color of the font.
Interior | The cell shading color or the drawing object fill color.
Tab | The color of the tab.

Example

This example sets the color of the tick-mark labels on the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.ColorIndex Property (Excel)

 Copy code hover
[image]

Interior.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the color of the interior.

Syntax

expression .ColorIndex

expression A variable that represents an Interior object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Creator Property (Excel)

 Copy code hover
[image]

Interior.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Interior object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Gradient Property (Excel)

 Copy code hover
[image]

Interior.Gradient Property (Excel)
See also Send feedback

Returns or sets the Gradient property of an Interior object of a selection. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Gradient

expression A variable that represents an Interior object.

Return Value

Object

Remarks

Uses either LinearGradient or RectangularGradient.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.InvertIfNegative Property (Excel)

 Copy code hover
[image]

Interior.InvertIfNegative Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Variant.

Syntax

expression .InvertIfNegative

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Parent Property (Excel)

 Copy code hover
[image]

Interior.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Pattern Property (Excel)

 Copy code hover
[image]

Interior.Pattern Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an xlPattern constant, that represents the interior pattern.

Syntax

expression .Pattern

expression A variable that represents an Interior object.

Example

This example adds a crisscross pattern to the interior of cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1"). _
 Interior.Pattern = xlPatternCrissCross

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternColor Property (Excel)

 Copy code hover
[image]

Interior.PatternColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.

Syntax

expression .PatternColor

expression A variable that represents an Interior object.

Example

This example sets the color of the interior pattern for rectangle one on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").Rectangles(1).Interior
 .Pattern = xlGrid
 .PatternColor = RGB(255,0,0)
End With

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternColorIndex Property (Excel)

 Copy code hover
[image]

Interior.PatternColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Syntax

expression .PatternColorIndex

expression A variable that represents an Interior object.

Remarks

Set this property to xlColorIndexAutomatic to specify the automatic pattern for cells or the automatic fill style for drawing objects. Set this property to xlColorIndexNone to specify that you don't want a pattern (this is the same as setting the Pattern property of the Interior object to xlPatternNone).

Example

This example sets the color of the interior pattern for rectangle one on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").Rectangles(1).Interior
 .Pattern = xlChecker
 .PatternColorIndex = 5
End With

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternThemeColor Property (Excel)

 Copy code hover
[image]

Interior.PatternThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a theme color pattern for an Interior object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .PatternThemeColor

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternTintAndShade Property (Excel)

 Copy code hover
[image]

Interior.PatternTintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a tint and shade pattern for an Interior object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .PatternTintAndShade

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.ThemeColor Property (Excel)

 Copy code hover
[image]

Interior.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents an Interior object.

Remarks

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.TintAndShade Property (Excel)

 Copy code hover
[image]

Interior.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens a color.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents an Interior object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1 results in a run-time error: "The specified value is out of range." This property works for both theme colors and nontheme colors.

See also

Concepts

Interior Object

Other resources

Interior Object Members


IRtdServer Object (Excel)

 Copy code hover
[image]

IRtdServer Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an interface for a real-time data server.

Remarks

The IRTDServer object can be instantiated or created only by implementing the IRTDServer interface using the Implements keyword.

See also

Concepts

Excel Object Model Reference

Other resources

IRtdServer Object Members


IRtdServer Members (Excel)

 Copy code hover
[image]

IRtdServer Members (Excel)
Send feedback

Published: July 16, 2012

Represents an interface for a real-time data server.

Methods

Name | Description
ConnectData | Adds new topics from a real-time data server. The ConnectData method is called when a file is opened that contains real-time data functions or when a user types in a new formula which contains the RTD function.
DisconnectData | Notifies a real-time data (RTD) server application that a topic is no longer in use.
Heartbeat | Determines if the real-time data server is still active. Returns a Long value. Zero or a negative number indicates failure; a positive number indicates that the server is active.
RefreshData | This method is called by Microsoft Excel to get new data. Returns a Variant.
ServerStart | The ServerStart method is called immediately after a real-time data server is instantiated. Returns a Long; negative value or zero indicates failure to start the server; positive value indicates success.
ServerTerminate | Terminates the connection to the real-time data server.


IRtdServer Methods (Excel)

 Copy code hover
[image]

IRtdServer Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ConnectData | Adds new topics from a real-time data server. The ConnectData method is called when a file is opened that contains real-time data functions or when a user types in a new formula which contains the RTD function.
DisconnectData | Notifies a real-time data (RTD) server application that a topic is no longer in use.
Heartbeat | Determines if the real-time data server is still active. Returns a Long value. Zero or a negative number indicates failure; a positive number indicates that the server is active.
RefreshData | This method is called by Microsoft Excel to get new data. Returns a Variant.
ServerStart | The ServerStart method is called immediately after a real-time data server is instantiated. Returns a Long; negative value or zero indicates failure to start the server; positive value indicates success.
ServerTerminate | Terminates the connection to the real-time data server.


IRtdServer.ConnectData Method (Excel)

 Copy code hover
[image]

IRtdServer.ConnectData Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds new topics from a real-time data server. The ConnectData method is called when a file is opened that contains real-time data functions or when a user types in a new formula which contains the RTD function.

Syntax

expression .ConnectData(TopicID, Strings(), GetNewValues)

expression A variable that represents an IRtdServer object.

Parameters

Name | Required/Optional | Data Type | Description
TopicID | Required | Long | A unique value, assigned by Microsoft Excel, which identifies the topic.
Strings() | Required | Variant | A single-dimensional array of strings identifying the topic.
GetNewValues | Required | Boolean | True to determine if new values are to be acquired.

Return Value

Variant

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRtdServer.DisconnectData Method (Excel)

 Copy code hover
[image]

IRtdServer.DisconnectData Method (Excel)
See also Send feedback

Published: July 16, 2012

Notifies a real-time data (RTD) server application that a topic is no longer in use.

Syntax

expression .DisconnectData(TopicID)

expression A variable that represents an IRtdServer object.

Parameters

Name | Required/Optional | Data Type | Description
TopicID | Required | Long | A unique value assigned to the topic assigned by Microsoft Excel.

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRtdServer.Heartbeat Method (Excel)

 Copy code hover
[image]

IRtdServer.Heartbeat Method (Excel)
See also Send feedback

Published: July 16, 2012

Determines if the real-time data server is still active. Returns a Long value. Zero or a negative number indicates failure; a positive number indicates that the server is active.

Syntax

expression .Heartbeat

expression A variable that represents an IRtdServer object.

Return Value

Long

Remarks

The Heartbeat method is called by Microsoft Excel if the HeartbeatInterval property has elapsed since the last time Excel was called with the UpdateNotify method.

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRtdServer.RefreshData Method (Excel)

 Copy code hover
[image]

IRtdServer.RefreshData Method (Excel)
See also Send feedback

Published: July 16, 2012

This method is called by Microsoft Excel to get new data. Returns a Variant.

Syntax

expression .RefreshData(TopicCount)

expression A variable that represents an IRtdServer object.

Parameters

Name | Required/Optional | Data Type | Description
TopicCount | Required | Long | The RTD server must change the value of the TopicCount to the number of elements in the array returned.

Return Value

A Variant array that contains the new data.

Remarks

The data returned to Excel is a Variant containing a two-dimensional array. The first dimension represents the list of topic IDs. The second dimension represents the values associated with the topic IDs.

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRtdServer.ServerStart Method (Excel)

 Copy code hover
[image]

IRtdServer.ServerStart Method (Excel)
See also Send feedback

Published: July 16, 2012

The ServerStart method is called immediately after a real-time data server is instantiated. Returns a Long; negative value or zero indicates failure to start the server; positive value indicates success.

Syntax

expression .ServerStart(CallbackObject)

expression A variable that represents an IRtdServer object.

Parameters

Name | Required/Optional | Data Type | Description
CallbackObject | Required | IRTDUpdateEvent | The callback object.

Return Value

Long

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRtdServer.ServerTerminate Method (Excel)

 Copy code hover
[image]

IRtdServer.ServerTerminate Method (Excel)
See also Send feedback

Published: July 16, 2012

Terminates the connection to the real-time data server.

Syntax

expression .ServerTerminate

expression A variable that represents an IRtdServer object.

See also

Concepts

IRtdServer Object

Other resources

IRtdServer Object Members


IRTDUpdateEvent Object (Excel)

 Copy code hover
[image]

IRTDUpdateEvent Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents real-time data update events.

Remarks

To instantiate or to return an IRTDUpdateEvent object, declare a variable as an IRTDUpdateEvent object, and then use that variable as a callback object.

See also

Concepts

Excel Object Model Reference

Other resources

IRTDUpdateEvent Object Members


IRTDUpdateEvent Members (Excel)

 Copy code hover
[image]

IRTDUpdateEvent Members (Excel)
Send feedback

Published: July 16, 2012

Represents real-time data update events.

Methods

Name | Description
Disconnect | Instructs the real-time data server (RTD) to disconnect from the specified IRTDUpdateEvent object.
UpdateNotify | The real-time data (RTD) server uses this method to notify Microsoft Excel that new data has been received.

Properties

Name | Description
HeartbeatInterval | Returns or sets a Long for the interval between updates for real-time data. Read/write.


IRTDUpdateEvent Properties (Excel)

 Copy code hover
[image]

IRTDUpdateEvent Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
HeartbeatInterval | Returns or sets a Long for the interval between updates for real-time data. Read/write.


IRTDUpdateEvent.HeartbeatInterval Property (Excel)

 Copy code hover
[image]

IRTDUpdateEvent.HeartbeatInterval Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long for the interval between updates for real-time data. Read/write.

Syntax

expression .HeartbeatInterval

expression A variable that represents an IRTDUpdateEvent object.

Remarks

Setting the HeartbeatInterval property to -1 will result in the Heartbeat method not being called.

Note Note

The heartbeat interval cannot be set below 15,000 milliseconds, due to the standard 15-second time out.

See also

Concepts

IRTDUpdateEvent Object

Other resources

IRTDUpdateEvent Object Members


IRTDUpdateEvent Methods (Excel)

 Copy code hover
[image]

IRTDUpdateEvent Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Disconnect | Instructs the real-time data server (RTD) to disconnect from the specified IRTDUpdateEvent object.
UpdateNotify | The real-time data (RTD) server uses this method to notify Microsoft Excel that new data has been received.


IRTDUpdateEvent.Disconnect Method (Excel)

 Copy code hover
[image]

IRTDUpdateEvent.Disconnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Instructs the real-time data server (RTD) to disconnect from the specified IRTDUpdateEvent object.

Syntax

expression .Disconnect

expression A variable that represents an IRTDUpdateEvent object.

See also

Concepts

IRTDUpdateEvent Object

Other resources

IRTDUpdateEvent Object Members


IRTDUpdateEvent.UpdateNotify Method (Excel)

 Copy code hover
[image]

IRTDUpdateEvent.UpdateNotify Method (Excel)
See also Send feedback

Published: July 16, 2012

The real-time data (RTD) server uses this method to notify Microsoft Excel that new data has been received.

Syntax

expression .UpdateNotify

expression A variable that represents an IRTDUpdateEvent object.

See also

Concepts

IRTDUpdateEvent Object

Other resources

IRTDUpdateEvent Object Members


LeaderLines Object (Excel)

 Copy code hover
[image]

LeaderLines Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents leader lines on a chart. Leader lines connect data labels to data points.

Remarks

This object isn't a collection; there's no object that represents a single leader line.

This object applies only to pie charts.

Example

Use the LeaderLines property to return the LeaderLines object. The following example adds data labels and blue leader lines to series one on chart one. If no leader lines are visible this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With

See also

Concepts

Excel Object Model Reference

Other resources

LeaderLines Object Members


LeaderLines Members (Excel)

 Copy code hover
[image]

LeaderLines Members (Excel)
Send feedback

Published: July 16, 2012

Represents leader lines on a chart. Leader lines connect data labels to data points.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


LeaderLines Properties (Excel)

 Copy code hover
[image]

LeaderLines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


LeaderLines.Application Property (Excel)

 Copy code hover
[image]

LeaderLines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LeaderLines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Border Property (Excel)

 Copy code hover
[image]

LeaderLines.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Creator Property (Excel)

 Copy code hover
[image]

LeaderLines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LeaderLines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Format Property (Excel)

 Copy code hover
[image]

LeaderLines.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Parent Property (Excel)

 Copy code hover
[image]

LeaderLines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines Methods (Excel)

 Copy code hover
[image]

LeaderLines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


LeaderLines.Delete Method (Excel)

 Copy code hover
[image]

LeaderLines.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Select Method (Excel)

 Copy code hover
[image]

LeaderLines.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


Legend Object (Excel)

 Copy code hover
[image]

Legend Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the legend in a chart. Each chart can have only one legend.

Remarks

The Legend object contains one or more LegendEntry objects; each LegendEntry object contains a LegendKey object.

The chart legend isn't visible unless the HasLegend property is True. If this property is False, properties and methods of the Legend object will fail.

Example

Use the Legend property to return the Legend object. The following example sets the font style for the legend in embedded chart one on worksheet one to bold.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart.Legend.Font.Bold = True

See also

Concepts

Excel Object Model Reference

Other resources

Legend Object Members


Legend Members (Excel)

 Copy code hover
[image]

Legend Members (Excel)
Send feedback

Published: July 16, 2012

Represents the legend in a chart. Each chart can have only one legend.

Methods

Name | Description
Clear | Clears the entire object.
Delete | Deletes the object.
LegendEntries | Returns an object that represents either a single legend entry (a LegendEntry object) or a collection of legend entries (a LegendEntries object) for the legend.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
IncludeInLayout | True if a legend will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlLegendPosition value that represents the position of the legend on the chart.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


Legend Properties (Excel)

 Copy code hover
[image]

Legend Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
IncludeInLayout | True if a legend will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets a XlLegendPosition value that represents the position of the legend on the chart.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


Legend.Application Property (Excel)

 Copy code hover
[image]

Legend.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Legend object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Creator Property (Excel)

 Copy code hover
[image]

Legend.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Legend object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Format Property (Excel)

 Copy code hover
[image]

Legend.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Height Property (Excel)

 Copy code hover
[image]

Legend.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.IncludeInLayout Property (Excel)

 Copy code hover
[image]

Legend.IncludeInLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a legend will occupy the chart layout space when a chart layout is being determined. The default value is True. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IncludeInLayout

expression A variable that represents a Legend object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title using the Above Chart command, the chart will resize smaller. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Left Property (Excel)

 Copy code hover
[image]

Legend.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Name Property (Excel)

 Copy code hover
[image]

Legend.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Parent Property (Excel)

 Copy code hover
[image]

Legend.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Position Property (Excel)

 Copy code hover
[image]

Legend.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlLegendPosition value that represents the position of the legend on the chart.

Syntax

expression .Position

expression A variable that represents a Legend object.

Example

This example moves the chart legend to the bottom of the chart.

VBA Copy code Copy code
Charts(1).Legend.Position = xlLegendPositionBottom

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Shadow Property (Excel)

 Copy code hover
[image]

Legend.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Top Property (Excel)

 Copy code hover
[image]

Legend.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Width Property (Excel)

 Copy code hover
[image]

Legend.Width Property (Excel)
See also Send feedback

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend Methods (Excel)

 Copy code hover
[image]

Legend Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Clears the entire object.
Delete | Deletes the object.
LegendEntries | Returns an object that represents either a single legend entry (a LegendEntry object) or a collection of legend entries (a LegendEntries object) for the legend.
Select | Selects the object.


Legend.Clear Method (Excel)

 Copy code hover
[image]

Legend.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the entire object.

Syntax

expression .Clear

expression A variable that represents a Legend object.

Return Value

Variant

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Delete Method (Excel)

 Copy code hover
[image]

Legend.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Legend object.

Return Value

Variant

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.LegendEntries Method (Excel)

 Copy code hover
[image]

Legend.LegendEntries Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single legend entry (a LegendEntry object) or a collection of legend entries (a LegendEntries object) for the legend.

Syntax

expression .LegendEntries(Index)

expression A variable that represents a Legend object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number of the legend entry.

Return Value

Object

Example

This example sets the font for legend entry one on Chart1.

VBA Copy code Copy code
Charts("Chart1").Legend.LegendEntries(1).Font.Name = "Arial"

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Select Method (Excel)

 Copy code hover
[image]

Legend.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Legend object.

Return Value

Variant

See also

Concepts

Legend Object

Other resources

Legend Object Members


LegendEntries Object (Excel)

 Copy code hover
[image]

LegendEntries Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the LegendEntry objects in the specified chart legend.

Remarks

Each legend entry has two parts: the text of the entry, which is the name of the series or trendline associated with the legend entry; and the entry marker, which visually links the legend entry with its associated series or trendline in the chart. The formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

Example

Use the LegendEntries method to return the LegendEntries collection. The following example loops through the collection of legend entries in embedded chart one and changes their font color.

VBA Copy code Copy code
With Worksheets("sheet1").ChartObjects(1).Chart.Legend
 For i = 1 To .LegendEntries.Count
 .LegendEntries(i).Font.ColorIndex = 5
 Next
End With

Use LegendEntries(index), where index is the legend entry index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend; LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one to italic.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Legend.LegendEntries(1).Font.Italic = True

See also

Concepts

Excel Object Model Reference

Other resources

LegendEntries Object Members


LegendEntries Members (Excel)

 Copy code hover
[image]

LegendEntries Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the LegendEntry objects in the specified chart legend.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


LegendEntries Properties (Excel)

 Copy code hover
[image]

LegendEntries Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


LegendEntries.Application Property (Excel)

 Copy code hover
[image]

LegendEntries.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LegendEntries object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Count Property (Excel)

 Copy code hover
[image]

LegendEntries.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a LegendEntries object.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Creator Property (Excel)

 Copy code hover
[image]

LegendEntries.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LegendEntries object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Parent Property (Excel)

 Copy code hover
[image]

LegendEntries.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LegendEntries object.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries Methods (Excel)

 Copy code hover
[image]

LegendEntries Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


LegendEntries.Item Method (Excel)

 Copy code hover
[image]

LegendEntries.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a LegendEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A LegendEntry object contained by the collection.

Example

This example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Legend.LegendEntries.Item(1).Font.Italic = True

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntry Object (Excel)

 Copy code hover
[image]

LegendEntry Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a legend entry in a chart legend.

Remarks

The LegendEntry object is a member of the LegendEntries collection. The LegendEntries collection contains all the LegendEntry objects in the legend.

Each legend entry has two parts: the text of the entry, which is the name of the series associated with the legend entry; and an entry marker, which visually links the legend entry with its associated series or trendline in the chart. Formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

The text of a legend entry cannot be changed. LegendEntry objects support font formatting, and they can be deleted. No pattern formatting is supported for legend entries. The position and size of entries is fixed.

There's no direct way to return the series or trendline corresponding to the legend entry.

After legend entries have been deleted, the only way to restore them is to remove and recreate the legend that contained them by setting the HasLegend property for the chart to False and then back to True.

Example

Use LegendEntries(index), where index is the legend entry index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend, and LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one on the worksheet named "Sheet1."

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Legend.LegendEntries(1).Font.Italic = True

See also

Concepts

Excel Object Model Reference

Other resources

LegendEntry Object Members


LegendEntry Members (Excel)

 Copy code hover
[image]

LegendEntry Members (Excel)
Send feedback

Published: July 16, 2012

Represents a legend entry in a chart legend.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
Height | Returns a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
LegendKey | Returns a LegendKey object that represents the legend key associated with the entry.
Parent | Returns the parent object for the specified object. Read-only.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns a Double value that represents the width, in points, of the object.


LegendEntry Properties (Excel)

 Copy code hover
[image]

LegendEntry Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
Height | Returns a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
LegendKey | Returns a LegendKey object that represents the legend key associated with the entry.
Parent | Returns the parent object for the specified object. Read-only.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns a Double value that represents the width, in points, of the object.


LegendEntry.Application Property (Excel)

 Copy code hover
[image]

LegendEntry.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LegendEntry object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Creator Property (Excel)

 Copy code hover
[image]

LegendEntry.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LegendEntry object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Font Property (Excel)

 Copy code hover
[image]

LegendEntry.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Format Property (Excel)

 Copy code hover
[image]

LegendEntry.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Height Property (Excel)

 Copy code hover
[image]

LegendEntry.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Index Property (Excel)

 Copy code hover
[image]

LegendEntry.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Left Property (Excel)

 Copy code hover
[image]

LegendEntry.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.

Syntax

expression .Left

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.LegendKey Property (Excel)

 Copy code hover
[image]

LegendEntry.LegendKey Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LegendKey object that represents the legend key associated with the entry.

Syntax

expression .LegendKey

expression A variable that represents a LegendEntry object.

Example

This example sets the legend key for legend entry one on Chart1 to be a triangle. The example should be run on a 2-D line chart.

VBA Copy code Copy code
Charts("Chart1").Legend.LegendEntries(1).LegendKey _
 .MarkerStyle = xlMarkerStyleTriangle

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Parent Property (Excel)

 Copy code hover
[image]

LegendEntry.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Top Property (Excel)

 Copy code hover
[image]

LegendEntry.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Width Property (Excel)

 Copy code hover
[image]

LegendEntry.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry Methods (Excel)

 Copy code hover
[image]

LegendEntry Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


LegendEntry.Delete Method (Excel)

 Copy code hover
[image]

LegendEntry.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a LegendEntry object.

Return Value

Variant

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Select Method (Excel)

 Copy code hover
[image]

LegendEntry.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a LegendEntry object.

Return Value

Variant

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendKey Object (Excel)

 Copy code hover
[image]

LegendKey Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a legend key in a chart legend.

Remarks

Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.

Example

Use the LegendKey property to return the LegendKey object. The following example changes the marker background color for the legend entry at the top of the legend for embedded chart one on the worksheet named "Sheet1." This simultaneously changes the format of every point in the series associated with this legend entry. The associated series must support data markers.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Legend.LegendEntries(1).LegendKey.MarkerBackgroundColorIndex = 5

See also

Concepts

Excel Object Model Reference

Other resources

LegendKey Object Members


LegendKey Members (Excel)

 Copy code hover
[image]

LegendKey Members (Excel)
Send feedback

Represents a legend key in a chart legend.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns a Double value that represents the height, in points, of the object.
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a legend key.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Smooth | True if curve smoothing is turned on for the legend key. Read/write.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns a Double value that represents the width, in points, of the object.


LegendKey Properties (Excel)

 Copy code hover
[image]

LegendKey Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns a Double value that represents the height, in points, of the object.
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
Left | Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a legend key.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Smooth | True if curve smoothing is turned on for the legend key. Read/write.
Top | Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns a Double value that represents the width, in points, of the object.


LegendKey.Application Property (Excel)

 Copy code hover
[image]

LegendKey.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LegendKey object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Creator Property (Excel)

 Copy code hover
[image]

LegendKey.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LegendKey object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Format Property (Excel)

 Copy code hover
[image]

LegendKey.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Height Property (Excel)

 Copy code hover
[image]

LegendKey.Height Property (Excel)
See also Send feedback

Returns a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.InvertIfNegative Property (Excel)

 Copy code hover
[image]

LegendKey.InvertIfNegative Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.

Syntax

expression .InvertIfNegative

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Left Property (Excel)

 Copy code hover
[image]

LegendKey.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.

Syntax

expression .Left

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerBackgroundColor Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerBackgroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerBackgroundColorIndex Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerBackgroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerForegroundColor Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerForegroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColor

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerForegroundColorIndex Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerForegroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerSize Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.

Syntax

expression .MarkerSize

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerStyle Property (Excel)

 Copy code hover
[image]

LegendKey.MarkerStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Syntax

expression .MarkerStyle

expression A variable that represents a LegendKey object.

Remarks

XlMarkerStyle can be one of these XlMarkerStyle constants.

xlMarkerStyleAutomatic. Automatic markers

xlMarkerStyleCircle. Circular markers

xlMarkerStyleDash. Long bar markers

xlMarkerStyleDiamond. Diamond-shaped markers

xlMarkerStyleDot. Short bar markers

xlMarkerStyleNone. No markers

xlMarkerStylePicture. Picture markers

xlMarkerStylePlus. Square markers with a plus sign

xlMarkerStyleSquare. Square markers

xlMarkerStyleStar. Square markers with an asterisk

xlMarkerStyleTriangle. Triangular markers

xlMarkerStyleX. Square markers with an X

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Parent Property (Excel)

 Copy code hover
[image]

LegendKey.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.PictureType Property (Excel)

 Copy code hover
[image]

LegendKey.PictureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a legend key.

Syntax

expression .PictureType

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.PictureUnit2 Property (Excel)

 Copy code hover
[image]

LegendKey.PictureUnit2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .PictureUnit2

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Shadow Property (Excel)

 Copy code hover
[image]

LegendKey.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Smooth Property (Excel)

 Copy code hover
[image]

LegendKey.Smooth Property (Excel)
See also Send feedback

Published: July 16, 2012

True if curve smoothing is turned on for the legend key. Read/write.

Syntax

expression .Smooth

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Top Property (Excel)

 Copy code hover
[image]

LegendKey.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Width Property (Excel)

 Copy code hover
[image]

LegendKey.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey Methods (Excel)

 Copy code hover
[image]

LegendKey Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.


LegendKey.ClearFormats Method (Excel)

 Copy code hover
[image]

LegendKey.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a LegendKey object.

Return Value

Variant

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Delete Method (Excel)

 Copy code hover
[image]

LegendKey.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a LegendKey object.

Return Value

Variant

Remarks

Deleting a LegendKey object deletes the entire series.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LinearGradient Object (Excel)

 Copy code hover
[image]

LinearGradient Object (Excel)
See also Send feedback

Published: July 16, 2012

The LinearGradient object transitions through a series of colors in a linear manner along a specific angle.

Version Information

Version Added: Excel 2007

Remarks

  • Attempting to access a Gradient property of an Interior object that does not have an existing gradient fill will result in a Run Time Error. Be aware of the Interior.Pattern property before accessing the Gradient property.

  • If Interior.Pattern is changed from a gradient type to a non-gradient type, the Gradient object will populate with default values.

Note Note

Some things to consider when working with LinearGradient objects

See also

Concepts

Excel Object Model Reference

Other resources

LinearGradient Object Members


LinearGradient Members (Excel)

 Copy code hover
[image]

LinearGradient Members (Excel)
Send feedback

Published: July 16, 2012

The LinearGradient object transitions through a series of colors in a linear manner along a specific angle.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
ColorStops | Returns the ColorStops for the LinearGradient object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Degree | The angle of the linear gradient fill within a selection. Read/write
Parent | Returns the parent object for the specified object. Read-only


LinearGradient Properties (Excel)

 Copy code hover
[image]

LinearGradient Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
ColorStops | Returns the ColorStops for the LinearGradient object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Degree | The angle of the linear gradient fill within a selection. Read/write
Parent | Returns the parent object for the specified object. Read-only


LinearGradient.Application Property (Excel)

 Copy code hover
[image]

LinearGradient.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a LinearGradient object.

Return Value

Application

See also

Concepts

LinearGradient Object

Other resources

LinearGradient Object Members


LinearGradient.ColorStops Property (Excel)

 Copy code hover
[image]

LinearGradient.ColorStops Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ColorStops for the LinearGradient object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .ColorStops

expression A variable that represents a LinearGradient object.

Return Value

ColorStops

See also

Concepts

LinearGradient Object

Other resources

LinearGradient Object Members


LinearGradient.Creator Property (Excel)

 Copy code hover
[image]

LinearGradient.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a LinearGradient object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LinearGradient Object

Other resources

LinearGradient Object Members


LinearGradient.Degree Property (Excel)

 Copy code hover
[image]

LinearGradient.Degree Property (Excel)
See also Send feedback

Published: July 16, 2012

The angle of the linear gradient fill within a selection. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .Degree

expression A variable that represents a LinearGradient object.

Return Value

Double

Remarks

Uses values ranging from 0 - 360.

Example

VBA Copy code Copy code
With Selection.Interior
 .Pattern = xlPatternLinearGradient
 .Gradient.Degree = 45
End With

See also

Concepts

LinearGradient Object

Other resources

LinearGradient Object Members


LinearGradient.Parent Property (Excel)

 Copy code hover
[image]

LinearGradient.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a LinearGradient object.

Return Value

Object

See also

Concepts

LinearGradient Object

Other resources

LinearGradient Object Members


LineFormat Object (Excel)

 Copy code hover
[image]

LineFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents line and arrowhead formatting.

Remarks

For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

Example

Use the Line property to return a LineFormat object. The following example adds a blue, dashed line to myDocument. There's a short, narrow oval at the line's starting point and a long, wide triangle at its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

Excel Object Model Reference

Other resources

LineFormat Object Members


LineFormat Members (Excel)

 Copy code hover
[image]

LineFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents line and arrowhead formatting.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackColor | Returns or sets a ColorFormat object that represents the specified fill background color.
BeginArrowheadLength | Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.
BeginArrowheadStyle | Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.
BeginArrowheadWidth | Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DashStyle | Returns or sets the dash style for the specified line. Can be one of the MsoLineDashStyle contants. Read/write Long.
EndArrowheadLength | Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.
EndArrowheadStyle | Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.
EndArrowheadWidth | Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
InsetPen | Returns or sets whether lines are drawn inside the specified shape's boundaries. Read/write
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets an MsoPatternType value that represents the fill pattern.
Style | Returns or sets a MsoLineStyle value that represents the style of the line.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Weight | Returns or sets a Single value that represents the weight of the line.


LineFormat Properties (Excel)

 Copy code hover
[image]

LineFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackColor | Returns or sets a ColorFormat object that represents the specified fill background color.
BeginArrowheadLength | Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.
BeginArrowheadStyle | Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.
BeginArrowheadWidth | Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DashStyle | Returns or sets the dash style for the specified line. Can be one of the MsoLineDashStyle contants. Read/write Long.
EndArrowheadLength | Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.
EndArrowheadStyle | Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.
EndArrowheadWidth | Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
InsetPen | Returns or sets whether lines are drawn inside the specified shape's boundaries. Read/write
Parent | Returns the parent object for the specified object. Read-only.
Pattern | Returns or sets an MsoPatternType value that represents the fill pattern.
Style | Returns or sets a MsoLineStyle value that represents the style of the line.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Weight | Returns or sets a Single value that represents the weight of the line.


LineFormat.Application Property (Excel)

 Copy code hover
[image]

LineFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LineFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BackColor Property (Excel)

 Copy code hover
[image]

LineFormat.BackColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the specified fill background color.

Syntax

expression .BackColor

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadLength Property (Excel)

 Copy code hover
[image]

LineFormat.BeginArrowheadLength Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.

Syntax

expression .BeginArrowheadLength

expression A variable that represents a LineFormat object.

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadStyle Property (Excel)

 Copy code hover
[image]

LineFormat.BeginArrowheadStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.

Syntax

expression .BeginArrowheadStyle

expression A variable that represents a LineFormat object.

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadWidth Property (Excel)

 Copy code hover
[image]

LineFormat.BeginArrowheadWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.

Syntax

expression .BeginArrowheadWidth

expression A variable that represents a LineFormat object.

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Creator Property (Excel)

 Copy code hover
[image]

LineFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LineFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.DashStyle Property (Excel)

 Copy code hover
[image]

LineFormat.DashStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the dash style for the specified line. Can be one of the MsoLineDashStyle contants. Read/write Long.

Syntax

expression .DashStyle

expression A variable that represents a LineFormat object.

Example

This example adds a blue dashed line to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
    .DashStyle = msoLineDashDotDot
    .ForeColor.RGB = RGB(50, 0, 128)
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadLength Property (Excel)

 Copy code hover
[image]

LineFormat.EndArrowheadLength Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.

Syntax

expression .EndArrowheadLength

expression A variable that represents a LineFormat object.

Remarks

MsoArrowheadLength can be one of these MsoArrowheadLength constants.

msoArrowheadLengthMixed

msoArrowheadShort

msoArrowheadLengthMedium

msoArrowheadLong

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadStyle Property (Excel)

 Copy code hover
[image]

LineFormat.EndArrowheadStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.

Syntax

expression .EndArrowheadStyle

expression A variable that represents a LineFormat object.

Remarks

MsoArrowheadStyle can be one of these MsoArrowheadStyle constants.

msoArrowheadNone

msoArrowheadOval

msoArrowheadStyleMixed

msoArrowheadDiamond

msoArrowheadOpen

msoArrowheadStealth

msoArrowheadTriangle

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadWidth Property (Excel)

 Copy code hover
[image]

LineFormat.EndArrowheadWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.

Syntax

expression .EndArrowheadWidth

expression A variable that represents a LineFormat object.

Remarks

MsoArrowheadWidth can be one of these MsoArrowheadWidth constants.

msoArrowheadNarrow

msoArrowheadWidthMedium

msoArrowheadWide

msoArrowheadWidthMixed

Example

This example adds a line to myDocument. There's a short, narrow oval on the line's starting point and a long, wide triangle on its end point.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(100, 100, 200, 300).Line
    .BeginArrowheadLength = msoArrowheadShort
    .BeginArrowheadStyle = msoArrowheadOval
    .BeginArrowheadWidth = msoArrowheadNarrow
    .EndArrowheadLength = msoArrowheadLong
    .EndArrowheadStyle = msoArrowheadTriangle
    .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.ForeColor Property (Excel)

 Copy code hover
[image]

LineFormat.ForeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.

Syntax

expression .ForeColor

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.InsetPen Property (Excel)

 Copy code hover
[image]

LineFormat.InsetPen Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether lines are drawn inside the specified shape's boundaries. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .InsetPen

expression A variable that represents a LineFormat object.

Return Value

MsoTriState

Remarks

msoTrue (-1) if lines are drawn inside the shape's boundaries; otherwise msoFalse (0).

Example

The following code example adds two rectangles to the active worksheet, the first with its lines drawn inside its boundaries, and the second with its lines drawn on its boundaries.

VBA Copy code Copy code
Dim shpNew As Shape

With ActiveSheet.Shapes
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=200, Top:=150, Width:=150, Height:=100)
 With shpNew.Line
 .Weight = 24
 .InsetPen = msoTrue
 End With

 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=200, Top:=300, Width:=150, Height:=100)
 With shpNew.Line
 .Weight = 24
 .InsetPen = msoFalse
 End With
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Parent Property (Excel)

 Copy code hover
[image]

LineFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Pattern Property (Excel)

 Copy code hover
[image]

LineFormat.Pattern Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoPatternType value that represents the fill pattern.

Syntax

expression .Pattern

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Style Property (Excel)

 Copy code hover
[image]

LineFormat.Style Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoLineStyle value that represents the style of the line.

Syntax

expression .Style

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Transparency Property (Excel)

 Copy code hover
[image]

LineFormat.Transparency Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.

Syntax

expression .Transparency

expression A variable that represents a LineFormat object.

Remarks

The value of this property affects the appearance of solid-colored fills and lines only; it has no effect on the appearance of patterned lines or patterned, gradient, picture, or textured fills.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Visible Property (Excel)

 Copy code hover
[image]

LineFormat.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Weight Property (Excel)

 Copy code hover
[image]

LineFormat.Weight Property (Excel)
See also Send feedback

Returns or sets a Single value that represents the weight of the line.

Syntax

expression .Weight

expression A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LinkFormat Object (Excel)

 Copy code hover
[image]

LinkFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains linked OLE object properties.

Remarks

If the Shape object doesn't represent a linked object, the LinkFormat property fails.

Example

Use the LinkFormat property to return the LinkFormat object. The following example updates an OLE object in the Shapes collection.

VBA Copy code Copy code
Worksheets(1).Shapes(1).LinkFormat.Update

See also

Concepts

Excel Object Model Reference

Other resources

LinkFormat Object Members


LinkFormat Members (Excel)

 Copy code hover
[image]

LinkFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains linked OLE object properties.

Methods

Name | Description
Update | Updates the link.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoUpdate | True if the LinkFormat object is updated automatically when the source changes. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Parent | Returns the parent object for the specified object. Read-only.


LinkFormat Properties (Excel)

 Copy code hover
[image]

LinkFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoUpdate | True if the LinkFormat object is updated automatically when the source changes. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Parent | Returns the parent object for the specified object. Read-only.


LinkFormat.Application Property (Excel)

 Copy code hover
[image]

LinkFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a LinkFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.AutoUpdate Property (Excel)

 Copy code hover
[image]

LinkFormat.AutoUpdate Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the LinkFormat object is updated automatically when the source changes. Read-only Boolean.

Syntax

expression .AutoUpdate

expression A variable that represents a LinkFormat object.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Creator Property (Excel)

 Copy code hover
[image]

LinkFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a LinkFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Locked Property (Excel)

 Copy code hover
[image]

LinkFormat.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a LinkFormat object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Parent Property (Excel)

 Copy code hover
[image]

LinkFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a LinkFormat object.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat Methods (Excel)

 Copy code hover
[image]

LinkFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Update | Updates the link.


LinkFormat.Update Method (Excel)

 Copy code hover
[image]

LinkFormat.Update Method (Excel)
See also Send feedback

Published: July 16, 2012

Updates the link.

Syntax

expression .Update

expression A variable that represents a LinkFormat object.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


ListColumn Object (Excel)

 Copy code hover
[image]

ListColumn Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a column in a table.

Remarks

The ListColumn object is a member of the ListColumns collection. The ListColumns collection contains all the columns in a table (ListObject object).

Use the ListColumns property of the ListObject object to return a ListColumns collection.

Example

The following example adds a new ListColumn object to the default ListObject object in the first worksheet of the active workbook. Because no position is specified, a new rightmost column is added.

VBA Copy code Copy code
Sub AddListColumn()
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns.Add
End Sub

See also

Concepts

Excel Object Model Reference

Other resources

ListColumn Object Members


ListColumn Members (Excel)

 Copy code hover
[image]

ListColumn Members (Excel)
Send feedback

Published: July 16, 2012

Represents a column in a table.

Methods

Name | Description
Delete | Deletes the column of data in the list.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBodyRange | Returns a Range object that is the size of the data portion of a column. Read-only.
Index | Returns a Long value that represents the index number of the ListColumn object within the ListColumns collection.
Name | Returns or sets a String value that represents the name of the list column.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.
Total | Returns the Total row for a ListColumn object. Read-only.
TotalsCalculation | Determines the type of calculation in the Totals row of the list column based on the value of the XlTotalsCalculation enumeration. Read/write.
XPath | Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.


ListColumn Properties (Excel)

 Copy code hover
[image]

ListColumn Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBodyRange | Returns a Range object that is the size of the data portion of a column. Read-only.
Index | Returns a Long value that represents the index number of the ListColumn object within the ListColumns collection.
Name | Returns or sets a String value that represents the name of the list column.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.
Total | Returns the Total row for a ListColumn object. Read-only.
TotalsCalculation | Determines the type of calculation in the Totals row of the list column based on the value of the XlTotalsCalculation enumeration. Read/write.
XPath | Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.


ListColumn.Application Property (Excel)

 Copy code hover
[image]

ListColumn.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListColumn object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Creator Property (Excel)

 Copy code hover
[image]

ListColumn.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListColumn object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.DataBodyRange Property (Excel)

 Copy code hover
[image]

ListColumn.DataBodyRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that is the size of the data portion of a column. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .DataBodyRange

expression A variable that represents a ListColumn object.

Remarks

The returned object excludes the Header and Totals cell.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Index Property (Excel)

 Copy code hover
[image]

ListColumn.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the ListColumn object within the ListColumns collection.

Syntax

expression .Index

expression A variable that represents a ListColumn object.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Name Property (Excel)

 Copy code hover
[image]

ListColumn.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the list column.

Syntax

expression .Name

expression A variable that represents a ListColumn object.

Remarks

The value of this property is also used as the display name of the list column. This name must be unique within the list.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Parent Property (Excel)

 Copy code hover
[image]

ListColumn.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListColumn object.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Range Property (Excel)

 Copy code hover
[image]

ListColumn.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range to which the specified list object in the above list applies.

Syntax

expression .Range

expression A variable that represents a ListColumn object.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.Total Property (Excel)

 Copy code hover
[image]

ListColumn.Total Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Total row for a ListColumn object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Total

expression A variable that represents a ListColumn object.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.TotalsCalculation Property (Excel)

 Copy code hover
[image]

ListColumn.TotalsCalculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Determines the type of calculation in the Totals row of the list column based on the value of the XlTotalsCalculation enumeration. Read/write.

Syntax

expression .TotalsCalculation

expression A variable that represents a ListColumn object.

Remarks

XlTotalsCalculation can be one of these XlTotalsCalculation constants.

xlTotalsCalculationNone

xlTotalsCalculationSum

xlTotalsCalculationAverage

xlTotalsCalculationCount

xlTotalsCalculationCountNums

xlTotalsCalculationMin

xlTotalsCalculationStdDev

xlTotalsCalculationVar

xlTotalsCalculationMax

The Totals row doesn't need to be showing in order to set this property. There is no fixed "default" value for this property. Excel may change the state of this property, as other columns are added or deleted.

Example

VBA Copy code Copy code
ActiveSheet.ListColumns(1).TotalsCalculation=xlTotalsCalculationSum

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn.XPath Property (Excel)

 Copy code hover
[image]

ListColumn.XPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.

Syntax

expression .XPath

expression A variable that represents a ListColumn object.

Remarks

The XPath property is valid when the range it contains meets the following conditions:

  • The range is a single cell.

  • If the range consists of two or more cells, then one or the other must be true:

    1. If the cells contain XPath information, then all cells in the range must contain XPath information (that is, each cell is associated with one or more data maps), and all of the cells must have identical XPath content (that is, each cell contributes to the same set of data maps).

    2. All of the cells must contain no XPath information.

  • The range does not contain discontinuous areas.

    Note Note

    The header and totals row of a table are considered to contain XPath information.

Any ranges that don't meet the above conditions returns a runtime error.

If the range selection is valid, but none of the cells are mapped, Excel returns an XPath object so that you can access the SetValue method to create a mapping.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumn Methods (Excel)

 Copy code hover
[image]

ListColumn Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the column of data in the list.


ListColumn.Delete Method (Excel)

 Copy code hover
[image]

ListColumn.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the column of data in the list.

Syntax

expression .Delete

expression A variable that represents a ListColumn object.

Remarks

This method does not remove the column from the sheet. If the list is linked to a Microsoft SharePoint Foundation site, the column cannot be removed from the server, and an error is generated.

See also

Concepts

ListColumn Object

Other resources

ListColumn Object Members


ListColumns Object (Excel)

 Copy code hover
[image]

ListColumns Object (Excel)
See also Send feedback

A collection of all the ListColumn objects in the specified ListObject object.

Remarks

Each ListColumn object represents a column in the table.

Note Note

A name for the column is automatically generated. You can change the name after the column has been added.

Example

Use the ListColumns property of the ListObject object to return the ListColumns collection. The following example adds a new column to the default ListObject object in the first worksheet of the workbook. Because no position is specified, a new rightmost column is added.

VBA Copy code Copy code
Set myNewColumn = Worksheets(1).ListObject(1).ListColumns.Add

See also

Concepts

Excel Object Model Reference

Other resources

ListColumns Object Members


ListColumns Members (Excel)

 Copy code hover
[image]

ListColumns Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ListColumn objects in the specified ListObject object.

Methods

Name | Description
Add | Adds a new column to the list object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListColumns Properties (Excel)

 Copy code hover
[image]

ListColumns Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListColumns.Application Property (Excel)

 Copy code hover
[image]

ListColumns.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListColumns object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListColumns.Count Property (Excel)

 Copy code hover
[image]

ListColumns.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Integer value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ListColumns object.

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListColumns.Creator Property (Excel)

 Copy code hover
[image]

ListColumns.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListColumns object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListColumns.Item Property (Excel)

 Copy code hover
[image]

ListColumns.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ListColumns object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListColumns.Parent Property (Excel)

 Copy code hover
[image]

ListColumns.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListColumns object.

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListColumns Methods (Excel)

 Copy code hover
[image]

ListColumns Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new column to the list object.


ListColumns.Add Method (Excel)

 Copy code hover
[image]

ListColumns.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new column to the list object.

Syntax

expression .Add(Position)

expression A variable that represents a ListColumns object.

Parameters

Name | Required/Optional | Data Type | Description
Position | Optional | Variant | Integer. Specifies the relative position of the new column that starts at 1. The previous column at this position is shifted outward.

Return Value

A ListColumn object that represents the new column.

Remarks

If Position is not specified, a new rightmost column is added. A name for the column is automatically generated. The name of the new column can be changed after the column is added.

Example

The following example adds a new column to the default ListObject object in the first worksheet of the workbook. Because no position is specified, a new rightmost column is added.

VBA Copy code Copy code
Set myNewColumn = ActiveWorkbook.Worksheets(1).ListObjects(1).ListColumns.Add

See also

Concepts

ListColumns Object

Other resources

ListColumns Object Members


ListDataFormat Object (Excel)

 Copy code hover
[image]

ListDataFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

The ListDataFormat object holds all the data type properties of the ListColumn object. These properties are read-only.

Remarks

Use the ListDataFormat property of the ListColumn object to return a ListDataFormat object. The default property of the ListDataFormat object is the Type property which indicates the data type of the list column. This allows the user to write code without specifying the Type property.

Example

The following code example creates a linked list from a SharePoint list. It then checks to see if field 2 is required (field 1 is the ID field, which is read only). If it's a required text field, the same data is written in all existing records.

Note Note

The following code example assumes that you will substitute a valid server name and the list guid in the variables strServerName and strListGuid. Additionally, the server name must be followed by "/_vti_bin" or the sample will not work.

VBA Copy code Copy code
Dim objListObject As ListObject
Dim objDataRange As Range
Dim strListGUID as String
Dim strServerName as String

strServerName = "http://<servername>/_vti_bin"
strListGUID = "{<listguid>}"

Set objListObject = Sheet1.ListObjects.Add(xlSrcExternal, _
 Array(strServerName, strListGUID), True, xlYes, Range("A1"))

With objListObject.ListColumns(2)
 Set objDataRange = .Range.Offset(1, 0).Resize(.Range.Rows.Count - 2, 1)
 If .ListDataFormat.Type = xlListDataTypeText And .ListDataFormat.Required Then
 objDataRange.Value = "Hello World"
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

ListDataFormat Object Members


ListDataFormat Members (Excel)

 Copy code hover
[image]

ListDataFormat Members (Excel)
Send feedback

Published: July 16, 2012

The ListDataFormat object holds all the data type properties of the ListColumn object. These properties are read-only.

Properties

Name | Description
AllowFillIn | Returns a Boolean value indicating whether users can provide their own data for cells in a column (rather than being restricted to a list of values) for those columns that supply a list of values. Returns False for lists that are not linked to a SharePoint site. Also returns False if the column is not a specified as choice or multi-choice. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Choices | Returns an Array of String values that contains the choices offered to the user by the ListLookUp, ChoiceMulti, and Choice data types of the DefaultValue property. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DecimalPlaces | Returns a Long value that represents the number of decimal places to show for the numbers in the ListColumn object. Read-only Long.
DefaultValue | Returns Variant representing the default data type value for a new row in a column. The Nothing object is returned when the schema does not specify a default value. Read-only Variant.
IsPercent | Returns a Boolean value. Returns True only if the number data for the ListColumn object will be shown in percentage formatting. Read-only Boolean. Read-only.
lcid | Returns a Long value that represents the LCID for the ListColumn object that is specified in the schema definition. Read-only Long.
MaxCharacters | Returns a Long containing the maximum number of characters allowed in the ListColumn object if the Type property is set to xlListDataTypeText or xlListDataTypeMultiLineText. Read-only Long.
MaxNumber | Returns a Variant containing the maximum value allowed in this field in the list column. Read-only Variant.
MinNumber | Returns a Variant containing the minimum value allowed in this field in the list column. This can be a negative floating point number. Read-only Variant.
Parent | Returns the parent object for the specified object. Read-only.
ReadOnly | Returns True if the object has been opened as read-only. Read-only Boolean.
Required | Returns a Boolean value indicating whether the schema definition of a column requires data before the row is committed. Read-only Boolean.
Type | Returns an XlListDataType value that represents the data type of the list column.


ListDataFormat Properties (Excel)

 Copy code hover
[image]

ListDataFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowFillIn | Returns a Boolean value indicating whether users can provide their own data for cells in a column (rather than being restricted to a list of values) for those columns that supply a list of values. Returns False for lists that are not linked to a SharePoint site. Also returns False if the column is not a specified as choice or multi-choice. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Choices | Returns an Array of String values that contains the choices offered to the user by the ListLookUp, ChoiceMulti, and Choice data types of the DefaultValue property. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DecimalPlaces | Returns a Long value that represents the number of decimal places to show for the numbers in the ListColumn object. Read-only Long.
DefaultValue | Returns Variant representing the default data type value for a new row in a column. The Nothing object is returned when the schema does not specify a default value. Read-only Variant.
IsPercent | Returns a Boolean value. Returns True only if the number data for the ListColumn object will be shown in percentage formatting. Read-only Boolean. Read-only.
lcid | Returns a Long value that represents the LCID for the ListColumn object that is specified in the schema definition. Read-only Long.
MaxCharacters | Returns a Long containing the maximum number of characters allowed in the ListColumn object if the Type property is set to xlListDataTypeText or xlListDataTypeMultiLineText. Read-only Long.
MaxNumber | Returns a Variant containing the maximum value allowed in this field in the list column. Read-only Variant.
MinNumber | Returns a Variant containing the minimum value allowed in this field in the list column. This can be a negative floating point number. Read-only Variant.
Parent | Returns the parent object for the specified object. Read-only.
ReadOnly | Returns True if the object has been opened as read-only. Read-only Boolean.
Required | Returns a Boolean value indicating whether the schema definition of a column requires data before the row is committed. Read-only Boolean.
Type | Returns an XlListDataType value that represents the data type of the list column.


ListDataFormat.AllowFillIn Property (Excel)

 Copy code hover
[image]

ListDataFormat.AllowFillIn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating whether users can provide their own data for cells in a column (rather than being restricted to a list of values) for those columns that supply a list of values. Returns False for lists that are not linked to a SharePoint site. Also returns False if the column is not a specified as choice or multi-choice. Read-only Boolean.

Syntax

expression .AllowFillIn

expression A variable that represents a ListDataFormat object.

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Application Property (Excel)

 Copy code hover
[image]

ListDataFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListDataFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Choices Property (Excel)

 Copy code hover
[image]

ListDataFormat.Choices Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Array of String values that contains the choices offered to the user by the ListLookUp, ChoiceMulti, and Choice data types of the DefaultValue property. Read-only Variant.

Syntax

expression .Choices

expression A variable that represents a ListDataFormat object.

Remarks

In Microsoft Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the server that is running Microsoft SharePoint Foundation.

Example

The following example displays the setting of the Choice property for the third column in a list that is linked to a SharePoint list. In this example, it is assumed that the DefaultValue property has been set to the Choice, ChoiceMulti, or ListLookup data type.

VBA Copy code Copy code
Sub PrintChoices()
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.Choices
End Sub

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Creator Property (Excel)

 Copy code hover
[image]

ListDataFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListDataFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.DecimalPlaces Property (Excel)

 Copy code hover
[image]

ListDataFormat.DecimalPlaces Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of decimal places to show for the numbers in the ListColumn object. Read-only Long.

Syntax

expression .DecimalPlaces

expression A variable that represents a ListDataFormat object.

Remarks

Returns 0 if the ListDataFormat.Type setting is not appropriate for decimal places. Returns xlAutomatic (-4105 decimal) if the Microsoft SharePoint Foundation site is automatically determining the number of decimal places to show in the SharePoint list.

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example returns the setting of the DecimalPlaces property for the third column of a list in Sheet1 of the active workbook.

VBA Copy code Copy code
Function GetDecimalPlaces() As Long
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 GetDecimalPlaces = objListCol.ListDataFormat.DecimalPlaces
End Function

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.DefaultValue Property (Excel)

 Copy code hover
[image]

ListDataFormat.DefaultValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns Variant representing the default data type value for a new row in a column. The Nothing object is returned when the schema does not specify a default value. Read-only Variant.

Syntax

expression .DefaultValue

expression A variable that represents a ListDataFormat object.

Remarks

This property is used only for tables linked to a Microsoft SharePoint Foundation site.

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the DefaultValue property for the third column of the table in Sheet1 of the active workbook. This code requires a list linked to a SharePoint site.

VBA Copy code Copy code
Sub ShowDefaultSetting()
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 If IsNull(objListCol.ListDataFormat.DefaultValue) Then
 MsgBox "No default value specified."
 Else
 MsgBox objListCol.ListDataFormat.DefaultValue
 End If
End Sub

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.IsPercent Property (Excel)

 Copy code hover
[image]

ListDataFormat.IsPercent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value. Returns True only if the number data for the ListColumn object will be shown in percentage formatting. Read-only Boolean. Read-only.

Syntax

expression .IsPercent

expression A variable that represents a ListDataFormat object.

Remarks

This property is used only for lists that are linked to a Microsoft SharePoint Foundation site.

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example returns the setting of the IsPercent property for the third column of the list in Sheet1 of the active workbook.

VBA Copy code Copy code
Function GetIsPercent() As Boolean
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 GetIsPercent = objListCol.ListDataFormat.IsPercent
End Function

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.lcid Property (Excel)

 Copy code hover
[image]

ListDataFormat.lcid Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the LCID for the ListColumn object that is specified in the schema definition. Read-only Long.

Syntax

expression .lcid

expression A variable that represents a ListDataFormat object.

Remarks

In Microsoft Excel, the LCID indicates the currency symbol to be used when this is an xlListDataTypeCurrency type. Returns 0 (which is the Language Neutral LCID) when no locale is set for the data type of the column.

This property is used only for tables that are linked to a Microsoft SharePoint Foundation site.

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the lcid property for the third column of the list in Sheet1 of the active workbook.

VBA Copy code Copy code
Sub DisplayLCID()
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 MsgBox "List LCID: " & objListCol.ListDataFormat.lcid
End Sub

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.MaxCharacters Property (Excel)

 Copy code hover
[image]

ListDataFormat.MaxCharacters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long containing the maximum number of characters allowed in the ListColumn object if the Type property is set to xlListDataTypeText or xlListDataTypeMultiLineText. Read-only Long.

Syntax

expression .MaxCharacters

expression A variable that represents a ListDataFormat object.

Remarks

Returns -1 for columns whose Type property is set to a non-text value.

This property is used only for lists that are linked to a SharePoint site.

In Microsoft Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the MaxCharacters property for the third column of a list in Sheet1 of the active workbook.

VBA Copy code Copy code

 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.MaxCharacters

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.MaxNumber Property (Excel)

 Copy code hover
[image]

ListDataFormat.MaxNumber Property (Excel)
See also Send feedback

Returns a Variant containing the maximum value allowed in this field in the list column. Read-only Variant.

Syntax

expression .MaxNumber

expression A variable that represents a ListDataFormat object.

Remarks

The Nothing object is returned if a maximum value number has not been specified or if the Type property setting is such that a maximum value for the column is not applicable.

This property is used only for lists that are linked to a SharePoint site.

In Microsoft Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the MaxNumber property for the third column of a list in Sheet1 of the active workbook.

VBA Copy code Copy code

 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.MaxNumber

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.MinNumber Property (Excel)

 Copy code hover
[image]

ListDataFormat.MinNumber Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant containing the minimum value allowed in this field in the list column. This can be a negative floating point number. Read-only Variant.

Syntax

expression .MinNumber

expression A variable that represents a ListDataFormat object.

Remarks

This property will return the Nothing object if no value has been specified for this field or if the setting of the Type property is such that a minimum value is not applicable to the column.

This property is used only for lists that are linked to a SharePoint site.

In Microsoft Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the MinNumber property for the third column of a list in Sheet1 of the active workbook.

VBA Copy code Copy code

 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.MinNumber

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Parent Property (Excel)

 Copy code hover
[image]

ListDataFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListDataFormat object.

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.ReadOnly Property (Excel)

 Copy code hover
[image]

ListDataFormat.ReadOnly Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the object has been opened as read-only. Read-only Boolean.

Syntax

expression .ReadOnly

expression A variable that represents a ListDataFormat object.

Remarks

This property is used only for tables that are linked to a SharePoint site.

Example

The following example displays the setting of the ReadOnly property for the third column of a table in Sheet1 of the active workbook.

VBA Copy code Copy code

 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.ReadOnly

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Required Property (Excel)

 Copy code hover
[image]

ListDataFormat.Required Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating whether the schema definition of a column requires data before the row is committed. Read-only Boolean.

Syntax

expression .Required

expression A variable that represents a ListDataFormat object.

Remarks

In Microsoft Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the Required property for the third column of a list in Sheet1 of the active workbook.

VBA Copy code Copy code

Sub Test()
 Dim wrksht As Worksheet
 Dim objListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListCol = wrksht.ListObjects(1).ListColumns(3)

 Debug.Print objListCol.ListDataFormat.Required
End Sub

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListDataFormat.Type Property (Excel)

 Copy code hover
[image]

ListDataFormat.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlListDataType value that represents the data type of the list column.

Syntax

expression .Type

expression A variable that represents a ListDataFormat object.

Remarks

This property is used only for lists that are linked to a SharePoint site.

See also

Concepts

ListDataFormat Object

Other resources

ListDataFormat Object Members


ListObject Object (Excel)

 Copy code hover
[image]

ListObject Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a ListObject Object (Excel) object in the ListObjects collection.

Remarks

The ListObject object is a member of the ListObjects collection. The ListObjects collection contains all the list objects on a worksheet.

Example

Use the ListObjects property of the Worksheetobject to return a ListObjects collection. The following example adds a new ListRow object to the default ListObject object in the first worksheet of the active workbook.

VBA Copy code Copy code
Dim wrksht As Worksheet
Dim oListCol As ListRow

Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
Set oListCol = wrksht.ListObjects(1).ListRows.Add

See also

Concepts

Excel Object Model Reference

Other resources

ListObject Object Members


ListObject Members (Excel)

 Copy code hover
[image]

ListObject Members (Excel)
Send feedback

Published: July 16, 2012

Represents a ListObject Object (Excel) object in the ListObjects collection.

Methods

Name | Description
Delete | Deletes the ListObject object and clears the cell data from the worksheet.
ExportToVisio | Exports a ListObject object to Visio.
Publish | Publishes the ListObject object to a server that is running Microsoft SharePoint Foundation.
Refresh | Retrieves the current data and schema for the list from the server that is running Microsoft SharePoint Foundation. This method can be used only with lists that are linked to a SharePoint site. If the SharePoint site is not available, calling this method will return an error.
Resize | The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.
Unlink | Removes the link to a Microsoft SharePoint Foundation site from a list. Returns Nothing.
Unlist | Removes the list functionality from a ListObject object. After you use this method, the range of cells that made up the the list will be a regular range of data.

Properties

Name | Description
Active | Returns a Boolean value indicating whether a ListObject object in a worksheet is active—that is, whether the active cell is inside the range of the ListObject object. Read-only Boolean.
AlternativeText | Returns or sets the descriptive (alternative) text string for the specified table. Read/write
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilter | Filters a table using the AutoFilter feature. Read-only.
Comment | Returns or sets the comment associated with the list object. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBodyRange | Returns a Range object that represents the range of values, excluding the header row, in a table. Read-only.
DisplayName | Returns or sets the display name for the specified ListObject object. Read/write String.
DisplayRightToLeft | True if the specified ListObject is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
HeaderRowRange | Returns a Range object that represents the range of the header row for a list. Read-only Range.
InsertRowRange | Returns a Range object representing the Insert row, if any, of a specified ListObject object. Read-only Range.
ListColumns | Returns a ListColumns collection that represents all the columns in a ListObject object. Read-only.
ListRows | Returns a ListRows object that represents all the rows of data in the ListObject object. Read-only.
Name | Returns or sets a String value that represents the name of the ListObject object.
Parent | Returns the parent object for the specified object. Read-only.
QueryTable | Returns the QueryTable object that provides a link for the ListObject object to the list server. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.
SharePointURL | Returns a String representing the URL of the SharePoint list for a given ListObject object. Read-only String.
ShowAutoFilter | Returns Boolean to indicate whether the AutoFilter will be displayed. Read/write Boolean.
ShowAutoFilterDropDown | True when the AutoFilter drop down for the ListObject object is displayed. Boolean Read/Write
ShowHeaders | Returns or sets if the header information should be displayed for the specified ListObject object. Read/write Boolean.
ShowTableStyleColumnStripes | Returns or sets if the Column Stripes table style is used for the specified ListObject object. Read/write Boolean.
ShowTableStyleFirstColumn | Returns or sets if the first column is formatted for the specified ListObject object. Read/write Boolean.
ShowTableStyleLastColumn | Returns or sets if the last column is displayed for the specified ListObject object. Read/write Boolean.
ShowTableStyleRowStripes | Returns or sets if the Row Stripes table style is used for the specified ListObject object. Read/write Boolean.
ShowTotals | Gets or sets a Boolean to indicate whether the Total row is visible. Read/write Boolean.
Slicers | Returns a list of the table slicers associated with a ListObject. Read-only
Sort | Gets or sets the sort column or columns, and sort order for the ListObject collection.
SourceType | Returns a XlListObjectSourceType value that represents the current source of the list.
Summary | Returns or sets the description associated with the alternative text string for the specified table. Read/write
TableObject | Returns a TableObject Object (Excel) object. Read-only
TableStyle | Gets or sets the table style for the specified ListObject object. Read/write Variant.
TotalsRowRange | Returns a Range representing the Total row, if any, from a specified ListObject object. Read-only.
XmlMap | Returns an XmlMap object that represents the schema map used for the specified table. Read-only.


ListObject Properties (Excel)

 Copy code hover
[image]

ListObject Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | Returns a Boolean value indicating whether a ListObject object in a worksheet is active—that is, whether the active cell is inside the range of the ListObject object. Read-only Boolean.
AlternativeText | Returns or sets the descriptive (alternative) text string for the specified table. Read/write
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilter | Filters a table using the AutoFilter feature. Read-only.
Comment | Returns or sets the comment associated with the list object. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBodyRange | Returns a Range object that represents the range of values, excluding the header row, in a table. Read-only.
DisplayName | Returns or sets the display name for the specified ListObject object. Read/write String.
DisplayRightToLeft | True if the specified ListObject is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
HeaderRowRange | Returns a Range object that represents the range of the header row for a list. Read-only Range.
InsertRowRange | Returns a Range object representing the Insert row, if any, of a specified ListObject object. Read-only Range.
ListColumns | Returns a ListColumns collection that represents all the columns in a ListObject object. Read-only.
ListRows | Returns a ListRows object that represents all the rows of data in the ListObject object. Read-only.
Name | Returns or sets a String value that represents the name of the ListObject object.
Parent | Returns the parent object for the specified object. Read-only.
QueryTable | Returns the QueryTable object that provides a link for the ListObject object to the list server. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.
SharePointURL | Returns a String representing the URL of the SharePoint list for a given ListObject object. Read-only String.
ShowAutoFilter | Returns Boolean to indicate whether the AutoFilter will be displayed. Read/write Boolean.
ShowAutoFilterDropDown | True when the AutoFilter drop down for the ListObject object is displayed. Boolean Read/Write
ShowHeaders | Returns or sets if the header information should be displayed for the specified ListObject object. Read/write Boolean.
ShowTableStyleColumnStripes | Returns or sets if the Column Stripes table style is used for the specified ListObject object. Read/write Boolean.
ShowTableStyleFirstColumn | Returns or sets if the first column is formatted for the specified ListObject object. Read/write Boolean.
ShowTableStyleLastColumn | Returns or sets if the last column is displayed for the specified ListObject object. Read/write Boolean.
ShowTableStyleRowStripes | Returns or sets if the Row Stripes table style is used for the specified ListObject object. Read/write Boolean.
ShowTotals | Gets or sets a Boolean to indicate whether the Total row is visible. Read/write Boolean.
Slicers | Returns a list of the table slicers associated with a ListObject. Read-only
Sort | Gets or sets the sort column or columns, and sort order for the ListObject collection.
SourceType | Returns a XlListObjectSourceType value that represents the current source of the list.
Summary | Returns or sets the description associated with the alternative text string for the specified table. Read/write
TableObject | Returns a TableObject Object (Excel) object. Read-only
TableStyle | Gets or sets the table style for the specified ListObject object. Read/write Variant.
TotalsRowRange | Returns a Range representing the Total row, if any, from a specified ListObject object. Read-only.
XmlMap | Returns an XmlMap object that represents the schema map used for the specified table. Read-only.


ListObject.Active Property (Excel)

 Copy code hover
[image]

ListObject.Active Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating whether a ListObject object in a worksheet is active—that is, whether the active cell is inside the range of the ListObject object. Read-only Boolean.

Syntax

expression .Active

expression A variable that represents a ListObject object.

Remarks

Because there is no Activate method for the ListObject object, you can activate a ListObject object only by activating a cell range within the list.

Example

The following example activates the list in the default ListObject object in the first worksheet of the active workbook. Invoking the Activate method of the Range object without cell parameters activates the entire range for the list.

VBA Copy code Copy code
Function MakeListActive() As Boolean
 Dim wrksht As Worksheet
 Dim objList As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objList = wrksht.ListObjects(1)
 objList.Range.Activate

 MakeListActive = objList.Active
End Function

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.AlternativeText Property (Excel)

 Copy code hover
[image]

ListObject.AlternativeText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the descriptive (alternative) text string for the specified table. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AlternativeText

expression A variable that represents a ListObject object.

Return Value

String

Remarks

The value of the AlternativeText property corresponds to the setting of the Title box in the Alternative Text dialog box, which is displayed by right-clicking a table, pointing to Table, and then clicking Alternative Text.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Application Property (Excel)

 Copy code hover
[image]

ListObject.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListObject object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.AutoFilter Property (Excel)

 Copy code hover
[image]

ListObject.AutoFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Filters a table using the AutoFilter feature. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoFilter

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Comment Property (Excel)

 Copy code hover
[image]

ListObject.Comment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the comment associated with the list object. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .Comment

expression A variable that represents a ListObject object.

Remarks

The comment text cannot exceed 255 characters.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Creator Property (Excel)

 Copy code hover
[image]

ListObject.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListObject object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.DataBodyRange Property (Excel)

 Copy code hover
[image]

ListObject.DataBodyRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of values, excluding the header row, in a table. Read-only.

Syntax

expression .DataBodyRange

expression A variable that represents a ListObject object.

Example

This example selects the active data range in the list.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWorksheet.ListObjects.Item(1).DataBodyRange.Select

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.DisplayName Property (Excel)

 Copy code hover
[image]

ListObject.DisplayName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the display name for the specified ListObject object. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayName

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.DisplayRightToLeft Property (Excel)

 Copy code hover
[image]

ListObject.DisplayRightToLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified ListObject is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.

Syntax

expression .DisplayRightToLeft

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.HeaderRowRange Property (Excel)

 Copy code hover
[image]

ListObject.HeaderRowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of the header row for a list. Read-only Range.

Syntax

expression .HeaderRowRange

expression A variable that represents a ListObject object.

Example

The following example activates the range specified by the HeaderRowRange property of the default ListObject object in the first worksheet of the active workbook.

VBA Copy code Copy code
Sub ActivateHeaderRow()
 Dim wrksht As Worksheet
 Dim objList As ListObject
 Dim objListRng As Range

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objList = wrksht.ListObjects(1)
 Set objListRng = objList.HeaderRowRange

 objListRng.Activate
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.InsertRowRange Property (Excel)

 Copy code hover
[image]

ListObject.InsertRowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object representing the Insert row, if any, of a specified ListObject object. Read-only Range.

Syntax

expression .InsertRowRange

expression A variable that represents a ListObject object.

Remarks

If the Insert row is not visible because the list is inactive, the Nothing object will be returned.

Example

The following example activates the range specified by the InsertRowRange in the default ListObject object in the first worksheet of the active workbook.

VBA Copy code Copy code
Function ActivateInsertRow() As Boolean

 Dim wrksht As Worksheet
 Dim objList As ListObject
 Dim objListRng As Range

 Set wrksht = ActiveWorkbook.Worksheets(1)
 Set objList = wrksht.ListObjects(1)
 Set objListRng = objList.InsertRowRange

 If objListRng Is Nothing Then
 ActivateInsertRow = False
 Else
 objListRng.Activate
 ActivateInsertRow = True
 End If

End Function

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ListColumns Property (Excel)

 Copy code hover
[image]

ListObject.ListColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListColumns collection that represents all the columns in a ListObject object. Read-only.

Syntax

expression .ListColumns

expression A variable that represents a ListObject object.

Example

The following example displays the name of the second column in the ListColumns collection object as created by a call to the ListColumns property. For this code to run, the Sheet1 worksheet must contain a table.

VBA Copy code Copy code
Sub DisplayColumnName
 Dim wrksht As Worksheet
 Dim objListObj As ListObject
 Dim objListCols As ListColumns

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)
 Set objListCols = oListObj.ListColumns

 Debug.Print objListCols(2).Name
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ListRows Property (Excel)

 Copy code hover
[image]

ListObject.ListRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListRows object that represents all the rows of data in the ListObject object. Read-only.

Syntax

expression .ListRows

expression A variable that represents a ListObject object.

Remarks

The ListRows object returned does not include the header, total, or Insert rows.

Example

The following example deletes a row specified by number in the ListRows collection that is created by a call to the ListRows property.

VBA Copy code Copy code
Sub DeleteListRow(iRowNumber As Integer)
 Dim wrksht As Worksheet
 Dim objListObj As ListObject
 Dim objListRows As ListRows

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)
 Set objListRows = objListObj.ListRows

 If (iRowNumber <> 0) And (iRowNumber < objListRows.Count - 1) Then
 objListRows(iRowNumber).Delete
 End If
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Name Property (Excel)

 Copy code hover
[image]

ListObject.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the ListObject object.

Syntax

expression .Name

expression An expression that returns a ListObject object.

Return Value

String

Remarks

This name is used solely as a unique identifier for the Item property of the ListObjectscollection objects. This property can only be set through the object model.

By default, each ListObject object name begins with the word "List", followed by a number (no spaces). If an attempt is made to set the Name property to a name already used by another ListObject object, a run-time error is thrown.

Example

The following example displays the name of the default ListObject object in sheet1 of the active workbook.

VBA Copy code Copy code
Sub Test
 Dim wrksht As Worksheet
 Dim oListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListObj = wrksht.ListObjects(1)

 MsgBox oListObj.Name
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Parent Property (Excel)

 Copy code hover
[image]

ListObject.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.QueryTable Property (Excel)

 Copy code hover
[image]

ListObject.QueryTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the QueryTable object that provides a link for the ListObject object to the list server. Read-only.

Syntax

expression .QueryTable

expression A variable that represents a ListObject object.

Example

The following example creates a connection to a SharePoint site and publishes the ListObject object named List1 to the server. A reference to the QueryTable object for the list object is created and the MaintainConnection property of the QueryTable object is set to True so that the connection to the SharePoint site is maintained between trips to the server.

VBA Copy code Copy code
Dim wrksht As Worksheet
 Dim objListObj As ListObject
 Dim objQryTbl As QueryTable
 Dim prpQryProp As pro
 Dim arTarget(4) As String
 Dim strSTSConnection As String

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)

 arTarget(0) = "0"
 arTarget(1) = "http://myteam/project1"
 arTarget(2) = "1"
 arTarget(3) = "List1"

 strSTSConnection = objListObj.Publish(arTarget, True)

 Set objQryTbl = objListObj.QueryTable

 objQryTbl.MaintainConnection = True

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Range Property (Excel)

 Copy code hover
[image]

ListObject.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range to which the specified list object in the above list applies.

Syntax

expression .Range

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.SharePointURL Property (Excel)

 Copy code hover
[image]

ListObject.SharePointURL Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String representing the URL of the SharePoint list for a given ListObject object. Read-only String.

Syntax

expression .SharePointURL

expression A variable that represents a ListObject object.

Remarks

Accessing this property generates a run-time error if the list is not linked to a SharePoint site.

Example

The following example sets elements of the Target parameter of the Publish method to push the ListObject object to a SharePoint site. The code sample uses the SharePointURL property to assign the URL to the array and the Name property to assign the name of the list. The information in the array is then passed to the SharePoint site using the Publish method.

VBA Copy code Copy code
Sub PublishList()
 Dim wrksht As Worksheet
 Dim objListObj As ListObject
 Dim arTarget(4) As String
 Dim strSTSConnection As String

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)

 arTarget(0) = "0"
 arTarget(1) = objListObj.SharePointURL
 arTarget(2) = "1"
 arTarget(3) = objListObj.Name

 strSTSConnection = objListObj.Publish(arTarget, True)
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowAutoFilter Property (Excel)

 Copy code hover
[image]

ListObject.ShowAutoFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns Boolean to indicate whether the AutoFilter will be displayed. Read/write Boolean.

Syntax

expression .ShowAutoFilter

expression A variable that represents a ListObject object.

Remarks

ShowAutoFilter property defaults to True for a new ListObject object.

Example

The following example displays the setting of the ShowAutoFilter property the default list in Sheet 1 of the active workbook.

VBA Copy code Copy code

 Dim wrksht As Worksheet
 Dim oListCol As ListColumn

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListCol = wrksht.ListObjects(1)

 Debug.Print oListCol.ShowAutoFilter

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowAutoFilterDropDown Property (Excel)

 Copy code hover
[image]

ListObject.ShowAutoFilterDropDown Property (Excel)
See also Send feedback

Published: July 16, 2012

True when the AutoFilter drop down for the ListObject object is displayed. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowAutoFilterDropDown

expression A variable that represents a ListObject object.

Property value

BOOL

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowHeaders Property (Excel)

 Copy code hover
[image]

ListObject.ShowHeaders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the header information should be displayed for the specified ListObject object. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowHeaders

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowTableStyleColumnStripes Property (Excel)

 Copy code hover
[image]

ListObject.ShowTableStyleColumnStripes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the Column Stripes table style is used for the specified ListObject object. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleColumnStripes

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowTableStyleFirstColumn Property (Excel)

 Copy code hover
[image]

ListObject.ShowTableStyleFirstColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the first column is formatted for the specified ListObject object. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleFirstColumn

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowTableStyleLastColumn Property (Excel)

 Copy code hover
[image]

ListObject.ShowTableStyleLastColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the last column is displayed for the specified ListObject object. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleLastColumn

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowTableStyleRowStripes Property (Excel)

 Copy code hover
[image]

ListObject.ShowTableStyleRowStripes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the Row Stripes table style is used for the specified ListObject object. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleRowStripes

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ShowTotals Property (Excel)

 Copy code hover
[image]

ListObject.ShowTotals Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a Boolean to indicate whether the Total row is visible. Read/write Boolean.

Syntax

expression .ShowTotals

expression A variable that represents a ListObject object.

Example

The following code sample displays the current setting of the ShowTotals property of the default list in Sheet1 of the active workbook.

VBA Copy code Copy code

Sub test()
Dim oListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListObj = wrksht.ListObjects(1)

 Debug.Print oListObj.ShowTotals
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Slicers Property (Excel)

 Copy code hover
[image]

ListObject.Slicers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a list of the table slicers associated with a ListObject. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Slicers

expression A variable that represents a ListObject object.

Remarks

A ListObject is essentially a table.

Property value

SLICERS

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Sort Property (Excel)

 Copy code hover
[image]

ListObject.Sort Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the sort column or columns, and sort order for the ListObject collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Sort

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.SourceType Property (Excel)

 Copy code hover
[image]

ListObject.SourceType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlListObjectSourceType value that represents the current source of the list.

Syntax

expression .SourceType

expression A variable that represents a ListObject object.

Example

The following sample code returns a XlListObjectSourceType constant indicating the source of the default list on Sheet1 of the active workbook.

VBA Copy code Copy code
Sub Test ()
 Dim wrksht As Worksheet
 Dim oListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListObj = wrksht.ListObjects(1)

 Debug.Print oListObj.SourceType
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Summary Property (Excel)

 Copy code hover
[image]

ListObject.Summary Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the description associated with the alternative text string for the specified table. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Summary

expression A variable that represents a ListObject object.

Return Value

String

Remarks

The value of the Summary property corresponds to the setting of the Description box in the Alternative Text dialog box, which is displayed by right-clicking a table, pointing to Table, and then clicking Alternative Text.

See also

Concepts

PivotTable Object
Range Object
ListObject Object

Other resources

PivotTable Object Members
ListObject Object Members
Range Object Members


ListObject.TableObject Property (Excel)

 Copy code hover
[image]

ListObject.TableObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TableObject Object (Excel) object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TableObject

expression A variable that represents a ListObject object.

Remarks

The TableObject object is a worksheet table built from data returned from a PowerPivot model.

Property value

TABLEOBJECT

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.TableStyle Property (Excel)

 Copy code hover
[image]

ListObject.TableStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the table style for the specified ListObject object. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .TableStyle

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.TotalsRowRange Property (Excel)

 Copy code hover
[image]

ListObject.TotalsRowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range representing the Total row, if any, from a specified ListObject object. Read-only.

Syntax

expression .TotalsRowRange

expression A variable that represents a ListObject object.

Example

The following sample code returns the address of the Total row in the default list in Sheet1 of the active workbook. The code displays the Total row if it is not displayed already.

VBA Copy code Copy code
Sub DisplayTotalsRowAddress()
 Dim wrksht As Worksheet
 Dim objListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet2")
 Set objListObj = wrksht.ListObjects(1)
 objListObj.ShowTotals = True
 MsgBox objListObj.TotalsRowRange.Address
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.XmlMap Property (Excel)

 Copy code hover
[image]

ListObject.XmlMap Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlMap object that represents the schema map used for the specified table. Read-only.

Syntax

expression .XmlMap

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject Methods (Excel)

 Copy code hover
[image]

ListObject Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the ListObject object and clears the cell data from the worksheet.
ExportToVisio | Exports a ListObject object to Visio.
Publish | Publishes the ListObject object to a server that is running Microsoft SharePoint Foundation.
Refresh | Retrieves the current data and schema for the list from the server that is running Microsoft SharePoint Foundation. This method can be used only with lists that are linked to a SharePoint site. If the SharePoint site is not available, calling this method will return an error.
Resize | The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.
Unlink | Removes the link to a Microsoft SharePoint Foundation site from a list. Returns Nothing.
Unlist | Removes the list functionality from a ListObject object. After you use this method, the range of cells that made up the the list will be a regular range of data.


ListObject.Delete Method (Excel)

 Copy code hover
[image]

ListObject.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the ListObject object and clears the cell data from the worksheet.

Syntax

expression .Delete

expression A variable that represents a ListObject object.

Remarks

If the list is linked to a SharePoint site, deleting it does not affect data on the server that is running SharePoint Foundation. Any uncommitted changes made to the local list are not sent to the SharePoint list. (There is no warning that these uncommitted changes are lost.)

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.ExportToVisio Method (Excel)

 Copy code hover
[image]

ListObject.ExportToVisio Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports a ListObject object to Visio.

Version Information

Version Added: Excel 2007

Syntax

expression .ExportToVisio

expression A variable that represents a ListObject object.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Publish Method (Excel)

 Copy code hover
[image]

ListObject.Publish Method (Excel)
See also Send feedback

Published: July 16, 2012

Publishes the ListObject object to a server that is running Microsoft SharePoint Foundation.

Syntax

expression .Publish(Target, LinkSource)

expression A variable that represents a ListObject object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Variant | Contains an array of String values, as described in the Remarks section.
LinkSource | Required | Boolean |

Return Value

A String value that represents the URL of the published list on the SharePoint site.

Remarks

The Target parameter contains an array of String elements, as described in the following table:

Element# | Contents
0 | URL of SharePoint server
1 | ListName (Display Name)
2 | Description of the list. Optional.

If the ListObject object is not currently linked to a list on a SharePoint site, setting LinkSource to True will create a new list on the specified SharePoint site. If the ListObject object is currently linked to a SharePoint site, setting LinkSource argument to True will replace the existing link (you can only link the list to one SharePoint site). If the ListObject object is not currently linked, setting LinkSource to False will leave the ListObject object unlinked. If the ListObject object is currently linked to a SharePoint site, setting LinkSource to False will keep the ListObject object linked to the current SharePoint site.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Refresh Method (Excel)

 Copy code hover
[image]

ListObject.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Retrieves the current data and schema for the list from the server that is running Microsoft SharePoint Foundation. This method can be used only with lists that are linked to a SharePoint site. If the SharePoint site is not available, calling this method will return an error.

Syntax

expression .Refresh

expression A variable that represents a ListObject object.

Remarks

Calling the Refresh method does not commit changes to the list in the Excel workbook. Uncommitted changes in the list in Excel are discarded when the Refresh method is called.

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Resize Method (Excel)

 Copy code hover
[image]

ListObject.Resize Method (Excel)
See also Send feedback

Published: July 16, 2012

The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.

Syntax

expression .Resize(Range)

expression An expression that returns a ListObject object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The new range.

Remarks

For tables that are linked to a server that is running Microsoft SharePoint Foundation, you can resize the list using this method by providing a Range argument that differs from the current range of the ListObject only in the number of rows it contains. Attempting to resize lists linked to SharePoint Foundation by adding or deleting columns (in the Range argument) results in a run-time error.

Example

The following example uses the Resize method to resize the default ListObject object in Sheet1 of the active workbook.

VBA Copy code Copy code
Sub ResizeList()
 Dim wrksht As Worksheet
 Dim objListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)

 objListObj.Resize Range("A1:B10")
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Unlink Method (Excel)

 Copy code hover
[image]

ListObject.Unlink Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes the link to a Microsoft SharePoint Foundation site from a list. Returns Nothing.

Syntax

expression .Unlink

expression A variable that represents a ListObject object.

Remarks

After this method is called and the list is unlinked, it cannot be reversed.

Example

The following example unlinks a list from a SharePoint site.

VBA Copy code Copy code
Sub UnlinkList()
 Dim wrksht As Worksheet
 Dim objListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)

 objListObj.Unlink
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObject.Unlist Method (Excel)

 Copy code hover
[image]

ListObject.Unlist Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes the list functionality from a ListObject object. After you use this method, the range of cells that made up the the list will be a regular range of data.

Syntax

expression .Unlist

expression A variable that represents a ListObject object.

Remarks

Running this method leaves the cell data, formatting, and formulas in the worksheet. The Total row is also left intact. This method removes any link to a Microsoft SharePoint Foundation site. AutoFilter is also removed from the list.

Example

The following example removes the list features from a list on a worksheet.

VBA Copy code Copy code
Sub DeList()
 Dim wrksht As Worksheet
 Dim objListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set objListObj = wrksht.ListObjects(1)
 objListObj.Unlist
End Sub

See also

Concepts

ListObject Object

Other resources

ListObject Object Members


ListObjects Object (Excel)

 Copy code hover
[image]

ListObjects Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the ListObject objects on a worksheet. Each ListObject object represents a table in the worksheet.

Remarks

Use the ListObjects property of the Worksheet object to return the ListObjects collection.

Example

The following example creates a new ListObjects collection which represents all the tables in a worksheet.

VBA Copy code Copy code
Set myWorksheetLists = Worksheets(1).ListObjects

See also

Concepts

Excel Object Model Reference

Other resources

ListObjects Object Members


ListObjects Members (Excel)

 Copy code hover
[image]

ListObjects Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ListObject objects on a worksheet. Each ListObject object represents a table in the worksheet.

Methods

Name | Description
Add | Creates a new list object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListObjects Properties (Excel)

 Copy code hover
[image]

ListObjects Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListObjects.Application Property (Excel)

 Copy code hover
[image]

ListObjects.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListObjects object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListObjects.Count Property (Excel)

 Copy code hover
[image]

ListObjects.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Integer value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ListObjects object.

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListObjects.Creator Property (Excel)

 Copy code hover
[image]

ListObjects.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListObjects object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListObjects.Item Property (Excel)

 Copy code hover
[image]

ListObjects.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ListObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

The following example displays the name of the default list object on Sheet1 of the active workbook.

VBA Copy code Copy code

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListObj = wrksht.ListObjects.Item(1).Name

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListObjects.Parent Property (Excel)

 Copy code hover
[image]

ListObjects.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListObjects object.

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListObjects Methods (Excel)

 Copy code hover
[image]

ListObjects Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new list object.


ListObjects.Add Method (Excel)

 Copy code hover
[image]

ListObjects.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new list object.

Syntax

expression .Add(SourceType, Source, LinkSource, HasHeaders, Destination)

expression A variable that represents a ListObjects object.

Parameters

Name

Required/Optional

Data Type

Description

SourceType

Optional

XlListObjectSourceType

Indicates the kind of source for the query.

Source

Optional

Variant

when SourceType = xlSrcRange. A Range object representing the data source. If omitted, the Source will default to the range returned by list range detection code. when SourceType = xlSrcExternal. An array of String values specifying a connection to the source, containing the following elements:

  • 0 - URL to SharePoint site

  • 1 - ListName

  • 2 - ViewGUID

LinkSource

Optional

Variant

Boolean. Indicates whether an external data source is to be linked to the ListObject object. If SourceType is xlSrcExternal, default is True. Invalid if SourceType is xlSrcRange, and will return an error if not omitted.

TableStyleName

Optional

Variant

An XlYesNoGuess constant that indicates whether the data being imported has column labels. If the Source does not contain headers, Excel will automatically generate headers.

Destination

Optional

Variant

A Range object specifying a single-cell reference as the destination for the top-left corner of the new list object. If the Range object refers to more than one cell, an error is generated. The Destination argument must be specified when SourceType is set to xlSrcExternal. The Destination argument is ignored if SourceType is set to xlSrcRange. The destination range must be on the worksheet that contains the ListObjects collection specified by expression. New columns will be inserted at the Destination to fit the new list. Therefore, existing data will not be overwritten.

Return Value

A ListObject object that represents the new list object.

Remarks

When the list has headers, the first row of cells will be converted to Text, if not already set to text. The conversion will be based on the visible text for the cell. This means that if there is a date value with a Date format that changes with locale, the conversion to a list might produce different results depending on the current system locale. Moreover, if there are two cells in the header row that have the same visible text, an incremental Integer will be appended to make each column header unique.

Example

The following example adds a new ListObject object based on data from a Microsoft SharePoint Foundation site to the default ListObjects collection and places the list in cell A1 in the first worksheet of the workbook.

Note Note

The following code example assumes that you will substitute a valid server name and the list guid in the variables strServerName and strListGUID. Additionally, the server name must be followed by "/_vti_bin" or the sample will not work.

VBA Copy code Copy code
Set objListObject = ActiveWorkbook.Worksheets(1).ListObjects.Add(SourceType:= xlSrcExternal, _
Source:= Array(strServerName, strListName, strListGUID), LinkSource:=True, _
TableStyleName:=xlGuess, Destination:=Range("A10"))

See also

Concepts

ListObjects Object

Other resources

ListObjects Object Members


ListRow Object (Excel)

 Copy code hover
[image]

ListRow Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a row in a table. The ListRow object is a member of the ListRows collection.

Remarks

The ListRows collection contains all the rows in a list object.

Use the ListRows property of the ListObject object to return a ListRows collection.

Example

The following example adds a new ListRow object to the default ListObject object in the first worksheet of the active workbook. Because no position is specified, a new row is added to the end of the table.

VBA Copy code Copy code
Dim wrksht As Worksheet
Dim oListRow As ListRow

Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
Set oListRow = wrksht.ListObjects(1).ListRows.Add

See also

Concepts

Excel Object Model Reference

Other resources

ListRow Object Members


ListRow Members (Excel)

 Copy code hover
[image]

ListRow Members (Excel)
Send feedback

Published: July 16, 2012

Represents a row in a table. The ListRow object is a member of the ListRows collection.

Methods

Name | Description
Delete | Deletes the cells of the list row and shifts upward any remaining cells below the deleted row. You can delete rows in the list even when the list is linked to a SharePoint site. The list on the SharePoint site will not be updated, however, until you synchronize your changes.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the ListRow object within the ListRows collection.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.


ListRow Properties (Excel)

 Copy code hover
[image]

ListRow Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the ListRow object within the ListRows collection.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a Range object that represents the range to which the specified list object in the above list applies.


ListRow.Application Property (Excel)

 Copy code hover
[image]

ListRow.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListRow object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRow.Creator Property (Excel)

 Copy code hover
[image]

ListRow.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListRow object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRow.Index Property (Excel)

 Copy code hover
[image]

ListRow.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the ListRow object within the ListRows collection.

Syntax

expression .Index

expression A variable that represents a ListRow object.

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRow.Parent Property (Excel)

 Copy code hover
[image]

ListRow.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListRow object.

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRow.Range Property (Excel)

 Copy code hover
[image]

ListRow.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range to which the specified list object in the above list applies.

Syntax

expression .Range

expression A variable that represents a ListRow object.

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRow Methods (Excel)

 Copy code hover
[image]

ListRow Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the cells of the list row and shifts upward any remaining cells below the deleted row. You can delete rows in the list even when the list is linked to a SharePoint site. The list on the SharePoint site will not be updated, however, until you synchronize your changes.


ListRow.Delete Method (Excel)

 Copy code hover
[image]

ListRow.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the cells of the list row and shifts upward any remaining cells below the deleted row. You can delete rows in the list even when the list is linked to a SharePoint site. The list on the SharePoint site will not be updated, however, until you synchronize your changes.

Syntax

expression .Delete

expression A variable that represents a ListRow object.

See also

Concepts

ListRow Object

Other resources

ListRow Object Members


ListRows Object (Excel)

 Copy code hover
[image]

ListRows Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the ListRow objects in the specified ListObject object.

Remarks

Each ListRow object represents a row in the table.

Example

Use the ListRows property of the ListObject object to return the ListRows collection. The following example adds a new row to the default ListObject object in the first worksheet of the workbook. Because no position is specified, a new row is added to the end of the table.

VBA Copy code Copy code
Set myNewRow = Worksheets(1).ListObject(0).ListRows.Add

See also

Concepts

Excel Object Model Reference

Other resources

ListRows Object Members


ListRows Members (Excel)

 Copy code hover
[image]

ListRows Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ListRow objects in the specified ListObject object.

Methods

Name | Description
Add | Adds a new row to the table represented by the specified ListObject.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListRows Properties (Excel)

 Copy code hover
[image]

ListRows Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


ListRows.Application Property (Excel)

 Copy code hover
[image]

ListRows.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ListRows object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


ListRows.Count Property (Excel)

 Copy code hover
[image]

ListRows.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Integer value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ListRows object.

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


ListRows.Creator Property (Excel)

 Copy code hover
[image]

ListRows.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ListRows object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


ListRows.Item Property (Excel)

 Copy code hover
[image]

ListRows.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ListRows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


ListRows.Parent Property (Excel)

 Copy code hover
[image]

ListRows.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ListRows object.

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


ListRows Methods (Excel)

 Copy code hover
[image]

ListRows Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new row to the table represented by the specified ListObject.


ListRows.Add Method (Excel)

 Copy code hover
[image]

ListRows.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new row to the table represented by the specified ListObject.

Syntax

expression .Add(Position, AlwaysInsert)

expression A variable that represents a ListRows object.

Parameters

Name | Required/Optional | Data Type | Description
Position | Optional | Variant | Integer. Specifies the relative position of the new row.
AlwaysInsert | Optional | Variant | Boolean. Specifies whether to always shift data in cells below the last row of the table when the new row is inserted, regardless if the row below the table is empty. If True, the cells below the table will be shifted down one row. If False, if the row below the table is empty, the table will expand to occupy that row without shifting cells below it; but if the row below the table contains data, those cells will be shifted down when the new row is inserted.

Return Value

A ListRow object that represents the new row.

Remarks

If Position is not specified, a new bottom row is added. If AlwaysInsert is not specified, the cells below the table will be shifted down one row (same as specifying True).

Example

The following example adds a new row to the default ListObject object in the first worksheet of the workbook. Because no position is specified, the new row is added to the bottom of the list.

VBA Copy code Copy code
Set myNewColumn = ActiveWorkbook.Worksheets(1).ListObject(1).ListRows.Add

See also

Concepts

ListRows Object

Other resources

ListRows Object Members


Mailer Object (Excel)

 Copy code hover
[image]

Mailer Object (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Excel Object Model Reference

Other resources

Mailer Object Members


Mailer Members (Excel)

 Copy code hover
[image]

Mailer Members (Excel)
Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BCCRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
CCRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enclosures | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Parent | Returns the parent object for the specified object. Read-only.
Received | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
SendDateTime | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Sender | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Subject | Returns or sets the subject for the mailer. Read/write String.
ToRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
WhichAddress | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.


Mailer Properties (Excel)

 Copy code hover
[image]

Mailer Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BCCRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
CCRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enclosures | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Parent | Returns the parent object for the specified object. Read-only.
Received | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
SendDateTime | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Sender | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Subject | Returns or sets the subject for the mailer. Read/write String.
ToRecipients | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
WhichAddress | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.


Mailer.Application Property (Excel)

 Copy code hover
[image]

Mailer.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Mailer object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.BCCRecipients Property (Excel)

 Copy code hover
[image]

Mailer.BCCRecipients Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .BCCRecipients

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.CCRecipients Property (Excel)

 Copy code hover
[image]

Mailer.CCRecipients Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .CCRecipients

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Creator Property (Excel)

 Copy code hover
[image]

Mailer.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Mailer object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Enclosures Property (Excel)

 Copy code hover
[image]

Mailer.Enclosures Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .Enclosures

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Parent Property (Excel)

 Copy code hover
[image]

Mailer.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Received Property (Excel)

 Copy code hover
[image]

Mailer.Received Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .Received

expression An expression that returns a Mailer object.

Return Value

Boolean

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.SendDateTime Property (Excel)

 Copy code hover
[image]

Mailer.SendDateTime Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .SendDateTime

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Sender Property (Excel)

 Copy code hover
[image]

Mailer.Sender Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .Sender

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.Subject Property (Excel)

 Copy code hover
[image]

Mailer.Subject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the subject for the mailer. Read/write String.

Syntax

expression .Subject

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.ToRecipients Property (Excel)

 Copy code hover
[image]

Mailer.ToRecipients Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .ToRecipients

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Mailer.WhichAddress Property (Excel)

 Copy code hover
[image]

Mailer.WhichAddress Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .WhichAddress

expression A variable that represents a Mailer object.

See also

Concepts

Mailer Object

Other resources

Mailer Object Members


Model Object (Excel)

 Copy code hover
[image]

Model Object (Excel)
See also Send feedback

Published: July 16, 2012

Stores references to workbook connections and information about the tables and relationships contained within the Data Model.

Version information

Version Added: Excel 2013

See also

Other resources

Model Object Members


Model Object Members (Excel)

 Copy code hover
[image]

Model Object Members (Excel)
Send feedback

Stores references to workbook connections and information about the tables and relationships contained within the Data Model.

Methods

Name | Description
AddConnection | Adds a new Workbook Connection to the model with the same properties as the one supplied as an argument.
CreateModelWorkbookConnection | Returns a WorkbookConnection Object (Excel) object of type ModelConnection Object (Excel).
Initialize | Initializes the Workbook's Data Model. This is called by default the first time the model is used.
Refresh | Refreshes all data sources associated with the model, fully reprocesses the model and updates all Excel data features associated with the Model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataModelConnection | Returns the model workbook connection object from the workbook connections collection which connects to the model.
ModelRelationships | Returns a collection of relationships between Data Model tables. Read-only
ModelTables | Returns a collection of tables inside the Data Model. Read-only
Name | Returns a String value representing the name of the Model object. Read-only
Parent | Returns an Object that represents the parent object of the specified Model object. Read-only.


Model Properties (Excel)

 Copy code hover
[image]

Model Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataModelConnection | Returns the model workbook connection object from the workbook connections collection which connects to the model.
ModelRelationships | Returns a collection of relationships between Data Model tables. Read-only
ModelTables | Returns a collection of tables inside the Data Model. Read-only
Name | Returns a String value representing the name of the Model object. Read-only
Parent | Returns an Object that represents the parent object of the specified Model object. Read-only.


Model.Application Property (Excel)

 Copy code hover
[image]

Model.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a Model Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

Model Object Members
Model Object


Model.Creator Property (Excel)

 Copy code hover
[image]

Model.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a Model Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

Model Object Members
Model Object


Model.DataModelConnection Property (Excel)

 Copy code hover
[image]

Model.DataModelConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the model workbook connection object from the workbook connections collection which connects to the model.

Version information

Version Added: Excel 2013

Syntax

expression .DataModelConnection

expression A variable that represents a Model Object (Excel) object.

Property value

WORKBOOKCONNECTION

See also

Other resources

Model Object Members
Model Object


Model.ModelRelationships Property (Excel)

 Copy code hover
[image]

Model.ModelRelationships Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a collection of relationships between Data Model tables. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ModelRelationships

expression A variable that represents a Model Object (Excel) object.

Property value

MODELRELATIONSHIPS

See also

Other resources

Model Object Members
Model Object


Model.ModelTables Property (Excel)

 Copy code hover
[image]

Model.ModelTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a collection of tables inside the Data Model. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ModelTables

expression A variable that represents a Model Object (Excel) object.

Property value

MODELTABLES

See also

Other resources

Model Object Members
Model Object


Model.Name Property (Excel)

 Copy code hover
[image]

Model.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value representing the name of the Model object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Name

expression A variable that represents a Model Object (Excel) object.

Property value

STRING

See also

Other resources

Model Object Members
Model Object


Model.Parent Property (Excel)

 Copy code hover
[image]

Model.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Model object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a Model Object (Excel) object.

Property value

OBJECT

See also

Other resources

Model Object Members
Model Object


Model Methods (Excel)

 Copy code hover
[image]

Model Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddConnection | Adds a new Workbook Connection to the model with the same properties as the one supplied as an argument.
CreateModelWorkbookConnection | Returns a WorkbookConnection Object (Excel) object of type ModelConnection Object (Excel).
Initialize | Initializes the Workbook's Data Model. This is called by default the first time the model is used.
Refresh | Refreshes all data sources associated with the model, fully reprocesses the model and updates all Excel data features associated with the Model.


Model.AddConnection Method (Excel)

 Copy code hover
[image]

Model.AddConnection Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new Workbook Connection to the model with the same properties as the one supplied as an argument.

Version information

Version Added: Excel 2013

Syntax

expression .AddConnection(ConnectionToDataSource)

expression A variable that represents a Model Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
ConnectionToDataSource | Required | WORKBOOKCONNECTION | The Workbook connection.

Return value

WORKBOOKCONNECTION

Remarks

This method only works on legacy/non-model external connections and will fail with a run-time error if called with an external model connection as its argument. When calling this method, a new model connection is created and it is named the same as the legacy connection with the existing logic for making the name unique applied (integer at the end).

See also

Other resources

Model Object Members
Model Object


Model.CreateModelWorkbookConnection Method (Excel)

 Copy code hover
[image]

Model.CreateModelWorkbookConnection Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a WorkbookConnection Object (Excel) object of type ModelConnection Object (Excel).

Version information

Version Added: Excel 2013

Syntax

expression .CreateModelWorkbookConnection(ModelTable)

expression A variable that represents a Model Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
ModelTable | Required | VARIANT | Either a model table name or a model table object.

Return value

WORKBOOKCONNECTION

Remarks

This type of connection can only be used by query tables in Microsoft Excel 2013

See also

Other resources

Model Object Members
Model Object


Model.Initialize Method (Excel)

 Copy code hover
[image]

Model.Initialize Method (Excel)
See also Send feedback

Initializes the Workbook's Data Model. This is called by default the first time the model is used.

Version information

Version Added: Excel 2013

Syntax

expression .Initialize

expression A variable that represents a Model Object (Excel) object.

Return value

VOID

See also

Other resources

Model Object Members
Model Object


Model.Refresh Method (Excel)

 Copy code hover
[image]

Model.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes all data sources associated with the model, fully reprocesses the model and updates all Excel data features associated with the Model.

Version information

Version Added: Excel 2013

Syntax

expression .Refresh

expression A variable that represents a Model Object (Excel) object.

Return value

VOID

See also

Other resources

Model Object Members
Model Object


ModelChanges Object (Excel)

 Copy code hover
[image]

ModelChanges Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents changes made to the data model.

Version information

Version Added: Excel 2013

Remarks

The ModelChanges object contains information about which changes were made to the data model when the Workbook.Workbook.ModelChange Event (Excel) (Excel) event occurs after a model operation. When Excel makes changes to the data model, multiple changes can be made in the same operation and the ModelChanges object will include information about all the changes made in one model operation.

See also

Other resources

ModelChanges Object Members


ModelChanges Members (Excel)

 Copy code hover
[image]

ModelChanges Members (Excel)
Send feedback

Published: July 16, 2012

Represents changes made to the data model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnsAdded | Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns added as part of a model operation. Read-only.
ColumnsChanged | Returns a ModelColumnChanges Object (Excel) collection of ModelColumnChange Object (Excel) objects which represent table names and column names of all table columns for which the data type was changed (might add more types of changes here in the future) as part of a model operation. Read-only.
ColumnsDeleted | Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns which were deleted as part of a model operation. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
MeasuresAdded | Returns a ModelMeasureNames Object (Excel) collection of ModelMeasureName Object (Excel) objects which represent all measures which were added as part of a model operation. Read-only.
Parent | Returns an Object that represents the parent object of the specified ModelChanges object. Read-only.
RelationshipChange | When True, one or more relationships in the model were changed (added, deleted or modified) as part of a model operation. When False, no relationships were changed during the operation. Boolean Read-only.
Source |
TableNamesChanged | Returns a ModelTableNameChanges Object (Excel) collection of ModelTableNameChange Object (Excel) objects representing old and new names of all tables which were renamed in the model as part of a model operation. Read-only.
TablesAdded | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were added to the model as part of a model operation. Read-only.
TablesDeleted | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were deleted from the model as part of a model operation. Read-only.
TablesModified | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were refreshed or recalculated as part of a model operation. Read-only.
UnknownChange | True when a non-specified change was made to the model as part of a model transaction. Boolean Read-only


ModelChanges Properties (Excel)

 Copy code hover
[image]

ModelChanges Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnsAdded | Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns added as part of a model operation. Read-only.
ColumnsChanged | Returns a ModelColumnChanges Object (Excel) collection of ModelColumnChange Object (Excel) objects which represent table names and column names of all table columns for which the data type was changed (might add more types of changes here in the future) as part of a model operation. Read-only.
ColumnsDeleted | Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns which were deleted as part of a model operation. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
MeasuresAdded | Returns a ModelMeasureNames Object (Excel) collection of ModelMeasureName Object (Excel) objects which represent all measures which were added as part of a model operation. Read-only.
Parent | Returns an Object that represents the parent object of the specified ModelChanges object. Read-only.
RelationshipChange | When True, one or more relationships in the model were changed (added, deleted or modified) as part of a model operation. When False, no relationships were changed during the operation. Boolean Read-only.
Source |
TableNamesChanged | Returns a ModelTableNameChanges Object (Excel) collection of ModelTableNameChange Object (Excel) objects representing old and new names of all tables which were renamed in the model as part of a model operation. Read-only.
TablesAdded | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were added to the model as part of a model operation. Read-only.
TablesDeleted | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were deleted from the model as part of a model operation. Read-only.
TablesModified | Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were refreshed or recalculated as part of a model operation. Read-only.
UnknownChange | True when a non-specified change was made to the model as part of a model transaction. Boolean Read-only


ModelChanges.Application Property (Excel)

 Copy code hover
[image]

ModelChanges.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelChanges object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.ColumnsAdded Property (Excel)

 Copy code hover
[image]

ModelChanges.ColumnsAdded Property (Excel)
See also Send feedback

Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns added as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ColumnsAdded

expression A variable that represents a ModelChanges object.

Property value

MODELCOLUMNNAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.ColumnsChanged Property (Excel)

 Copy code hover
[image]

ModelChanges.ColumnsChanged Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelColumnChanges Object (Excel) collection of ModelColumnChange Object (Excel) objects which represent table names and column names of all table columns for which the data type was changed (might add more types of changes here in the future) as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ColumnsChanged

expression A variable that represents a ModelChanges object.

Property value

MODELCOLUMNCHANGES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.ColumnsDeleted Property (Excel)

 Copy code hover
[image]

ModelChanges.ColumnsDeleted Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelColumnNames Object (Excel) collection of ModelColumnName Object (Excel) objects which represent all columns which were deleted as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ColumnsDeleted

expression A variable that represents a ModelChanges object.

Property value

MODELCOLUMNNAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.Creator Property (Excel)

 Copy code hover
[image]

ModelChanges.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelChanges object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.MeasuresAdded Property (Excel)

 Copy code hover
[image]

ModelChanges.MeasuresAdded Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelMeasureNames Object (Excel) collection of ModelMeasureName Object (Excel) objects which represent all measures which were added as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .MeasuresAdded

expression A variable that represents a ModelChanges object.

Property value

MODELMEASURENAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.Parent Property (Excel)

 Copy code hover
[image]

ModelChanges.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelChanges object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelChanges Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.RelationshipChange Property (Excel)

 Copy code hover
[image]

ModelChanges.RelationshipChange Property (Excel)
See also Send feedback

Published: July 16, 2012

When True, one or more relationships in the model were changed (added, deleted or modified) as part of a model operation. When False, no relationships were changed during the operation. Boolean Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .RelationshipChange

expression A variable that represents a ModelChanges object.

Property value

BOOL

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.Source Property (Excel)

 Copy code hover
[image]

ModelChanges.Source Property (Excel)
See also Send feedback

Returns the source of the data model. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Source

expression A variable that represents a ModelChanges object.

Remarks

The source can be either Excel or a PowerPivot Add-in.

Property value

XlModelChangeSource

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.TableNamesChanged Property (Excel)

 Copy code hover
[image]

ModelChanges.TableNamesChanged Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTableNameChanges Object (Excel) collection of ModelTableNameChange Object (Excel) objects representing old and new names of all tables which were renamed in the model as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TableNamesChanged

expression A variable that represents a ModelChanges object.

Property value

MODELTABLENAMECHANGES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.TablesAdded Property (Excel)

 Copy code hover
[image]

ModelChanges.TablesAdded Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were added to the model as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TablesAdded

expression A variable that represents a ModelChanges object.

Property value

MODELTABLENAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.TablesDeleted Property (Excel)

 Copy code hover
[image]

ModelChanges.TablesDeleted Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were deleted from the model as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TablesDeleted

expression A variable that represents a ModelChanges object.

Property value

MODELTABLENAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.TablesModified Property (Excel)

 Copy code hover
[image]

ModelChanges.TablesModified Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTableNames Object (Excel) collection of table names as strings representing all tables which were refreshed or recalculated as part of a model operation. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TablesModified

expression A variable that represents a ModelChanges object.

Property value

MODELTABLENAMES

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelChanges.UnknownChange Property (Excel)

 Copy code hover
[image]

ModelChanges.UnknownChange Property (Excel)
See also Send feedback

Published: July 16, 2012

True when a non-specified change was made to the model as part of a model transaction. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .UnknownChange

expression A variable that represents a ModelChanges object.

Property value

BOOL

See also

Other resources

ModelChanges Object Members
ModelChanges Object


ModelColumnChange Object (Excel)

 Copy code hover
[image]

ModelColumnChange Object (Excel)
See also Send feedback

Published: July 16, 2012

An object representing a column in a table in the Excel data model for which the data type was changed.

Version information

Version Added: Excel 2013

See also

Other resources

ModelColumnChange Object Members


ModelColumnChange Members (Excel)

 Copy code hover
[image]

ModelColumnChange Members (Excel)
Send feedback

Published: July 16, 2012

An object representing a column in a table in the Excel data model for which the data type was changed.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnName | String representing the name of a column for which the data type was changed. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnChange Object (Excel) object. Read-only.
TableName | String representing the name of a table in the Excel data model for which the data type of a column was changed. Read-only.


ModelColumnChange Properties (Excel)

 Copy code hover
[image]

ModelColumnChange Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnName | String representing the name of a column for which the data type was changed. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnChange Object (Excel) object. Read-only.
TableName | String representing the name of a table in the Excel data model for which the data type of a column was changed. Read-only.


ModelColumnChange.Application Property (Excel)

 Copy code hover
[image]

ModelColumnChange.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelColumnChange Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelColumnChange Object Members
ModelColumnChange Object


ModelColumnChange.ColumnName Property (Excel)

 Copy code hover
[image]

ModelColumnChange.ColumnName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing the name of a column for which the data type was changed. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ColumnName

expression A variable that represents a ModelColumnChange object.

Property value

STRING

See also

Other resources

ModelColumnChange Object Members
ModelColumnChange Object


ModelColumnChange.Creator Property (Excel)

 Copy code hover
[image]

ModelColumnChange.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelColumnChange Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelColumnChange Object Members
ModelColumnChange Object


ModelColumnChange.Parent Property (Excel)

 Copy code hover
[image]

ModelColumnChange.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelColumnChange Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelColumnChange Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelColumnChange Object Members
ModelColumnChange Object


ModelColumnChange.TableName Property (Excel)

 Copy code hover
[image]

ModelColumnChange.TableName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing the name of a table in the Excel data model for which the data type of a column was changed. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TableName

expression A variable that represents a ModelColumnChange object.

Property value

STRING

See also

Other resources

ModelColumnChange Object Members
ModelColumnChange Object


ModelColumnChanges Object (Excel)

 Copy code hover
[image]

ModelColumnChanges Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ModelColumnChange Object (Excel) objects representing columns for which the data type was change in the Excel data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelColumnChanges Object Members


ModelColumnChanges Members (Excel)

 Copy code hover
[image]

ModelColumnChanges Members (Excel)
Send feedback

Published: July 16, 2012

A collection of ModelColumnChange Object (Excel) objects representing columns for which the data type was change in the Excel data model.

Methods

Name | Description
Item | Returns a single object from the ModelColumnChanges Object (Excel) object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of ModelColumnChange Object (Excel) objects in a ModelColumnChanges Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnChanges Object (Excel) object. Read-only.


ModelColumnChanges Properties (Excel)

 Copy code hover
[image]

ModelColumnChanges Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of ModelColumnChange Object (Excel) objects in a ModelColumnChanges Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnChanges Object (Excel) object. Read-only.


ModelColumnChanges.Application Property (Excel)

 Copy code hover
[image]

ModelColumnChanges.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelColumnChanges Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelColumnChanges Object Members
ModelColumnChanges Object


ModelColumnChanges.Count Property (Excel)

 Copy code hover
[image]

ModelColumnChanges.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of ModelColumnChange Object (Excel) objects in a ModelColumnChanges Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelColumnChanges Object (Excel) object.

Property value

INT32

See also

Other resources

ModelColumnChanges Object Members
ModelColumnChanges Object


ModelColumnChanges.Creator Property (Excel)

 Copy code hover
[image]

ModelColumnChanges.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelColumnChanges Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelColumnChanges Object Members
ModelColumnChanges Object


ModelColumnChanges.Parent Property (Excel)

 Copy code hover
[image]

ModelColumnChanges.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelColumnChanges Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelColumnChanges Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelColumnChanges Object Members
ModelColumnChanges Object


ModelColumnChanges Methods (Excel)

 Copy code hover
[image]

ModelColumnChanges Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelColumnChanges Object (Excel) object.


ModelColumnChanges.Item Method (Excel)

 Copy code hover
[image]

ModelColumnChanges.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelColumnChanges Object (Excel) object.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelColumnChanges Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

A ModelColumnChange Object (Excel) object contained in the collection.

See also

Other resources

ModelColumnChanges Object Members
ModelColumnChanges Object


ModelColumnName Object (Excel)

 Copy code hover
[image]

ModelColumnName Object (Excel)
See also Send feedback

Published: July 16, 2012

An object representing the name of a column in the data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelColumnName Object Members


ModelColumnName Members (Excel)

 Copy code hover
[image]

ModelColumnName Members (Excel)
Send feedback

Published: July 16, 2012

An object representing the name of a column in the data model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnName | String representing the name of a column of the table identified by the ModelColumnName.TableName Property (Excel) property. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnName Object (Excel) object. Read-only.
TableName | String representing a table name of a table in the data model. Read-only.


ModelColumnName Properties (Excel)

 Copy code hover
[image]

ModelColumnName Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
ColumnName | String representing the name of a column of the table identified by the ModelColumnName.TableName Property (Excel) property. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnName Object (Excel) object. Read-only.
TableName | String representing a table name of a table in the data model. Read-only.


ModelColumnName.Application Property (Excel)

 Copy code hover
[image]

ModelColumnName.Application Property (Excel)
See also Send feedback

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelColumnName Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelColumnName Object Members
ModelColumnName Object


ModelColumnName.ColumnName Property (Excel)

 Copy code hover
[image]

ModelColumnName.ColumnName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing the name of a column of the table identified by the ModelColumnName.TableName Property (Excel) property. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ColumnName

expression A variable that represents a ModelColumnName object.

Property value

STRING

See also

Other resources

ModelColumnName Object Members
ModelColumnName Object


ModelColumnName.Creator Property (Excel)

 Copy code hover
[image]

ModelColumnName.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelColumnName Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelColumnName Object Members
ModelColumnName Object


ModelColumnName.Parent Property (Excel)

 Copy code hover
[image]

ModelColumnName.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelColumnName Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelColumnName Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelColumnName Object Members
ModelColumnName Object


ModelColumnName.TableName Property (Excel)

 Copy code hover
[image]

ModelColumnName.TableName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing a table name of a table in the data model. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TableName

expression A variable that represents a ModelColumnName object.

Property value

STRING

See also

Other resources

ModelColumnName Object Members
ModelColumnName Object


ModelColumnNames Object (Excel)

 Copy code hover
[image]

ModelColumnNames Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ModelColumnName Object (Excel) objects representing columns of tables in the data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelColumnNames Object Members


ModelColumnNames Members (Excel)

 Copy code hover
[image]

ModelColumnNames Members (Excel)
Send feedback

A collection of ModelColumnName Object (Excel) objects representing columns of tables in the data model.

Methods

Name | Description
Item | Returns a single object from the ModelColumnNames Object (Excel) collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelColumnName Object (Excel) objects in a ModelColumnNames Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnNames Object (Excel) object. Read-only.


ModelColumnNames Properties (Excel)

 Copy code hover
[image]

ModelColumnNames Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelColumnName Object (Excel) objects in a ModelColumnNames Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelColumnNames Object (Excel) object. Read-only.


ModelColumnNames.Application Property (Excel)

 Copy code hover
[image]

ModelColumnNames.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelColumnNames Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelColumnNames Object Members
ModelColumnNames Object


ModelColumnNames.Count Property (Excel)

 Copy code hover
[image]

ModelColumnNames.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of a ModelColumnName Object (Excel) objects in a ModelColumnNames Object (Excel) collection. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelColumnNames Object (Excel) object.

Property value

INT32

See also

Other resources

ModelColumnNames Object Members
ModelColumnNames Object


ModelColumnNames.Creator Property (Excel)

 Copy code hover
[image]

ModelColumnNames.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelColumnNames Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelColumnNames Object Members
ModelColumnNames Object


ModelColumnNames.Parent Property (Excel)

 Copy code hover
[image]

ModelColumnNames.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelColumnNames Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelColumnNames Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelColumnNames Object Members
ModelColumnNames Object


ModelColumnNames Methods (Excel)

 Copy code hover
[image]

ModelColumnNames Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelColumnNames Object (Excel) collection.


ModelColumnNames.Item Method (Excel)

 Copy code hover
[image]

ModelColumnNames.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelColumnNames Object (Excel) collection.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelColumnNames Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number or name for the object.

Return value

A ModelColumnName Object (Excel) object contained in the collection.

See also

Other resources

ModelColumnNames Object Members
ModelColumnNames Object


ModelConnection Object (Excel)

 Copy code hover
[image]

ModelConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Contain information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated data model.

Version information

Version Added: Excel 2013

Remarks

To use for all PivotTables connected to the model, there will have a new "special" workbook connection which always exists (and cannot be deleted) in workbooks which have a data model. It gets created when the model is first created in a workbook. All properties on this special workbook connection are read-only. Its name is:Workbook Data Model.

See also

Other resources

ModelConnection Object Members


ModelConnection Members (Excel)

 Copy code hover
[image]

ModelConnection Members (Excel)
Send feedback

Published: July 16, 2012

Contain information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated data model.

Properties

Name | Description
ADOConnection | The ADO Connection Object is used to create an open connection to a data source. Enables addins, such as Powerview, to create a direct connection to the engine and hence the data model. ADOConnection object Read-only.
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CalculatedMembers |
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets one of the XlCmdType Enumeration (Excel) constants. Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelConnection object. Read-only.


ModelConnection Properties (Excel)

 Copy code hover
[image]

ModelConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ADOConnection | The ADO Connection Object is used to create an open connection to a data source. Enables addins, such as Powerview, to create a direct connection to the engine and hence the data model. ADOConnection object Read-only.
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CalculatedMembers |
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets one of the XlCmdType Enumeration (Excel) constants. Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelConnection object. Read-only.


ModelConnection.ADOConnection Property (Excel)

 Copy code hover
[image]

ModelConnection.ADOConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

The ADO Connection Object is used to create an open connection to a data source. Enables addins, such as Powerview, to create a direct connection to the engine and hence the data model. ADOConnection object Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .ADOConnection

expression A variable that represents a ModelConnection Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelConnection.Application Property (Excel)

 Copy code hover
[image]

ModelConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelConnection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelConnection.CommandText Property (Excel)

 Copy code hover
[image]

ModelConnection.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .CommandText

expression A variable that represents a ModelConnection Object (Excel) object.

Remarks

The command text is either a table name (of a model table) or a DAX expression evaluating to a table.

Property value

VARIANT

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelConnection.CommandType Property (Excel)

 Copy code hover
[image]

ModelConnection.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType Enumeration (Excel) constants. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .CommandType

expression A variable that represents a ModelConnection Object (Excel) object.

Remarks

For a ModelConnection object, this type will be set to either xlCmdTable or xlCmdDAX. The isolated connection ThisWorkbookDataModel to the Data Model will be of type xlCmdCube.

Property value

XLCMDTYPE

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelConnection.Creator Property (Excel)

 Copy code hover
[image]

ModelConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelConnection Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelConnection.Parent Property (Excel)

 Copy code hover
[image]

ModelConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelConnection object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelConnection Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelConnection Object Members
ModelConnection Object


ModelMeasureName Object (Excel)

 Copy code hover
[image]

ModelMeasureName Object (Excel)
See also Send feedback

Published: July 16, 2012

An object representing a measure in the data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelMeasureName Object Members


ModelMeasureName Members (Excel)

 Copy code hover
[image]

ModelMeasureName Members (Excel)
Send feedback

Published: July 16, 2012

An object representing a measure in the data model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
MeasureName | String representing the new name a measure which was added to the ModelTable Object (Excel) identified by the ModelMeasureName.TableName Property (Excel) property. Read-only.
Parent | Returns an Object that represents the parent object of the specified ModelMeasureName Object (Excel) object. Read-only.
TableName | String representing the name of a table in the model for which a measure was added. Read-only.


ModelMeasureName Properties (Excel)

 Copy code hover
[image]

ModelMeasureName Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
MeasureName | String representing the new name a measure which was added to the ModelTable Object (Excel) identified by the ModelMeasureName.TableName Property (Excel) property. Read-only.
Parent | Returns an Object that represents the parent object of the specified ModelMeasureName Object (Excel) object. Read-only.
TableName | String representing the name of a table in the model for which a measure was added. Read-only.


ModelMeasureName.Application Property (Excel)

 Copy code hover
[image]

ModelMeasureName.Application Property (Excel)
See also Send feedback

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelMeasureName Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelMeasureName Object Members
ModelMeasureName Object


ModelMeasureName.Creator Property (Excel)

 Copy code hover
[image]

ModelMeasureName.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelMeasureName Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelMeasureName Object Members
ModelMeasureName Object


ModelMeasureName.MeasureName Property (Excel)

 Copy code hover
[image]

ModelMeasureName.MeasureName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing the new name a measure which was added to the ModelTable Object (Excel) identified by the ModelMeasureName.TableName Property (Excel) property. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .MeasureName

expression A variable that represents a ModelMeasureName object.

Property value

STRING

See also

Other resources

ModelMeasureName Object Members
ModelMeasureName Object


ModelMeasureName.Parent Property (Excel)

 Copy code hover
[image]

ModelMeasureName.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelMeasureName Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelMeasureName Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelMeasureName Object Members
ModelMeasureName Object


ModelMeasureName.TableName Property (Excel)

 Copy code hover
[image]

ModelMeasureName.TableName Property (Excel)
See also Send feedback

Published: July 16, 2012

String representing the name of a table in the model for which a measure was added. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .TableName

expression A variable that represents a ModelMeasureName object.

Property value

STRING

See also

Other resources

ModelMeasureName Object Members
ModelMeasureName Object


ModelMeasureNames Object (Excel)

 Copy code hover
[image]

ModelMeasureNames Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ModelMeasureName Object (Excel) objects representing names of measures in the Excel data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelMeasureNames Object Members


ModelMeasureNames Members (Excel)

 Copy code hover
[image]

ModelMeasureNames Members (Excel)
Send feedback

A collection of ModelMeasureName Object (Excel) objects representing names of measures in the Excel data model.

Methods

Name | Description
Item | Returns a single object from the ModelMeasureNames Object (Excel) object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelMeasureName Object (Excel) objects in a ModelMeasureNames Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelMeasureNames Object (Excel) object. Read-only.


ModelMeasureNames Properties (Excel)

 Copy code hover
[image]

ModelMeasureNames Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelMeasureName Object (Excel) objects in a ModelMeasureNames Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelMeasureNames Object (Excel) object. Read-only.


ModelMeasureNames.Application Property (Excel)

 Copy code hover
[image]

ModelMeasureNames.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelMeasureNames Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelMeasureNames Object Members
ModelMeasureNames Object


ModelMeasureNames.Count Property (Excel)

 Copy code hover
[image]

ModelMeasureNames.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of a ModelMeasureName Object (Excel) objects in a ModelMeasureNames Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelMeasureNames Object (Excel) object.

Property value

INT32

See also

Other resources

ModelMeasureNames Object Members
ModelMeasureNames Object


ModelMeasureNames.Creator Property (Excel)

 Copy code hover
[image]

ModelMeasureNames.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelMeasureNames Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelMeasureNames Object Members
ModelMeasureNames Object


ModelMeasureNames.Parent Property (Excel)

 Copy code hover
[image]

ModelMeasureNames.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelMeasureNames Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelMeasureNames Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelMeasureNames Object Members
ModelMeasureNames Object


ModelMeasureNames Methods (Excel)

 Copy code hover
[image]

ModelMeasureNames Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelMeasureNames Object (Excel) object.


ModelMeasureNames.Item Method (Excel)

 Copy code hover
[image]

ModelMeasureNames.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelMeasureNames Object (Excel) object.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelMeasureNames Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

A ModelMeasureName Object (Excel) object contained in the collection.

See also

Other resources

ModelMeasureNames Object Members
ModelMeasureNames Object


ModelRelationship Object (Excel)

 Copy code hover
[image]

ModelRelationship Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a relationship, currently in the data model, between two tables.

Version information

Version Added: Excel 2013

See also

Other resources

ModelRelationship Object Members


ModelRelationship Members (Excel)

 Copy code hover
[image]

ModelRelationship Members (Excel)
Send feedback

Published: July 16, 2012

Represents a relationship, currently in the data model, between two tables.

Methods

Name | Description
Delete | Deletes the relationship.

Properties

Name | Description
Active | When True, the relationship is active. When False, this relationship is inactive. Boolean. Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeignKeyColumn | Contains the ModelTableColumn Object (Excel) object (Excel) representing the foreign key column on the many side of the one-to-many relationship. Read-only
ForeignKeyTable | Contains the ModelTable Object (Excel) object (Excel) representing the table on the many side of the one-to-many relationship. Read-only
Parent | Returns an Object that represents the parent object of the specified ModelRelationship Object (Excel) object. Read-only.
PrimaryKeyColumn | Contains the ModelTableColumn Object (Excel) object (Excel) representing the primary key column in the table on the one side of the one-to-many relationship.
PrimaryKeyTable | Contains the ModelTable Object (Excel) object (Excel) representing the table on the one side of the one-to-many relationship.


ModelRelationship Properties (Excel)

 Copy code hover
[image]

ModelRelationship Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | When True, the relationship is active. When False, this relationship is inactive. Boolean. Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeignKeyColumn | Contains the ModelTableColumn Object (Excel) object (Excel) representing the foreign key column on the many side of the one-to-many relationship. Read-only
ForeignKeyTable | Contains the ModelTable Object (Excel) object (Excel) representing the table on the many side of the one-to-many relationship. Read-only
Parent | Returns an Object that represents the parent object of the specified ModelRelationship Object (Excel) object. Read-only.
PrimaryKeyColumn | Contains the ModelTableColumn Object (Excel) object (Excel) representing the primary key column in the table on the one side of the one-to-many relationship.
PrimaryKeyTable | Contains the ModelTable Object (Excel) object (Excel) representing the table on the one side of the one-to-many relationship.


ModelRelationship.Active Property (Excel)

 Copy code hover
[image]

ModelRelationship.Active Property (Excel)
See also Send feedback

Published: July 16, 2012

When True, the relationship is active. When False, this relationship is inactive. Boolean. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .Active

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

BOOL

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.Application Property (Excel)

 Copy code hover
[image]

ModelRelationship.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelRelationship Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.Creator Property (Excel)

 Copy code hover
[image]

ModelRelationship.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelRelationship Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.ForeignKeyColumn Property (Excel)

 Copy code hover
[image]

ModelRelationship.ForeignKeyColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Contains the ModelTableColumn Object (Excel) object (Excel) representing the foreign key column on the many side of the one-to-many relationship. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ForeignKeyColumn

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

MODELTABLECOLUMN

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.ForeignKeyTable Property (Excel)

 Copy code hover
[image]

ModelRelationship.ForeignKeyTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Contains the ModelTable Object (Excel) object (Excel) representing the table on the many side of the one-to-many relationship. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ForeignKeyTable

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

MODELTABLE

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.Parent Property (Excel)

 Copy code hover
[image]

ModelRelationship.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelRelationship Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.PrimaryKeyColumn Property (Excel)

 Copy code hover
[image]

ModelRelationship.PrimaryKeyColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Contains the ModelTableColumn Object (Excel) object (Excel) representing the primary key column in the table on the one side of the one-to-many relationship.

Version information

Version Added: Excel 2013

Syntax

expression .PrimaryKeyColumn

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

MODELTABLECOLUMN

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship.PrimaryKeyTable Property (Excel)

 Copy code hover
[image]

ModelRelationship.PrimaryKeyTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Contains the ModelTable Object (Excel) object (Excel) representing the table on the one side of the one-to-many relationship.

Version information

Version Added: Excel 2013

Syntax

expression .PrimaryKeyTable

expression A variable that represents a ModelRelationship Object (Excel) object.

Property value

MODELTABLE

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationship Methods (Excel)

 Copy code hover
[image]

ModelRelationship Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the relationship.


ModelRelationship.Delete Method (Excel)

 Copy code hover
[image]

ModelRelationship.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the relationship.

Version information

Version Added: Excel 2013

Syntax

expression .Delete

expression A variable that represents a ModelRelationship Object (Excel) object.

Return value

VOID

See also

Other resources

ModelRelationship Object Members
ModelRelationship Object


ModelRelationships Object (Excel)

 Copy code hover
[image]

ModelRelationships Object (Excel)
See also Send feedback

Published: July 16, 2012

This collection contains all relationships currently between data tables in the data model of Excel 2013.

Version information

Version Added: Excel 2013

See also

Other resources

ModelRelationships Object Members


ModelRelationships Members (Excel)

 Copy code hover
[image]

ModelRelationships Members (Excel)
Send feedback

Published: July 16, 2012

This collection contains all relationships currently between data tables in the data model of Excel 2013.

Methods

Name | Description
Add | Adds a new relationship to the model.
Item | Returns a single object from the ModelRelationships Object (Excel) object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelRelationship Object (Excel) objects in a ModelRelationships Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelRelationships Object (Excel) object. Read-only.


ModelRelationships Properties (Excel)

 Copy code hover
[image]

ModelRelationships Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelRelationship Object (Excel) objects in a ModelRelationships Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelRelationships Object (Excel) object. Read-only.


ModelRelationships.Application Property (Excel)

 Copy code hover
[image]

ModelRelationships.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelRelationships Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelRelationships.Count Property (Excel)

 Copy code hover
[image]

ModelRelationships.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of a ModelRelationship Object (Excel) objects in a ModelRelationships Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelRelationships Object (Excel) object.

Property value

INT32

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelRelationships.Creator Property (Excel)

 Copy code hover
[image]

ModelRelationships.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelRelationships Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelRelationships.Parent Property (Excel)

 Copy code hover
[image]

ModelRelationships.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelRelationships Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelRelationships Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelRelationships Methods (Excel)

 Copy code hover
[image]

ModelRelationships Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new relationship to the model.
Item | Returns a single object from the ModelRelationships Object (Excel) object.


ModelRelationships.Add Method (Excel)

 Copy code hover
[image]

ModelRelationships.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new relationship to the model.

Version information

Version Added: Excel 2013

Syntax

expression .Add(ForeignKeyColumn,PrimaryKeyColumn)

expression A variable that represents a ModelRelationships Object (Excel) object (Excel).

Parameters

Name | Required/Optional | Data type | Description
ForeignKeyColumn | Required | MODELTABLECOLUMN | A ModelTableColumn Object (Excel) object (Excel) representing the foreign key column in the table on the many side of the one-to-many relationship.
PrimaryKeyColumn | Required | MODELTABLECOLUMN | A ModelTableColumn Object (Excel) object (Excel) representing the primary key column in the table on the one side of the one-to-many relationship.

Return value

MODELRELATIONSHIP

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelRelationships.Item Method (Excel)

 Copy code hover
[image]

ModelRelationships.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelRelationships Object (Excel) object.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelRelationships Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

A ModelRelationship Object (Excel) object contained in the collection.

See also

Other resources

ModelRelationships Object Members
ModelRelationships Object


ModelTable Object (Excel)

 Copy code hover
[image]

ModelTable Object (Excel)
See also Send feedback

Represent a table in the Data Model.

Version information

Version Added: Excel 2013

Remarks

The ModelTable object will be read only (cannot be created or edited programmatically). There will be a ModelTable object for every table in the model.

See also

Other resources

ModelTable Object Members


ModelTable Members (Excel)

 Copy code hover
[image]

ModelTable Members (Excel)
Send feedback

Published: July 16, 2012

Represent a table in the Data Model.

Methods

Name | Description
Refresh | Refreshes the model table source connections.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ModelTableColumns | Collection of ModelTableColumns Object (Excel) that make up the ModelTable. Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns an Object that represents the parent object of the specified ModelTable Object (Excel) object. Read-only.
RecordCount | Returns the total row count for the model table. Integer Read-only
SourceName | Name of the data source for the table. If the table has no data source, the call will generate a run-time error. String Read-only
SourceWorkbookConnection | Returns the Workbook Connection from which the model table originated. Read-only


ModelTable Properties (Excel)

 Copy code hover
[image]

ModelTable Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ModelTableColumns | Collection of ModelTableColumns Object (Excel) that make up the ModelTable. Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns an Object that represents the parent object of the specified ModelTable Object (Excel) object. Read-only.
RecordCount | Returns the total row count for the model table. Integer Read-only
SourceName | Name of the data source for the table. If the table has no data source, the call will generate a run-time error. String Read-only
SourceWorkbookConnection | Returns the Workbook Connection from which the model table originated. Read-only


ModelTable.Application Property (Excel)

 Copy code hover
[image]

ModelTable.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTable Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.Creator Property (Excel)

 Copy code hover
[image]

ModelTable.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTable Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.ModelTableColumns Property (Excel)

 Copy code hover
[image]

ModelTable.ModelTableColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Collection of ModelTableColumns Object (Excel) that make up the ModelTable. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ModelTableColumns

expression A variable that represents a ModelTable Object (Excel) object.

Property value

MODELTABLECOLUMNS

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.Name Property (Excel)

 Copy code hover
[image]

ModelTable.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Version information

Version Added: Excel 2013

Syntax

expression .Name

expression A variable that represents a ModelTable Object (Excel) object.

Property value

STRING

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.Parent Property (Excel)

 Copy code hover
[image]

ModelTable.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTable Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTable Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.RecordCount Property (Excel)

 Copy code hover
[image]

ModelTable.RecordCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the total row count for the model table. Integer Read-only

Version information

Version Added: Excel 2013

Syntax

expression .RecordCount

expression A variable that represents a ModelTable Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.SourceName Property (Excel)

 Copy code hover
[image]

ModelTable.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Name of the data source for the table. If the table has no data source, the call will generate a run-time error. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .SourceName

expression A variable that represents a ModelTable Object (Excel) object.

Property value

STRING

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable.SourceWorkbookConnection Property (Excel)

 Copy code hover
[image]

ModelTable.SourceWorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Workbook Connection from which the model table originated. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .SourceWorkbookConnection

expression A variable that represents a ModelTable Object (Excel) object.

Property value

WORKBOOKCONNECTION

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTable Methods (Excel)

 Copy code hover
[image]

ModelTable Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Refresh | Refreshes the model table source connections.


ModelTable.Refresh Method (Excel)

 Copy code hover
[image]

ModelTable.Refresh Method (Excel)
See also Send feedback

Refreshes the model table source connections.

Version information

Version Added: Excel 2013

Syntax

expression .Refresh

expression A variable that represents a ModelTable Object (Excel) object.

Return value

VOID

See also

Other resources

ModelTable Object Members
ModelTable Object


ModelTableColumn Object (Excel)

 Copy code hover
[image]

ModelTableColumn Object (Excel)
See also Send feedback

Published: July 16, 2012

Represent a single column inside a ModelTable Object (Excel) object.

Version information

Version Added: Excel 2013

Remarks

The ModelTableColumn object will be read only. The purpose of this object is for use in creating relationships programmatically.

See also

Other resources

ModelTableColumn Object Members


ModelTableColumn Members (Excel)

 Copy code hover
[image]

ModelTableColumn Members (Excel)
Send feedback

Represent a single column inside a ModelTable Object (Excel) object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataType | Returns the XlParameterDataType Enumeration (Excel) of the ModelTableColumn. Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns an Object that represents the parent object of the specified ModelTableColumn Object (Excel) object. Read-only.


ModelTableColumn Properties (Excel)

 Copy code hover
[image]

ModelTableColumn Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataType | Returns the XlParameterDataType Enumeration (Excel) of the ModelTableColumn. Read-only
Name | Returns a String value that represents the name of the object.
Parent | Returns an Object that represents the parent object of the specified ModelTableColumn Object (Excel) object. Read-only.


ModelTableColumn.Application Property (Excel)

 Copy code hover
[image]

ModelTableColumn.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTableColumn Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTableColumn Object Members
ModelTableColumn Object


ModelTableColumn.Creator Property (Excel)

 Copy code hover
[image]

ModelTableColumn.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTableColumn Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTableColumn Object Members
ModelTableColumn Object


ModelTableColumn.DataType Property (Excel)

 Copy code hover
[image]

ModelTableColumn.DataType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the XlParameterDataType Enumeration (Excel) of the ModelTableColumn. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .DataType

expression A variable that represents a ModelTableColumn Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTableColumn Object Members
ModelTableColumn Object


ModelTableColumn.Name Property (Excel)

 Copy code hover
[image]

ModelTableColumn.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Version information

Version Added: Excel 2013

Syntax

expression .Name

expression A variable that represents a ModelTableColumn Object (Excel) object.

Property value

STRING

See also

Other resources

ModelTableColumn Object Members
ModelTableColumn Object


ModelTableColumn.Parent Property (Excel)

 Copy code hover
[image]

ModelTableColumn.Parent Property (Excel)
See also Send feedback

Returns an Object that represents the parent object of the specified ModelTableColumn Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTableColumn Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTableColumn Object Members
ModelTableColumn Object


ModelTableColumns Object (Excel)

 Copy code hover
[image]

ModelTableColumns Object (Excel)
See also Send feedback

Published: July 16, 2012

Represent a ModelTableColumn Object (Excel) collection of single columns inside a ModelTable Object (Excel) object.

Version information

Version Added: Excel 2013

See also

Other resources

ModelTableColumns Object Members


ModelTableColumns Members (Excel)

 Copy code hover
[image]

ModelTableColumns Members (Excel)
Send feedback

Represent a ModelTableColumn Object (Excel) collection of single columns inside a ModelTable Object (Excel) object.

Methods

Name | Description
Item | Returns a ModelTableColumn Object (Excel) object (Excel) from the ModelTableColumns collection (Excel)

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelTableColumn Object (Excel) objects in a ModelTableColumns Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableColumns Object (Excel) object. Read-only.


ModelTableColumns Properties (Excel)

 Copy code hover
[image]

ModelTableColumns Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelTableColumn Object (Excel) objects in a ModelTableColumns Object (Excel) object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableColumns Object (Excel) object. Read-only.


ModelTableColumns.Application Property (Excel)

 Copy code hover
[image]

ModelTableColumns.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTableColumns Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTableColumns Object Members
ModelTableColumns Object


ModelTableColumns.Count Property (Excel)

 Copy code hover
[image]

ModelTableColumns.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of a ModelTableColumn Object (Excel) objects in a ModelTableColumns Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelTableColumns Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTableColumns Object Members
ModelTableColumns Object


ModelTableColumns.Creator Property (Excel)

 Copy code hover
[image]

ModelTableColumns.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTableColumns Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTableColumns Object Members
ModelTableColumns Object


ModelTableColumns.Parent Property (Excel)

 Copy code hover
[image]

ModelTableColumns.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTableColumns Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTableColumns Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTableColumns Object Members
ModelTableColumns Object


ModelTableColumns Methods (Excel)

 Copy code hover
[image]

ModelTableColumns Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a ModelTableColumn Object (Excel) object (Excel) from the ModelTableColumns collection (Excel)


ModelTableColumns.Item Method (Excel)

 Copy code hover
[image]

ModelTableColumns.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTableColumn Object (Excel) object (Excel) from the ModelTableColumns collection (Excel)

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelTableColumns Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

MODELTABLECOLUMN

See also

Other resources

ModelTableColumns Object Members
ModelTableColumns Object


ModelTableNameChange Object (Excel)

 Copy code hover
[image]

ModelTableNameChange Object (Excel)
See also Send feedback

Published: July 16, 2012

An object representing the old and new name of a table which was renamed in the Excel data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelTableNameChange Object Members


ModelTableNameChange Members (Excel)

 Copy code hover
[image]

ModelTableNameChange Members (Excel)
Send feedback

Published: July 16, 2012

An object representing the old and new name of a table which was renamed in the Excel data model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNameChange Object (Excel) object. Read-only.
TableNameNew | Returns the new name of the table. String Read-only
TableNameOld | Returns the previous name of the table. String Read-only


ModelTableNameChange Properties (Excel)

 Copy code hover
[image]

ModelTableNameChange Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNameChange Object (Excel) object. Read-only.
TableNameNew | Returns the new name of the table. String Read-only
TableNameOld | Returns the previous name of the table. String Read-only


ModelTableNameChange.Application Property (Excel)

 Copy code hover
[image]

ModelTableNameChange.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTableNameChange Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTableNameChange Object Members
ModelTableNameChange Object


ModelTableNameChange.Creator Property (Excel)

 Copy code hover
[image]

ModelTableNameChange.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTableNameChange Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTableNameChange Object Members
ModelTableNameChange Object


ModelTableNameChange.Parent Property (Excel)

 Copy code hover
[image]

ModelTableNameChange.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTableNameChange Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTableNameChange Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTableNameChange Object Members
ModelTableNameChange Object


ModelTableNameChange.TableNameNew Property (Excel)

 Copy code hover
[image]

ModelTableNameChange.TableNameNew Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the new name of the table. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TableNameNew

expression A variable that represents a ModelTableNameChange object.

Property value

STRING

See also

Other resources

ModelTableNameChange Object Members
ModelTableNameChange Object


ModelTableNameChange.TableNameOld Property (Excel)

 Copy code hover
[image]

ModelTableNameChange.TableNameOld Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the previous name of the table. String Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TableNameOld

expression A variable that represents a ModelTableNameChange object.

Property value

STRING

See also

Other resources

ModelTableNameChange Object Members
ModelTableNameChange Object


ModelTableNameChanges Object (Excel)

 Copy code hover
[image]

ModelTableNameChanges Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ModelTableNameChange Object (Excel) objects representing table names before and after a table name change in the Excel data model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelTableNameChanges Object Members


ModelTableNameChanges Members (Excel)

 Copy code hover
[image]

ModelTableNameChanges Members (Excel)
Send feedback

Published: July 16, 2012

A collection of ModelTableNameChange Object (Excel) objects representing table names before and after a table name change in the Excel data model.

Methods

Name | Description
Item | Returns a single object from the ModelTableNameChanges collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelTableNameChange Object (Excel) objects in a ModelTableNameChanges Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNameChanges Object (Excel) object. Read-only.


ModelTableNameChanges Properties (Excel)

 Copy code hover
[image]

ModelTableNameChanges Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of a ModelTableNameChange Object (Excel) objects in a ModelTableNameChanges Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNameChanges Object (Excel) object. Read-only.


ModelTableNameChanges.Application Property (Excel)

 Copy code hover
[image]

ModelTableNameChanges.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTableNameChanges Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTableNameChanges Object Members
ModelTableNameChanges Object


ModelTableNameChanges.Count Property (Excel)

 Copy code hover
[image]

ModelTableNameChanges.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of a ModelTableNameChange Object (Excel) objects in a ModelTableNameChanges Object (Excel) collection. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelTableNameChanges Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTableNameChanges Object Members
ModelTableNameChanges Object


ModelTableNameChanges.Creator Property (Excel)

 Copy code hover
[image]

ModelTableNameChanges.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTableNameChanges Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTableNameChanges Object Members
ModelTableNameChanges Object


ModelTableNameChanges.Parent Property (Excel)

 Copy code hover
[image]

ModelTableNameChanges.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTableNameChanges Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTableNameChanges Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTableNameChanges Object Members
ModelTableNameChanges Object


ModelTableNameChanges Methods (Excel)

 Copy code hover
[image]

ModelTableNameChanges Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelTableNameChanges collection.


ModelTableNameChanges.Item Method (Excel)

 Copy code hover
[image]

ModelTableNameChanges.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelTableNameChanges collection.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelTableNameChanges Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number for the object.

Return value

MODELTABLENAMECHANGE

See also

Other resources

ModelTableNameChanges Object Members
ModelTableNameChanges Object


ModelTableNames Object (Excel)

 Copy code hover
[image]

ModelTableNames Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of table names representing tables in the Excel data model.

Version information

Version Added: Excel 2013

Remarks

The ModelTableNames collection is used to represent a set of tables in the Excel data model for which changes have been made during a model operation like for example data refresh. The table names are represented as strings in the collection.

See also

Other resources

ModelTableNames Object Members


ModelTableNames Members (Excel)

 Copy code hover
[image]

ModelTableNames Members (Excel)
Send feedback

Published: July 16, 2012

A collection of table names representing tables in the Excel data model.

Methods

Name | Description
Item | Returns a single object from the ModelTableNames collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of objects in a ModelTableNames Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNames Object (Excel) object. Read-only.


ModelTableNames Properties (Excel)

 Copy code hover
[image]

ModelTableNames Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of objects in a ModelTableNames Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTableNames Object (Excel) object. Read-only.


ModelTableNames.Application Property (Excel)

 Copy code hover
[image]

ModelTableNames.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTableNames Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTableNames Object Members
ModelTableNames Object


ModelTableNames.Count Property (Excel)

 Copy code hover
[image]

ModelTableNames.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in a ModelTableNames Object (Excel) collection. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelTableNames Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTableNames Object Members
ModelTableNames Object


ModelTableNames.Creator Property (Excel)

 Copy code hover
[image]

ModelTableNames.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTableNames Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTableNames Object Members
ModelTableNames Object


ModelTableNames.Parent Property (Excel)

 Copy code hover
[image]

ModelTableNames.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTableNames Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTableNames Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTableNames Object Members
ModelTableNames Object


ModelTableNames Methods (Excel)

 Copy code hover
[image]

ModelTableNames Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelTableNames collection.


ModelTableNames.Item Method (Excel)

 Copy code hover
[image]

ModelTableNames.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelTableNames collection.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelTableNames Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number or name of the object.

Return value

STRING

See also

Other resources

ModelTableNames Object Members
ModelTableNames Object


ModelTables Object (Excel)

 Copy code hover
[image]

ModelTables Object (Excel)
See also Send feedback

Published: July 16, 2012

Collection of model tables inside the Data Model.

Version information

Version Added: Excel 2013

See also

Other resources

ModelTables Object Members


ModelTables Members (Excel)

 Copy code hover
[image]

ModelTables Members (Excel)
Send feedback

Published: July 16, 2012

Collection of model tables inside the Data Model.

Methods

Name | Description
Item | Returns a single object from the ModelTables collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of ModelTable Object (Excel) objects in a ModelTables Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTables Object (Excel) object. Read-only.


ModelTables Properties (Excel)

 Copy code hover
[image]

ModelTables Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Count | Returns a Long value that represents the number of ModelTable Object (Excel) objects in a ModelTables Object (Excel) collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ModelTables Object (Excel) object. Read-only.


ModelTables.Application Property (Excel)

 Copy code hover
[image]

ModelTables.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a ModelTables Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

ModelTables Object Members
ModelTables Object


ModelTables.Count Property (Excel)

 Copy code hover
[image]

ModelTables.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of ModelTable Object (Excel) objects in a ModelTables Object (Excel) collection. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Count

expression A variable that represents a ModelTables Object (Excel) object.

Property value

INT32

See also

Other resources

ModelTables Object Members
ModelTables Object


ModelTables.Creator Property (Excel)

 Copy code hover
[image]

ModelTables.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a ModelTables Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

ModelTables Object Members
ModelTables Object


ModelTables.Parent Property (Excel)

 Copy code hover
[image]

ModelTables.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ModelTables Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a ModelTables Object (Excel) object.

Property value

OBJECT

See also

Other resources

ModelTables Object Members
ModelTables Object


ModelTables Methods (Excel)

 Copy code hover
[image]

ModelTables Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from the ModelTables collection.


ModelTables.Item Method (Excel)

 Copy code hover
[image]

ModelTables.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from the ModelTables collection.

Version information

Version Added: Excel 2013

Syntax

expression .Item(Index)

expression A variable that represents a ModelTables Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number or name of the object.

Return value

MODELTABLE

See also

Other resources

ModelTables Object Members
ModelTables Object


ModuleView Object (Excel)

 Copy code hover
[image]

ModuleView Object (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

Excel Object Model Reference

Other resources

ModuleView Object Members


ModuleView Members (Excel)

 Copy code hover
[image]

ModuleView Members (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Properties

Name | Description
Application | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Creator | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Parent | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Sheet | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


ModuleView Properties (Excel)

 Copy code hover
[image]

ModuleView Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Creator | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Parent | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Sheet | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


ModuleView.Application Property (Excel)

 Copy code hover
[image]

ModuleView.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

ModuleView Object

Other resources

ModuleView Object Members


ModuleView.Creator Property (Excel)

 Copy code hover
[image]

ModuleView.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

ModuleView Object

Other resources

ModuleView Object Members


ModuleView.Parent Property (Excel)

 Copy code hover
[image]

ModuleView.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

ModuleView Object

Other resources

ModuleView Object Members


ModuleView.Sheet Property (Excel)

 Copy code hover
[image]

ModuleView.Sheet Property (Excel)
See also Send feedback

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

ModuleView Object

Other resources

ModuleView Object Members


MultiThreadedCalculation Object (Excel)

 Copy code hover
[image]

MultiThreadedCalculation Object (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the concurrent calculation mode.

Version Information

Version Added: Excel 2007

Syntax

expression .MultiThreadedCalculation

See also

Concepts

Excel Object Model Reference

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation Members (Excel)

 Copy code hover
[image]

MultiThreadedCalculation Members (Excel)
Send feedback

Published: July 16, 2012

Returns or sets the concurrent calculation mode.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | The Enabled property allows MultiThreadedCalculation objects to be enabled or disabled at run time. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
ThreadCount | Gets the total count of the process threads that are a part of the specified MultiThreadedCalculation object.
ThreadMode | Returns or sets the thread mode for the specified MultiThreadedCalculation object. Read/write XlThreadMode.


MultiThreadedCalculation Properties (Excel)

 Copy code hover
[image]

MultiThreadedCalculation Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | The Enabled property allows MultiThreadedCalculation objects to be enabled or disabled at run time. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
ThreadCount | Gets the total count of the process threads that are a part of the specified MultiThreadedCalculation object.
ThreadMode | Returns or sets the thread mode for the specified MultiThreadedCalculation object. Read/write XlThreadMode.


MultiThreadedCalculation.Application Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a MultiThreadedCalculation object.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation.Creator Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a MultiThreadedCalculation object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation.Enabled Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.Enabled Property (Excel)
See also Send feedback

Published: July 16, 2012

The Enabled property allows MultiThreadedCalculation objects to be enabled or disabled at run time. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Enabled

expression A variable that represents a MultiThreadedCalculation object.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation.Parent Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a MultiThreadedCalculation object.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation.ThreadCount Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.ThreadCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets the total count of the process threads that are a part of the specified MultiThreadedCalculation object.

Version Information

Version Added: Excel 2007

Syntax

expression .ThreadCount

expression A variable that represents a MultiThreadedCalculation object.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


MultiThreadedCalculation.ThreadMode Property (Excel)

 Copy code hover
[image]

MultiThreadedCalculation.ThreadMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the thread mode for the specified MultiThreadedCalculation object. Read/write XlThreadMode.

Version Information

Version Added: Excel 2007

Syntax

expression .ThreadMode

expression A variable that represents a MultiThreadedCalculation object.

Remarks

You can set the thread mode to either XlThreadModeAutomatic or XlThreadModeManual.

See also

Concepts

MultiThreadedCalculation Object

Other resources

MultiThreadedCalculation Object Members


Name Object (Excel)

 Copy code hover
[image]

Name Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a defined name for a range of cells. Names can be either built-in names — such as Database, Print_Area, and Auto_Open — or custom names.

Remarks

Application, Workbook, and Worksheet Objects

The Name object is a member of the Names collection for the Application, Workbook, and Worksheet objects. Use Names(index), where index is the name index number or defined name, to return a single Name object.

The index number indicates the position of the name within the collection. Names are placed in alphabetic order, from a to z, and are not case-sensitive.

Range Objects

Although a Range object can have more than one name, there's no Names collection for the Range object. Use Name with a Range object to return the first name from the list of names (sorted alphabetically) assigned to the range. The following example sets the Visible property for the first name assigned to cells A1:B1 on worksheet one.

Example

The following example displays the cell reference for the first name in the application collection.

VBA Copy code Copy code
MsgBox Names(1).RefersTo

The following example deletes the name "mySortRange" from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Names("mySortRange").Delete

Use the Name property to return or set the text of the name itself. The following example changes the name of the first Name object in the active workbook.

VBA Copy code Copy code
Names(1).Name = "stock_values"

The following example sets the Visible property for the first name assigned to cells A1:B1 on worksheet one.

VBA Copy code Copy code
Worksheets(1).Range("a1:b1").Name.Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

Name Object Members


Name Members (Excel)

 Copy code hover
[image]

Name Members (Excel)
Send feedback

Published: July 16, 2012

Represents a defined name for a range of cells. Names can be either built-in names — such as Database, Print_Area, and Auto_Open — or custom names.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Category | Returns or sets the category for the specified name in the language of the macro. The name must refer to a custom function or command. Read/write String.
CategoryLocal | Returns or sets the category for the specified name, in the language of the user, if the name refers to a custom function or command. Read/write String.
Comment | Returns or sets the comment associated with the name. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
MacroType | Returns or sets what the name refers to. Read/write XlXLMMacroType.
Name | Returns or sets a String value representing the name of the object.
NameLocal | Returns or sets the name of the object, in the language of the user. Read/write String.
Parent | Returns the parent object for the specified object. Read-only.
RefersTo | Returns or sets the formula that the name is defined to refer to, in the language of the macro and in A1-style notation, beginning with an equal sign. Read/write String.
RefersToLocal | Returns or sets the formula that the name refers to. The formula is in the language of the user, and it's in A1-style notation, beginning with an equal sign. Read/write String.
RefersToR1C1 | Returns or sets the formula that the name refers to. The formula is in the language of the macro, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.
RefersToR1C1Local | Returns or sets the formula that the name refers to. This formula is in the language of the user, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.
RefersToRange | Returns the Range object referred to by a Name object. Read-only.
ShortcutKey | Returns or sets the shortcut key for a name defined as a custom Microsoft Excel 4.0 macro command. Read/write String.
ValidWorkbookParameter | Returns True if the specified Name object is a valid workbook parameter. Read-only Boolen.
Value | Returns or sets a String value that represents the formula that the name is defined to refer to.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
WorkbookParameter | Returns or sets the specified Name object as a workbook parameter. Read/write


Name Properties (Excel)

 Copy code hover
[image]

Name Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Category | Returns or sets the category for the specified name in the language of the macro. The name must refer to a custom function or command. Read/write String.
CategoryLocal | Returns or sets the category for the specified name, in the language of the user, if the name refers to a custom function or command. Read/write String.
Comment | Returns or sets the comment associated with the name. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
MacroType | Returns or sets what the name refers to. Read/write XlXLMMacroType.
Name | Returns or sets a String value representing the name of the object.
NameLocal | Returns or sets the name of the object, in the language of the user. Read/write String.
Parent | Returns the parent object for the specified object. Read-only.
RefersTo | Returns or sets the formula that the name is defined to refer to, in the language of the macro and in A1-style notation, beginning with an equal sign. Read/write String.
RefersToLocal | Returns or sets the formula that the name refers to. The formula is in the language of the user, and it's in A1-style notation, beginning with an equal sign. Read/write String.
RefersToR1C1 | Returns or sets the formula that the name refers to. The formula is in the language of the macro, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.
RefersToR1C1Local | Returns or sets the formula that the name refers to. This formula is in the language of the user, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.
RefersToRange | Returns the Range object referred to by a Name object. Read-only.
ShortcutKey | Returns or sets the shortcut key for a name defined as a custom Microsoft Excel 4.0 macro command. Read/write String.
ValidWorkbookParameter | Returns True if the specified Name object is a valid workbook parameter. Read-only Boolen.
Value | Returns or sets a String value that represents the formula that the name is defined to refer to.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
WorkbookParameter | Returns or sets the specified Name object as a workbook parameter. Read/write


Name.Application Property (Excel)

 Copy code hover
[image]

Name.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Name object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Category Property (Excel)

 Copy code hover
[image]

Name.Category Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the category for the specified name in the language of the macro. The name must refer to a custom function or command. Read/write String.

Syntax

expression .Category

expression A variable that represents a Name object.

Example

This example assumes that you created a custom function or command on a Microsoft Excel 4.0 macro sheet. The example displays the function category in the language of the macro. It assumes that the name of the custom function or command is the only name in the workbook.

VBA Copy code Copy code
With ActiveWorkbook.Names(1)
 If .MacroType <> xlNone Then
 MsgBox "The category for this name is " & .Category
 Else
 MsgBox "This name does not refer to" & _
 " a custom function or command."
 End If
End With

See also

Concepts

Name Object

Other resources

Name Object Members


Name.CategoryLocal Property (Excel)

 Copy code hover
[image]

Name.CategoryLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the category for the specified name, in the language of the user, if the name refers to a custom function or command. Read/write String.

Syntax

expression .CategoryLocal

expression A variable that represents a Name object.

Example

This example displays, in the language of the user, the function category of either a custom function or a command created on a Microsoft Excel 4.0 macro sheet. The example assumes that the custom function name or command name is the only name in the workbook.

VBA Copy code Copy code
With ActiveWorkbook.Names(1)
 If .MacroType <> xlNone Then
 MsgBox "The category for this name is " & .CategoryLocal
 Else
 MsgBox "This name does not refer to" & _
 " a custom function or command."
 End If
End With

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Comment Property (Excel)

 Copy code hover
[image]

Name.Comment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the comment associated with the name. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .Comment

expression A variable that represents a Name object.

Remarks

The comment text cannot exceed 255 characters.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Creator Property (Excel)

 Copy code hover
[image]

Name.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Name object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Index Property (Excel)

 Copy code hover
[image]

Name.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.MacroType Property (Excel)

 Copy code hover
[image]

Name.MacroType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets what the name refers to. Read/write XlXLMMacroType.

Syntax

expression .MacroType

expression A variable that represents a Name object.

Remarks

XlXLMMacroType can be one of these XlXLMMacroType constants.

xlCommand. The name refers to a user-defined macro.

xlFunction. The name refers to a user-defined function.

xlNotXLM. The name doesn't refer to a function or macro.

Example

This example assumes that you created a custom function or command on a Microsoft Excel version 4.0 macro sheet. The example displays the function category, in the language of the macro. It assumes that the name of the custom function or command is the only name in the workbook.

VBA Copy code Copy code
With ActiveWorkbook.Names(1)
 If .MacroType <> xlNotXLM Then
 MsgBox "The category for this name is " & .Category
 Else
 MsgBox "This name does not refer to" & _
 " a custom function or command."
 End If
End With

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Name Property (Excel)

 Copy code hover
[image]

Name.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.NameLocal Property (Excel)

 Copy code hover
[image]

Name.NameLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the object, in the language of the user. Read/write String.

Syntax

expression .NameLocal

expression A variable that represents a Name object.

Remarks

If the style is a built-in style, this property returns the name of the style in the language of the current locale.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Parent Property (Excel)

 Copy code hover
[image]

Name.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.RefersTo Property (Excel)

 Copy code hover
[image]

Name.RefersTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula that the name is defined to refer to, in the language of the macro and in A1-style notation, beginning with an equal sign. Read/write String.

Syntax

expression .RefersTo

expression A variable that represents a Name object.

Example

This example creates a list of all the names in the active workbook, and it shows their formulas in A1-style notation in the language of the macro. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
i = 1
For Each nm In ActiveWorkbook.Names
 newSheet.Cells(i, 1).Value = nm.Name
 newSheet.Cells(i, 2).Value = "'" & nm.RefersTo
 i = i + 1
Next
newSheet.Columns("A:B").AutoFit

See also

Concepts

Name Object

Other resources

Name Object Members


Name.RefersToLocal Property (Excel)

 Copy code hover
[image]

Name.RefersToLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula that the name refers to. The formula is in the language of the user, and it's in A1-style notation, beginning with an equal sign. Read/write String.

Syntax

expression .RefersToLocal

expression A variable that represents a Name object.

Example

This example creates a new worksheet and then inserts a list of all the names in the active workbook, including their formulas (in A1-style notation and in the language of the user).

VBA Copy code Copy code
Set newSheet = ActiveWorkbook.Worksheets.Add
i = 1
For Each nm In ActiveWorkbook.Names
 newSheet.Cells(i, 1).Value = nm.NameLocal
 newSheet.Cells(i, 2).Value = "'" & nm.RefersToLocal
 i = i + 1
Next

See also

Concepts

Name Object

Other resources

Name Object Members


Name.RefersToR1C1 Property (Excel)

 Copy code hover
[image]

Name.RefersToR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula that the name refers to. The formula is in the language of the macro, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.

Syntax

expression .RefersToR1C1

expression A variable that represents a Name object.

Example

This example creates a new worksheet and then inserts a list of all the names in the active workbook, including their formulas (in R1C1-style notation and in the language of the macro).

VBA Copy code Copy code
Set newSheet = ActiveWorkbook.Worksheets.Add
i = 1
For Each nm In ActiveWorkbook.Names
 newSheet.Cells(i, 1).Value = nm.Name
 newSheet.Cells(i, 2).Value = "'" & nm.RefersToR1C1
 i = i + 1
Next

See also

Concepts

Name Object

Other resources

Name Object Members


Name.RefersToR1C1Local Property (Excel)

 Copy code hover
[image]

Name.RefersToR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula that the name refers to. This formula is in the language of the user, and it's in R1C1-style notation, beginning with an equal sign. Read/write String.

Syntax

expression .RefersToR1C1Local

expression A variable that represents a Name object.

Example

This example creates a new worksheet and then inserts a list of all the names in the active workbook, including their formulas (in R1C1-style notation and in the language of the user).

VBA Copy code Copy code
Set newSheet = ActiveWorkbook.Worksheets.Add
i = 1
For Each nm In ActiveWorkbook.Names
 newSheet.Cells(i, 1).Value = nm.NameLocal
 newSheet.Cells(i, 2).Value = "'" & nm.RefersToR1C1Local
 i = i + 1
Next

See also

Concepts

Name Object

Other resources

Name Object Members


Name.RefersToRange Property (Excel)

 Copy code hover
[image]

Name.RefersToRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Range object referred to by a Name object. Read-only.

Syntax

expression .RefersToRange

expression A variable that represents a Name object.

Remarks

If the Name object doesn't refer to a range (for example, if it refers to a constant or a formula), this property fails.

To change the range that a name refers to, use the RefersTo property.

Example

This example displays the number of rows and columns in the print area on the active worksheet.

Note Note

Ensure that you establish a print area on the active sheet of the current workbook.

VBA Copy code Copy code
p = Sheets(ActiveSheet.Name).Names("Print_Area").RefersToRange.Value
MsgBox "Print_Area: " & UBound(p, 1) & " rows, " & _
 UBound(p, 2) & " columns"

See also

Concepts

Name Object

Other resources

Name Object Members


Name.ShortcutKey Property (Excel)

 Copy code hover
[image]

Name.ShortcutKey Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shortcut key for a name defined as a custom Microsoft Excel 4.0 macro command. Read/write String.

Syntax

expression .ShortcutKey

expression A variable that represents a Name object.

Example

This example sets the shortcut key for name one in the active workbook. The example should be run on a workbook in which name one refers to a Microsoft Excel 4.0 command macro.

VBA Copy code Copy code
ActiveWorkbook.Names(1).ShortcutKey = "K"

See also

Concepts

Name Object

Other resources

Name Object Members


Name.ValidWorkbookParameter Property (Excel)

 Copy code hover
[image]

Name.ValidWorkbookParameter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the specified Name object is a valid workbook parameter. Read-only Boolen.

Version Information

Version Added: Excel 2007

Syntax

expression .ValidWorkbookParameter

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Value Property (Excel)

 Copy code hover
[image]

Name.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the formula that the name is defined to refer to.

Syntax

expression .Value

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.Visible Property (Excel)

 Copy code hover
[image]

Name.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Name object.

Remarks

If you set the Visible property for a name to False, the name won't appear in the Define Name dialog box.

See also

Concepts

Name Object

Other resources

Name Object Members


Name.WorkbookParameter Property (Excel)

 Copy code hover
[image]

Name.WorkbookParameter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the specified Name object as a workbook parameter. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .WorkbookParameter

expression An expression that returns a Name object.

Return Value

Boolean

See also

Concepts

Name Object

Other resources

Name Object Members


Name Methods (Excel)

 Copy code hover
[image]

Name Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


Name.Delete Method (Excel)

 Copy code hover
[image]

Name.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Name object.

See also

Concepts

Name Object

Other resources

Name Object Members


Names Object (Excel)

 Copy code hover
[image]

Names Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Name objects in the application or workbook.

Remarks

Each Name object represents a defined name for a range of cells. Names can be either built-in names—such as Database, Print_Area, and Auto_Open—or custom names.

The RefersTo argument must be specified in A1-style notation, including dollar signs ($) where appropriate. For example, if cell A10 is selected on Sheet1 and you define a name by using the RefersTo argument "=sheet1!A1:B1", the new name actually refers to cells A10:B10 (because you specified a relative reference). To specify an absolute reference, use "=sheet1!$A$1:$B$1".

Example

Use the Names property to return the Names collection. The following example creates a list of all the names in the active workbook, plus the addresses they refer to.

VBA Copy code Copy code
Set nms = ActiveWorkbook.Names
Set wks = Worksheets(1)
For r = 1 To nms.Count
    wks.Cells(r, 2).Value = nms(r).Name
    wks.Cells(r, 3).Value = nms(r).RefersToRange.Address
Next

Use the Add method to create a name and add it to the collection.The following example creates a new name that refers to cells A1:C20 on the worksheet named "Sheet1."

VBA Copy code Copy code
Names.Add Name:="test", RefersTo:="=sheet1!$a$1:$c$20"

Use Names(index), where index is the name index number or defined name, to return a single Name object. The following example deletes the name "mySortRange" from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Names("mySortRange").Delete

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example uses a named range as the formula for data validation. This example requires the validation data to be on Sheet 2 in the range A2:A100. This validation data is used to validate data entered on Sheet 1 in the range D2:D10.

VBA Copy code Copy code
Sub Add_Data_Validation_From_Other_Worksheet()
'The current Excel workbook and worksheet, a range to define the data to be validated, and the target range
'to place the data in.
Dim wbBook As Workbook
Dim wsTarget As Worksheet
Dim wsSource As Worksheet
Dim rnTarget As Range
Dim rnSource As Range

'Initialize the Excel objects and delete any artifacts from the last time the macro was run.
Set wbBook = ThisWorkbook
With wbBook
    Set wsSource = .Worksheets("Sheet2")
    Set wsTarget = .Worksheets("Sheet1")
    On Error Resume Next
    .Names("Source").Delete
    On Error GoTo 0
End With

'On the source worksheet, create a range in column A of up to 98 cells long, and name it "Source".
With wsSource
    .Range(.Range("A2"), .Range("A100").End(xlUp)).Name = "Source"
End With

'On the target worksheet, create a range 8 cells long in column D.
Set rnTarget = wsTarget.Range("D2:D10")

'Clear out any artifacts from previous macro runs, then set up the target range with the validation data.
With rnTarget
    .ClearContents
    With .Validation
        .Delete
        .Add Type:=xlValidateList, _
             AlertStyle:=xlValidAlertStop, _
             Formula1:="=Source"

'Set up the Error dialog with the appropriate title and message
        .ErrorTitle = "Value Error"
        .ErrorMessage = "You can only choose from the list."
    End With
End With

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."

See also

Concepts

Excel Object Model Reference

Other resources

Names Object Members


Names Members (Excel)

 Copy code hover
[image]

Names Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Name objects in the application or workbook.

Methods

Name | Description
Add | Defines a new name for a range of cells.
Item | Returns a single Name object from a Names collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Names Properties (Excel)

 Copy code hover
[image]

Names Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Names.Application Property (Excel)

 Copy code hover
[image]

Names.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Names object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Names Object

Other resources

Names Object Members


Names.Count Property (Excel)

 Copy code hover
[image]

Names.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Names object.

See also

Concepts

Names Object

Other resources

Names Object Members


Names.Creator Property (Excel)

 Copy code hover
[image]

Names.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Names object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Names Object

Other resources

Names Object Members


Names.Parent Property (Excel)

 Copy code hover
[image]

Names.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Names object.

See also

Concepts

Names Object

Other resources

Names Object Members


Names Methods (Excel)

 Copy code hover
[image]

Names Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Defines a new name for a range of cells.
Item | Returns a single Name object from a Names collection.


Names.Add Method (Excel)

 Copy code hover
[image]

Names.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Defines a new name for a range of cells.

Syntax

expression .Add(Name, RefersTo, Visible, MacroType, ShortcutKey, Category, NameLocal, RefersToLocal, CategoryLocal, RefersToR1C1, RefersToR1C1Local)

expression A variable that represents a Names object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Optional

Variant

Specifies the text, in English, to use as the name if the NameLocal parameter is not specified. Names cannot include spaces and cannot be formatted as cell references.

RefersTo

Optional

Variant

Describes what the name refers to, in English, using A1-style notation, if the RefersToLocal, RefersToR1C1, and RefersToR1C1Local parameters are not specified.

Note Note

Nothing is returned if the reference does not exist.

Visible

Optional

Variant

True specifies that the name is defined as visible. False specifies that the name is defined as hidden. A hidden name does not appear in the Define Name, Paste Name, or Goto dialog box. The default value is True.

MacroType

Optional

Variant

The macro type, determined by one of the following values:

  • 1 - User-defined function (Function procedure)

  • 2 - Macro (Sub procedure)

  • 3 or omitted - None (the name does not refer to a user-defined function or macro)

ShortcutKey

Optional

Variant

Specifies the macro shortcut key. Must be a single letter, such as "z" or "Z". Applies only for command macros.

Category

Optional

Variant

The category of the macro or function if the MacroType argument equals 1 or 2. The category is used in the Function Wizard. Existing categories can be referred to either by number, starting at 1, or by name, in English. Microsoft Office Excel 2007 creates a new category if the specified category does not exist.

NameLocal

Optional

Variant

Specifies the localized text to use as the name if the Name parameter is not specified. Names cannot include spaces and cannot be formatted as cell references.

RefersToLocal

Optional

Variant

Describes what the name refers to, in localized text using A1-style notation, if the RefersTo, RefersToR1C1, and RefersToR1C1Local parameters are not specified.

CategoryLocal

Optional

Variant

Specifies the localized text that identifies the category of a custom function if the Category parameter is not specified.

RefersToR1C1

Optional

Variant

Describes what the name refers to, in English using R1C1-style notation, if the RefersTo, RefersToLocal, and RefersToR1C1Local parameters are not specified.

RefersToR1C1Local

Optional

Variant

Describes what the name refers to, in localized text using R1C1-style notation, if the RefersTo, RefersToLocal, and RefersToR1C1 parameters are not specified.

Return Value

A Name object that represents the new name.

Example

This example defines a new name for the range A1:D3 on Sheet1 in the active workbook.

Note Note

Nothing is returned if Sheet1 does not exist.

VBA Copy code Copy code
Sub MakeRange()

    ActiveWorkbook.Names.Add _
        Name:="tempRange", _
        RefersTo:="=Sheet1!$A$1:$D$3"

End Sub

See also

Concepts

Names Object

Other resources

Names Object Members


Names.Item Method (Excel)

 Copy code hover
[image]

Names.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single Name object from a Names collection.

Syntax

expression .Item(Index, IndexLocal, RefersTo)

expression A variable that represents a Names object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the defined name to be returned.
IndexLocal | Optional | Variant | The name of the defined name, in the language of the user. No names will be translated if you use this argument.
RefersTo | Optional | Variant | What the name refers to. You use this argument to identify a name by what it refers to.

Return Value

A Name object contained by the collection.

Remarks

You must specify one, and only one, of these three arguments.

Example

This example deletes the name mySortRange from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Names.Item("mySortRange").Delete

See also

Concepts

Names Object

Other resources

Names Object Members


NegativeBarFormat Object (Excel)

 Copy code hover
[image]

NegativeBarFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the color settings of the data bars for negative values that are defined by a data bar conditional formating rule.

Version Information

Version Added: Excel 2010

Remarks

The properties of the NegativeBarFormat object can be used to specify the fill color and border of the data bars for negative values. Use the NegativeBarFormat of the Databar object that represents a data bar conditional formatting rule to access the NegativeBarFormat object associated with that rule.

See also

Concepts

Excel Object Model Reference

Other resources

NegativeBarFormat Object Members


NegativeBarFormat Members (Excel)

 Copy code hover
[image]

NegativeBarFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents the color settings of the data bars for negative values that are defined by a data bar conditional formating rule.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BorderColor | Returns a FormatColor object that you can use to specify the border color for negative data bars. Read-only
BorderColorType | Specifies whether to use the same border color as positive data bars. Read/write
Color | Returns a FormatColor object that you can use to specify the fill color for negative data bars. Read-only
ColorType | Specifies whether to use the same fill color as positive data bars. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


NegativeBarFormat Properties (Excel)

 Copy code hover
[image]

NegativeBarFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BorderColor | Returns a FormatColor object that you can use to specify the border color for negative data bars. Read-only
BorderColorType | Specifies whether to use the same border color as positive data bars. Read/write
Color | Returns a FormatColor object that you can use to specify the fill color for negative data bars. Read-only
ColorType | Specifies whether to use the same fill color as positive data bars. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


NegativeBarFormat.Application Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a NegativeBarFormat object.

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.BorderColor Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.BorderColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FormatColor object that you can use to specify the border color for negative data bars. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .BorderColor

expression A variable that represents a NegativeBarFormat object.

Return Value

FormatColor

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.BorderColorType Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.BorderColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether to use the same border color as positive data bars. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .BorderColorType

expression A variable that represents a NegativeBarFormat object.

Return Value

XlDataBarNegativeColorType

Remarks

If you set the BorderColorType property to xlDataBarColor, use the BorderColor of the NegativeBarFormat to return a FormatColor object that you can use to specify the border color.

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.Color Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.Color Property (Excel)
See also Send feedback

Returns a FormatColor object that you can use to specify the fill color for negative data bars. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Color

expression A variable that represents a NegativeBarFormat object.

Return Value

FormatColor

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.ColorType Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.ColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether to use the same fill color as positive data bars. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ColorType

expression A variable that represents a NegativeBarFormat object.

Return Value

XlDataBarNegativeColorType

Remarks

If you set the ColorType property to xlDataBarColor, use the Color property of the NegativeBarFormat object to return a FormatColor object that you can use to specify the fill color.

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.Creator Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a NegativeBarFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


NegativeBarFormat.Parent Property (Excel)

 Copy code hover
[image]

NegativeBarFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a NegativeBarFormat object.

See also

Concepts

NegativeBarFormat Object

Other resources

NegativeBarFormat Object Members


ODBCConnection Object (Excel)

 Copy code hover
[image]

ODBCConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the ODBC connection.

Version Information

Version Added: Excel 2007

Remarks

An ODBC connection can be stored in an Excel workbook. When Micrososft Excel opens the workbook, Excel creates an in-memory copy of the ODBC connection known as the ODBCConnection object.

An ODBCConnection object contains information related to the connection, such as the name of the server to connect to and the name of the objects to be opened on that server. Optionally, the ODBCConnection object may also include authentication credential information, or a command that is to be passed to the server and executed (for example, a SELECT statement to be executed by SQL Server).

See also

Concepts

Excel Object Model Reference

Other resources

ODBCConnection Object Members


ODBCConnection Members (Excel)

 Copy code hover
[image]

ODBCConnection Members (Excel)
Send feedback

Published: July 16, 2012

Represents the ODBC connection.

Methods

Name | Description
CancelRefresh | Cancels all refresh operations in progress for the specified ODBC connection.
Refresh | Refreshes an ODBC connection.
SaveAsODC | Saves the ODBC connection as a Microsoft Office Data Connection file.

Properties

Name | Description
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BackgroundQuery | True if queries for the ODBC connection are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants. Read/write XlCmdType.
Connection | Returns or sets a string that contains ODBC settings that enable Microsoft Excel to connect to an ODBC data source. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
RefreshDate | Returns the date on which the ODBC connection was last refreshed. Read-only Date.
Refreshing | True if a background ODBC query is in progress for the specified ODBC connection. Read/write Boolean.
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RobustConnect | Returns or sets how ODBC connection connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an ODBC connection string is saved in the connection string. False if the password is removed. Read/write Boolean.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.
ServerSSOApplicationID | Returns or sets a single sign-on application (SSO) identifier that is used to do a lookup in the SSO database for credentials. Read/write String.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.
SourceData | Returns the data source for the ODBC connection, as shown in the table. Read/write Variant.
SourceDataFile | Returns or sets a String indicating the source data file for an ODBC connection. Read/write.


ODBCConnection Properties (Excel)

 Copy code hover
[image]

ODBCConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BackgroundQuery | True if queries for the ODBC connection are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants. Read/write XlCmdType.
Connection | Returns or sets a string that contains ODBC settings that enable Microsoft Excel to connect to an ODBC data source. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
RefreshDate | Returns the date on which the ODBC connection was last refreshed. Read-only Date.
Refreshing | True if a background ODBC query is in progress for the specified ODBC connection. Read/write Boolean.
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RobustConnect | Returns or sets how ODBC connection connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an ODBC connection string is saved in the connection string. False if the password is removed. Read/write Boolean.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.
ServerSSOApplicationID | Returns or sets a single sign-on application (SSO) identifier that is used to do a lookup in the SSO database for credentials. Read/write String.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.
SourceData | Returns the data source for the ODBC connection, as shown in the table. Read/write Variant.
SourceDataFile | Returns or sets a String indicating the source data file for an ODBC connection. Read/write.


ODBCConnection.AlwaysUseConnectionFile Property (Excel)

 Copy code hover
[image]

ODBCConnection.AlwaysUseConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection file is always used to establish connection to the data source. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AlwaysUseConnectionFile

expression A variable that represents an ODBCConnection object.

Remarks

When this property is True, the connection file will be used to establish the connection to the data source. If the connection embedded within the workbook is different from the external connection file, the embedded connection will be ignored and the external connection file will be the only version considered.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Application Property (Excel)

 Copy code hover
[image]

ODBCConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an ODBCConnection object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.BackgroundQuery Property (Excel)

 Copy code hover
[image]

ODBCConnection.BackgroundQuery Property (Excel)
See also Send feedback

Published: July 16, 2012

True if queries for the ODBC connection are performed asynchronously (in the background). Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .BackgroundQuery

expression A variable that represents an ODBCConnection object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.CommandText Property (Excel)

 Copy code hover
[image]

ODBCConnection.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .CommandText

expression A variable that represents an ODBCConnection object.

Remarks

You should use the CommandText property instead of the SQL property, which now exists primarily for compatibility with earlier versions of Microsoft Excel. If you use both properties, the CommandText property's value takes precedence.

The CommandType property describes the value of the CommandText property.

Example

This example sets the command string for the first query table's ODBC data source. Note that the command string is an SQL statement.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 .CommandType = xlCmdSQL
 .CommandText = _
 "Select ProductID From Products Where ProductID < 10"
 .Refresh
End With

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.CommandType Property (Excel)

 Copy code hover
[image]

ODBCConnection.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType constants. Read/write XlCmdType.

Version Information

Version Added: Excel 2007

Syntax

expression .CommandType

expression A variable that represents an ODBCConnection object.

Remarks

The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL.

Example

This example sets the command string for the first query table's ODBC data source. The command string is an SQL statement.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 .CommandType = xlCmdSQL
 .CommandText = _
 "Select ProductID From Products Where ProductID < 10"
 .Refresh
End With

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Connection Property (Excel)

 Copy code hover
[image]

ODBCConnection.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains ODBC settings that enable Microsoft Excel to connect to an ODBC data source. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Connection

expression A variable that represents an ODBCConnection object.

Remarks

Setting the Connection property does not immediately initiate the connection to the data source. You must use the Refresh method to make the connection and retrieve the data.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Creator Property (Excel)

 Copy code hover
[image]

ODBCConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an ODBCConnection object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.EnableRefresh Property (Excel)

 Copy code hover
[image]

ODBCConnection.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableRefresh

expression A variable that represents an ODBCConnection object.

Remarks

The RefreshOnFileOpen property is ignored if the EnableRefresh property is set to False. For OLAP data sources, setting this property to False disables updates.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Parent Property (Excel)

 Copy code hover
[image]

ODBCConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an ODBCConnection object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.RefreshDate Property (Excel)

 Copy code hover
[image]

ODBCConnection.RefreshDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the date on which the ODBC connection was last refreshed. Read-only Date.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshDate

expression A variable that represents an ODBCConnection object.

Remarks

For OLAP data sources, this property is updated after each query.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Refreshing Property (Excel)

 Copy code hover
[image]

ODBCConnection.Refreshing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a background ODBC query is in progress for the specified ODBC connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Refreshing

expression A variable that represents an ODBCConnection object.

Remarks

Use the CancelRefresh method to cancel background queries.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.RefreshOnFileOpen Property (Excel)

 Copy code hover
[image]

ODBCConnection.RefreshOnFileOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshOnFileOpen

expression A variable that represents an ODBCConnection object.

Remarks

The connections are not automatically refreshed when you open the workbook by using the Open method in Visual Basic. Use the Refresh method to refresh the data after the workbook is open.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.RefreshPeriod Property (Excel)

 Copy code hover
[image]

ODBCConnection.RefreshPeriod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between refreshes. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshPeriod

expression A variable that represents an ODBCConnection object.

Remarks

Setting the period to 0 (zero) disables automatic timed refreshes and is equivalent to setting this property to Null. The value of the RefreshPeriod property can be an integer from 0 through 32767.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.RobustConnect Property (Excel)

 Copy code hover
[image]

ODBCConnection.RobustConnect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how ODBC connection connects to its data source. Read/write XlRobustConnect.

Version Information

Version Added: Excel 2007

Syntax

expression .RobustConnect

expression A variable that represents an ODBCConnection object.

Remarks

If you use robust connectivity, when Microsoft Excel is unable to establish a connection using the workbook connection information, Excel will check if the workbook connection has a path to an external connection file. If it does, Excel will open the external connection file and try to connect using the information contained in the external connection file. If a connection can be established after using the external connection file, Excel will then update the workbook's connection object.

This provides robust connectivity in scenarios where an Information Technology Department maintains and updates connections in a central place, permitting a user's workbook to automatically fetch those updates whenever the previous version of the connection (cached within the workbook) fails.

Note Note

Robust connectivity isn't secure. If you create a connection on your computer and use it in a workbook and then send someone the workbook, that person will be able to see the path to the connection file on your computer. It is a good idea to remove the connection file information from the workbook before you send the workbook to someone else.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.SavePassword Property (Excel)

 Copy code hover
[image]

ODBCConnection.SavePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if password information in an ODBC connection string is saved in the connection string. False if the password is removed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .SavePassword

expression A variable that represents an ODBCConnection object.

Remarks

This property is used in both ODBC and OLE DB queries, and by both PivotTables and QueryTables.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.ServerCredentialsMethod Property (Excel)

 Copy code hover
[image]

ODBCConnection.ServerCredentialsMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerCredentialsMethod

expression A variable that represents an ODBCConnection object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.ServerSSOApplicationID Property (Excel)

 Copy code hover
[image]

ODBCConnection.ServerSSOApplicationID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a single sign-on application (SSO) identifier that is used to do a lookup in the SSO database for credentials. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerSSOApplicationID

expression A variable that represents an ODBCConnection object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.SourceConnectionFile Property (Excel)

 Copy code hover
[image]

ODBCConnection.SourceConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceConnectionFile

expression A variable that represents an ODBCConnection object.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.SourceData Property (Excel)

 Copy code hover
[image]

ODBCConnection.SourceData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the data source for the ODBC connection, as shown in the table. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceData

expression A variable that represents an ODBCConnection object.

Remarks

Data source | Return value
Microsoft Excel list or database | The cell reference, as text.
External data source | An array. Each row consists of an SQL connection string with the remaining elements as the query string, broken down into 255-character segments.
Multiple consolidation ranges | A two-dimensional array. Each row consists of a reference and its associated page field items.
Another PivotTable report | One of the above three kinds of information.

This property is not available for OLE DB data sources.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.SourceDataFile Property (Excel)

 Copy code hover
[image]

ODBCConnection.SourceDataFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the source data file for an ODBC connection. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceDataFile

expression A variable that represents an ODBCConnection object.

Remarks

For file-based data sources (for example, Access) the SourceDataFile property contains a fully qualified path to the source data file. It is null for server-based data sources (for example, SQL Server). The SourceDataFile property is set to null if the Connection property is changed programmatically.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection Methods (Excel)

 Copy code hover
[image]

ODBCConnection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CancelRefresh | Cancels all refresh operations in progress for the specified ODBC connection.
Refresh | Refreshes an ODBC connection.
SaveAsODC | Saves the ODBC connection as a Microsoft Office Data Connection file.


ODBCConnection.CancelRefresh Method (Excel)

 Copy code hover
[image]

ODBCConnection.CancelRefresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Cancels all refresh operations in progress for the specified ODBC connection.

Version Information

Version Added: Excel 2007

Syntax

expression .CancelRefresh

expression A variable that represents an ODBCConnection object.

Remarks

Use the Refreshing property to determine whether a refresh operation is currently in progress.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.Refresh Method (Excel)

 Copy code hover
[image]

ODBCConnection.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes an ODBC connection.

Version Information

Version Added: Excel 2007

Syntax

expression .Refresh

expression A variable that represents an ODBCConnection object.

Remarks

When making the connection to the ODBC data source, Microsoft Excel uses the connection string specified by the Connection property. If the specified connection string is missing required values, dialog boxes will be displayed to prompt the user for the required information. If the DisplayAlerts property is False, dialog boxes are not displayed and the Refresh method fails with the Insufficient Connection Information exception.

After Microsoft Excel makes a successful connection, it stores the completed connection string so that prompts will not be displayed for subsequent calls to the Refresh method during the same editing session. You can obtain the completed connection string by examining the value of the Connection property.

After the database connection is made, the SQL query is validated. If the query is not valid, the Refresh method fails with the SQL Syntax Error exception.

If the query requires parameters, the Parameters collection must be initialized with parameter binding information before the Refresh method is called. If not enough parameters have been bound, the Refresh method fails with the Parameter Error exception. If parameters are set to prompt for their values, dialog boxes are displayed to the user regardless of the setting of the DisplayAlerts property. If the user cancels a parameter dialog box, the Refresh method halts and returns False. If extra parameters are bound with the Parameters collection, these extra parameters are ignored.

The Refresh method returns True if the query is successfully completed or started; it returns False if the user cancels a connection or parameter dialog box.

To see whether the number of fetched rows exceeded the number of available rows on the worksheet, examine the FetchedRowOverflow property. This property is initialized every time the Refresh method is called.

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCConnection.SaveAsODC Method (Excel)

 Copy code hover
[image]

ODBCConnection.SaveAsODC Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the ODBC connection as a Microsoft Office Data Connection file.

Version Information

Version Added: Excel 2007

Syntax

expression .SaveAsODC(ODCFileName, Description, Keywords)

expression A variable that represents an ODBCConnection object.

Parameters

Name | Required/Optional | Data Type | Description
ODCFileName | Required | String | Location to save the file.
Description | Optional | Variant | Description that will be saved in the file.
Keywords | Optional | Variant | Space-separated keywords that can be used to search for this file.

Return Value

Nothing

Example

The following example saves the connection as an ODC file titled "ODCFile". This example assumes an ODBC connection exists on the active worksheet.

VBA Copy code Copy code
Sub UseSaveAsODC()

 Application.ActiveWorkbook.ODBCConnection.SaveAsODC ("ODCFile")

End Sub

See also

Concepts

ODBCConnection Object

Other resources

ODBCConnection Object Members


ODBCError Object (Excel)

 Copy code hover
[image]

ODBCError Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an ODBC error generated by the most recent ODBC query.

Remarks

The ODBCError object is a member of the ODBCErrors collection. If the specified ODBC query runs without error, the ODBCErrors collection is empty. The errors in the collection are indexed in the order in which they're generated by the ODBC data source.

Example

Use ODBCErrors(index), where index is the index number of the error, to return a single ODBCError object. The following example refreshes query table one and displays the first ODBC error that occurs.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Refresh
 If Application.ODBCErrors.Count > 0 Then
 Set er = Application.ODBCErrors(1)
 MsgBox "The following error occurred:" &
 er.ErrorString & " : " & er.SqlState
 Else
 MsgBox "Query complete: all records returned."
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

ODBCError Object Members


ODBCError Members (Excel)

 Copy code hover
[image]

ODBCError Members (Excel)
Send feedback

Published: July 16, 2012

Represents an ODBC error generated by the most recent ODBC query.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorString | Returns a String value that represents the ODBC error string.
Parent | Returns the parent object for the specified object. Read-only.
SqlState | Returns the SQL state error. Read-only String.


ODBCError Properties (Excel)

 Copy code hover
[image]

ODBCError Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorString | Returns a String value that represents the ODBC error string.
Parent | Returns the parent object for the specified object. Read-only.
SqlState | Returns the SQL state error. Read-only String.


ODBCError.Application Property (Excel)

 Copy code hover
[image]

ODBCError.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an ODBCError object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ODBCError Object

Other resources

ODBCError Object Members


ODBCError.Creator Property (Excel)

 Copy code hover
[image]

ODBCError.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an ODBCError object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ODBCError Object

Other resources

ODBCError Object Members


ODBCError.ErrorString Property (Excel)

 Copy code hover
[image]

ODBCError.ErrorString Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the ODBC error string.

Syntax

expression .ErrorString

expression A variable that represents an ODBCError object.

See also

Concepts

ODBCError Object

Other resources

ODBCError Object Members


ODBCError.Parent Property (Excel)

 Copy code hover
[image]

ODBCError.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an ODBCError object.

See also

Concepts

ODBCError Object

Other resources

ODBCError Object Members


ODBCError.SqlState Property (Excel)

 Copy code hover
[image]

ODBCError.SqlState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SQL state error. Read-only String.

Syntax

expression .SqlState

expression A variable that represents an ODBCError object.

Remarks

For an explanation of the specific error, see you SQL documentation.

Example

This example refreshes query table one and displays any ODBC errors that occur.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Refresh
 Set errs = Application.ODBCErrors
 If errs.Count > 0 Then
 Set r = .Destination.Cells(1)
 r.Value = "The following errors occurred:"
 c = 0
 For Each er In errs
 c = c + 1
 r.offset(c, 0).value = er.ErrorString
 r.offset(c, 1).value = er.SqlState
 Next
 Else
 MsgBox "Query complete: all records returned."
 End If
End With

See also

Concepts

ODBCError Object

Other resources

ODBCError Object Members


ODBCErrors Object (Excel)

 Copy code hover
[image]

ODBCErrors Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of ODBCError objects.

Remarks

Each ODBCError object represents an error returned by the most recent ODBC query. If the specified ODBC query runs without error, the ODBCErrors collection is empty. The errors in the collection are indexed in the order in which they're generated by the ODBC data source. You cannot add members to the collection.

Example

Use the ODBCErrors property to return the ODBCErrors collection. The following example refreshes query table one and displays any ODBC errors that occur.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Refresh
 Set errs = Application.ODBCErrors
 If errs.Count > 0 Then
 Set r = .Destination.Cells(1)
 r.Value = "The following errors occurred:"
 c = 0
 For Each er In errs
 c = c + 1
 r.offset(c, 0).value = er.ErrorString
 r.offset(c, 1).value = er.SqlState
 Next
 Else
 MsgBox "Query complete: all records returned."
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

ODBCErrors Object Members


ODBCErrors Members (Excel)

 Copy code hover
[image]

ODBCErrors Members (Excel)
Send feedback

Published: July 16, 2012

A collection of ODBCError objects.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ODBCErrors Properties (Excel)

 Copy code hover
[image]

ODBCErrors Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ODBCErrors.Application Property (Excel)

 Copy code hover
[image]

ODBCErrors.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an ODBCErrors object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ODBCErrors Object

Other resources

ODBCErrors Object Members


ODBCErrors.Count Property (Excel)

 Copy code hover
[image]

ODBCErrors.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an ODBCErrors object.

See also

Concepts

ODBCErrors Object

Other resources

ODBCErrors Object Members


ODBCErrors.Creator Property (Excel)

 Copy code hover
[image]

ODBCErrors.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an ODBCErrors object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ODBCErrors Object

Other resources

ODBCErrors Object Members


ODBCErrors.Parent Property (Excel)

 Copy code hover
[image]

ODBCErrors.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an ODBCErrors object.

See also

Concepts

ODBCErrors Object

Other resources

ODBCErrors Object Members


ODBCErrors Methods (Excel)

 Copy code hover
[image]

ODBCErrors Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


ODBCErrors.Item Method (Excel)

 Copy code hover
[image]

ODBCErrors.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an ODBCErrors object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number for the object.

Return Value

An ODBCError object contained by the collection.

Example

This example displays an ODBC error.

VBA Copy code Copy code
Set er = Application.ODBCErrors.Item(1)
MsgBox "The following error occurred:" &
 er.ErrorString & " : " & er.SqlState

See also

Concepts

ODBCErrors Object

Other resources

ODBCErrors Object Members


OLEDBConnection Object (Excel)

 Copy code hover
[image]

OLEDBConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the OLE DB connection.

Version Information

Version Added: Excel 2007

Remarks

An OLE DB connection can be stored in an Excel workbook. When Micrososft Excel opens the workbook, Excel creates an in-memory copy of the OLE DB connection known as the OLEDBConnection object.

An OLEDBConnection object contains information related to the connection, such as the name of the server to connect to and the name of the objects to be opened on that server. Optionally, the OLEDBConnection object may also include authentication credential information, or a command that is to be passed to the server and executed (for example, a SELECT statement to be executed by SQL Server).

See also

Concepts

Excel Object Model Reference

Other resources

OLEDBConnection Object Members


OLEDBConnection Members (Excel)

 Copy code hover
[image]

OLEDBConnection Members (Excel)
Send feedback

Published: July 16, 2012

Represents the OLE DB connection.

Methods

Name | Description
CancelRefresh | Cancels all refresh operations in progress for the specified OLE DB connection.
MakeConnection | Establishes a connection for the specified OLE DB connection.
Reconnect | Drops and then reconnects the specified connection.
Refresh | Refreshes an OLE DB connection.
SaveAsODC | Saves the OLE DB connection as an Microsoft Office Data Connection file.

Properties

Name | Description
ADOConnection | Returns an ADO connection object if the PivotTable cache is connected to an OLE DB data source. Read-only.
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BackgroundQuery | True if queries for the OLE DB connection are performed asynchronously (in the background). Read/write Boolean.
CalculatedMembers | Returns the CalculatedMembers collection for the specified connection. Read-only
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants. Read/write XlCmdType.
Connection | Returns or sets a string that contains OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.
IsConnected | Returns True if the MaintainConnection property is True. Returns False if it is not currently connected to its source. Read-only Boolean.
LocalConnection | Returns or sets the connection string to an offline cube file. Read/write String.
LocaleID | Returns or sets the locale identifier for the specified connection. Read/write
MaintainConnection | Returns True if the connection to the specified data source is maintained after the refresh operation and until the workbook is closed. Read/write Boolean.
MaxDrillthroughRecords | Returns or sets the maximum number of records to retrieve. Read/write Long.
OLAP | Returns True if the OLE DB connection is connected to an Online Analytical Processing (OLAP) server. Read-only Boolean.
Parent | Returns the parent object for the specified object. Read-only.
RefreshDate | Returns the date on which the OLE DB connection was last refreshed. Read-only Date.
Refreshing | True if a background OLE DB query is in progress for the specified OLE DB connection. Read/write Boolean.
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RetrieveInOfficeUILang | True if the data and errors are to be retrieved in the Office user interface display language when available. Read/write Boolean.
RobustConnect | Returns or sets how OLE DB connection connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an OLE DB connection string is saved in the connection string. False if the password is removed. Read/write Boolean.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.
ServerFillColor | True if the fill color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerFontStyle | True if the font style format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerNumberFormat | True if the number format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerSSOApplicationID | Returns or sets a single sign-on application (SSO) identifier that is used to perform a lookup in the SSO database for credentials. Read/write String.
ServerTextColor | True if the text color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.
SourceDataFile | Returns or sets a String indicating the source data file for an OLE DB connection. Read/write.
UseLocalConnection | True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. False if the connection string specified by the Connection property is used. Read/write Boolean.


OLEDBConnection Properties (Excel)

 Copy code hover
[image]

OLEDBConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ADOConnection | Returns an ADO connection object if the PivotTable cache is connected to an OLE DB data source. Read-only.
AlwaysUseConnectionFile | True if the connection file is always used to establish connection to the data source. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BackgroundQuery | True if queries for the OLE DB connection are performed asynchronously (in the background). Read/write Boolean.
CalculatedMembers | Returns the CalculatedMembers collection for the specified connection. Read-only
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants. Read/write XlCmdType.
Connection | Returns or sets a string that contains OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.
IsConnected | Returns True if the MaintainConnection property is True. Returns False if it is not currently connected to its source. Read-only Boolean.
LocalConnection | Returns or sets the connection string to an offline cube file. Read/write String.
LocaleID | Returns or sets the locale identifier for the specified connection. Read/write
MaintainConnection | Returns True if the connection to the specified data source is maintained after the refresh operation and until the workbook is closed. Read/write Boolean.
MaxDrillthroughRecords | Returns or sets the maximum number of records to retrieve. Read/write Long.
OLAP | Returns True if the OLE DB connection is connected to an Online Analytical Processing (OLAP) server. Read-only Boolean.
Parent | Returns the parent object for the specified object. Read-only.
RefreshDate | Returns the date on which the OLE DB connection was last refreshed. Read-only Date.
Refreshing | True if a background OLE DB query is in progress for the specified OLE DB connection. Read/write Boolean.
RefreshOnFileOpen | True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RetrieveInOfficeUILang | True if the data and errors are to be retrieved in the Office user interface display language when available. Read/write Boolean.
RobustConnect | Returns or sets how OLE DB connection connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an OLE DB connection string is saved in the connection string. False if the password is removed. Read/write Boolean.
ServerCredentialsMethod | Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.
ServerFillColor | True if the fill color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerFontStyle | True if the font style format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerNumberFormat | True if the number format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
ServerSSOApplicationID | Returns or sets a single sign-on application (SSO) identifier that is used to perform a lookup in the SSO database for credentials. Read/write String.
ServerTextColor | True if the text color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.
SourceDataFile | Returns or sets a String indicating the source data file for an OLE DB connection. Read/write.
UseLocalConnection | True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. False if the connection string specified by the Connection property is used. Read/write Boolean.


OLEDBConnection.ADOConnection Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ADOConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an ADO connection object if the PivotTable cache is connected to an OLE DB data source. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ADOConnection

expression A variable that represents an OLEDBConnection object.

Remarks

The ADOConnection property exposes the Microsoft Excel connection to the data provider, allowing the user to write code within the context of the same session that Excel is using.

The ADOConnection property is available only for sessions where the data source is an OLE DB data source. When there is no ADO session, the query will result in a run-time error. The ADOConnection property can be used for any OLE DB-based cache with ADO. The ADO connection object can be used with ADO MD for finding information about OLAP cubes on which the cache is based.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.AlwaysUseConnectionFile Property (Excel)

 Copy code hover
[image]

OLEDBConnection.AlwaysUseConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection file is always used to establish connection to the data source. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AlwaysUseConnectionFile

expression A variable that represents an OLEDBConnection object.

Remarks

When this property is True the connection file will always be used to establish the connection to the data source. If the connection embedded within the workbook is different from the external connection file, the embedded connection will be ignored and the external connection file will be the only version considered.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Application Property (Excel)

 Copy code hover
[image]

OLEDBConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents an OLEDBConnection object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.BackgroundQuery Property (Excel)

 Copy code hover
[image]

OLEDBConnection.BackgroundQuery Property (Excel)
See also Send feedback

Published: July 16, 2012

True if queries for the OLE DB connection are performed asynchronously (in the background). Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .BackgroundQuery

expression A variable that represents an OLEDBConnection object.

Remarks

For OLAP data sources, this property is read-only and always returns False.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.CalculatedMembers Property (Excel)

 Copy code hover
[image]

OLEDBConnection.CalculatedMembers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the CalculatedMembers collection for the specified connection. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .CalculatedMembers

expression A variable that represents an OLEDBConnection object.

Return Value

CalculatedMembers

Remarks

Use the CalculatedMembers property of the OLEDBConnection collection to share calculated members between multiple PivotTables and cube functions that use the same connection.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.CommandText Property (Excel)

 Copy code hover
[image]

OLEDBConnection.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .CommandText

expression A variable that represents an OLEDBConnection object.

Remarks

You should use the CommandText property instead of the SQL property, which now exists primarily for compatibility with earlier versions of Microsoft Excel. If you use both properties, the CommandText property's value takes precedence.

The CommandType property describes the value of the CommandText property.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.CommandType Property (Excel)

 Copy code hover
[image]

OLEDBConnection.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType constants. Read/write XlCmdType.

Version Information

Version Added: Excel 2007

Syntax

expression .CommandType

expression A variable that represents an OLEDBConnection object.

Remarks

The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Connection Property (Excel)

 Copy code hover
[image]

OLEDBConnection.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Connection

expression A variable that represents an OLEDBConnection object.

Remarks

Setting the Connection property does not immediately initiate the connection to the data source. You must use the Refresh method to make the connection and retrieve the data. When using an offline cube file, set the UseLocalConnection property to True and use the LocalConnection property instead of the Connection property.

Example

This example creates a PivotTable cache based on an OLAP provider, and then it creates a PivotTable report based on the cache, at cell A3 on the active worksheet.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .MaintainConnection = True
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 0
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 0
 End With
End With

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Creator Property (Excel)

 Copy code hover
[image]

OLEDBConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEDBConnection object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.EnableRefresh Property (Excel)

 Copy code hover
[image]

OLEDBConnection.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableRefresh

expression A variable that represents an OLEDBConnection object.

Remarks

The RefreshOnFileOpen property is ignored if the EnableRefresh property is set to False.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.IsConnected Property (Excel)

 Copy code hover
[image]

OLEDBConnection.IsConnected Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the MaintainConnection property is True. Returns False if it is not currently connected to its source. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IsConnected

expression A variable that represents an OLEDBConnection object.

Remarks

The IsConnected property does not check to see if the connection is connected. Even if this property returns True, sending commands to the provider could result in an error if the connection is no longer valid.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.LocalConnection Property (Excel)

 Copy code hover
[image]

OLEDBConnection.LocalConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the connection string to an offline cube file. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .LocalConnection

expression A variable that represents an OLEDBConnection object.

Remarks

For a non-OLAP data source, the value of the LocalConnection property is an empty string, and the UseLocalConnection property is set to False.

Setting the LocalConnection property does not immediately initiate the connection to the data source. You must first use the Refresh method to make the connection and retrieve the data.

The value of the LocalConnection property is used if the UseLocalConnection property is set to True. If the UseLocalConnection property is set to False, the Connection property specifies the connection string for query tables based on sources other than local cube files.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.LocaleID Property (Excel)

 Copy code hover
[image]

OLEDBConnection.LocaleID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the locale identifier for the specified connection. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .LocaleID

expression A variable that represents an OLEDBConnection object.

Return Value

Integer

Remarks

Before you set the LocaleID property to a new locale, you must set the RetrieveInOfficeUILang property of the OLEDBConnection object to False. For more information about valid Locale ID (LCID) values, search the MSDN Web site for "Locale IDs Assigned by Microsoft".

Example

The following code example switches the language of the connection to Spanish.

VBA Copy code Copy code
Dim myConnection As OLEDBConnection
Set myConnection = ThisWorkbook.Connections(1)

With myConnection
 .RetrieveInOfficeUILang = False
 .LocaleID = 3082
End With

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.MaintainConnection Property (Excel)

 Copy code hover
[image]

OLEDBConnection.MaintainConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the connection to the specified data source is maintained after the refresh operation and until the workbook is closed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .MaintainConnection

expression A variable that represents an OLEDBConnection object.

Remarks

The default value is True. If you anticipate frequent queries to a server, setting this property to True might improve performance by reducing reconnection time. Setting this property to False causes an open connection to be closed.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.MaxDrillthroughRecords Property (Excel)

 Copy code hover
[image]

OLEDBConnection.MaxDrillthroughRecords Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of records to retrieve. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .MaxDrillthroughRecords

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.OLAP Property (Excel)

 Copy code hover
[image]

OLEDBConnection.OLAP Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the OLE DB connection is connected to an Online Analytical Processing (OLAP) server. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .OLAP

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Parent Property (Excel)

 Copy code hover
[image]

OLEDBConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.RefreshDate Property (Excel)

 Copy code hover
[image]

OLEDBConnection.RefreshDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the date on which the OLE DB connection was last refreshed. Read-only Date.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshDate

expression A variable that represents an OLEDBConnection object.

Remarks

For OLAP data sources, this property is updated after each query.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Refreshing Property (Excel)

 Copy code hover
[image]

OLEDBConnection.Refreshing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a background OLE DB query is in progress for the specified OLE DB connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Refreshing

expression A variable that represents an OLEDBConnection object.

Remarks

Use the CancelRefresh method to cancel background queries.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.RefreshOnFileOpen Property (Excel)

 Copy code hover
[image]

OLEDBConnection.RefreshOnFileOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshOnFileOpen

expression A variable that represents an OLEDBConnection object.

Remarks

The connections are not automatically refreshed when you open the workbook by using the Open method in Visual Basic. Use the Refresh method to refresh the data after the workbook is open.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.RefreshPeriod Property (Excel)

 Copy code hover
[image]

OLEDBConnection.RefreshPeriod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between refreshes. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .RefreshPeriod

expression A variable that represents an OLEDBConnection object.

Remarks

Setting the period to 0 (zero) disables automatic timed refreshes and is equivalent to setting this property to Null. The value of the RefreshPeriod property can be an integer from 0 through 32767.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.RetrieveInOfficeUILang Property (Excel)

 Copy code hover
[image]

OLEDBConnection.RetrieveInOfficeUILang Property (Excel)
See also Send feedback

True if the data and errors are to be retrieved in the Office user interface display language when available. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .RetrieveInOfficeUILang

expression A variable that represents an OLEDBConnection object.

Remarks

If this property is set to False, the LCID value in the connection string is used instead. If an LCID is not specified, the default LCID from the server is used.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.RobustConnect Property (Excel)

 Copy code hover
[image]

OLEDBConnection.RobustConnect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how OLE DB connection connects to its data source. Read/write XlRobustConnect.

Version Information

Version Added: Excel 2007

Syntax

expression .RobustConnect

expression A variable that represents an OLEDBConnection object.

Remarks

If you use robust connectivity, when Microsoft Excel is unable to establish a connection using the workbook connection information, Excel will check if the workbook connection has a path to an external connection file. If it does, Excel will open the external connection file and try to connect using the information contained in the external connection file. If a connection can be established after using the external connection file, Excel will then update the workbook's connection object.

This provides robust connectivity in scenarios where an Information Technology Department maintains and updates connections in a central place, permitting a user's workbook to automatically fetch those updates whenever the previous version of the connection (cached within the workbook) fails.

Note Note

Robust connectivity isn't secure. If you create a connection on your computer and use it in a workbook and then send someone the workbook, that person will be able to see the path to the connection file on your computer. It is a good idea to remove the connection file information from the workbook before you send the workbook to someone else.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.SavePassword Property (Excel)

 Copy code hover
[image]

OLEDBConnection.SavePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if password information in an OLE DB connection string is saved in the connection string. False if the password is removed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .SavePassword

expression A variable that represents an OLEDBConnection object.

Remarks

This property is used in both ODBC and OLEDB queries, and by both PivotTables and QueryTables.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerCredentialsMethod Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerCredentialsMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerCredentialsMethod

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerFillColor Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerFillColor Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the fill color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerFillColor

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerFontStyle Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerFontStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font style format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerFontStyle

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerNumberFormat Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerNumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the number format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerNumberFormat

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerSSOApplicationID Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerSSOApplicationID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a single sign-on application (SSO) identifier that is used to perform a lookup in the SSO database for credentials. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerSSOApplicationID

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.ServerTextColor Property (Excel)

 Copy code hover
[image]

OLEDBConnection.ServerTextColor Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the text color format for the OLAP server is retrieved from the server when using the specified connection. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerTextColor

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.SourceConnectionFile Property (Excel)

 Copy code hover
[image]

OLEDBConnection.SourceConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceConnectionFile

expression A variable that represents an OLEDBConnection object.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.SourceDataFile Property (Excel)

 Copy code hover
[image]

OLEDBConnection.SourceDataFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the source data file for an OLE DB connection. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceDataFile

expression A variable that represents an OLEDBConnection object.

Remarks

For file-based data sources (for example, Access) the SourceDataFile property contains a fully qualified path to the source data file. It is null for server-based data sources (for example, SQL Server). The SourceDataFile property is set to null if the Connection property is changed programmatically.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.UseLocalConnection Property (Excel)

 Copy code hover
[image]

OLEDBConnection.UseLocalConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. False if the connection string specified by the Connection property is used. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .UseLocalConnection

expression A variable that represents an OLEDBConnection object.

Remarks

This example sets the connection string of the first PivotTable cache to reference an offline cube file.

Example

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches(1)
 .LocalConnection = _
 "OLEDB;Provider=MSOLAP;Data Source=C:\Data\DataCube.cub"
 .UseLocalConnection = True
End With

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection Methods (Excel)

 Copy code hover
[image]

OLEDBConnection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CancelRefresh | Cancels all refresh operations in progress for the specified OLE DB connection.
MakeConnection | Establishes a connection for the specified OLE DB connection.
Reconnect | Drops and then reconnects the specified connection.
Refresh | Refreshes an OLE DB connection.
SaveAsODC | Saves the OLE DB connection as an Microsoft Office Data Connection file.


OLEDBConnection.CancelRefresh Method (Excel)

 Copy code hover
[image]

OLEDBConnection.CancelRefresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Cancels all refresh operations in progress for the specified OLE DB connection.

Version Information

Version Added: Excel 2007

Syntax

expression .CancelRefresh

expression A variable that represents an OLEDBConnection object.

Remarks

Use the Refreshing property to determine whether a refresh operation is currently in progress.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.MakeConnection Method (Excel)

 Copy code hover
[image]

OLEDBConnection.MakeConnection Method (Excel)
See also Send feedback

Published: July 16, 2012

Establishes a connection for the specified OLE DB connection.

Version Information

Version Added: Excel 2007

Syntax

expression .MakeConnection

expression A variable that represents an OLEDBConnection object.

Return Value

Nothing

Remarks

The MakeConnection method can be used when a connection drops and the user wants to reestablish the connection.

Various objects and methods might return a run-time error if the connection is dropped. Use of this method assures a connection before executing other objects or methods.

Note Note

Microsoft Excel might drop a connection temporarily in the course of a session (unknown to the VBA programmer), so this method proves useful.

This method will result in a run-time error if the MaintainConnection property of the specified OLE DB connection has been set to False.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Reconnect Method (Excel)

 Copy code hover
[image]

OLEDBConnection.Reconnect Method (Excel)
See also Send feedback

Published: July 16, 2012

Drops and then reconnects the specified connection.

Version Information

Version Added: Excel 2010

Syntax

expression .Reconnect

expression A variable that represents an OLEDBConnection object.

Example

The following code example causes the specified connection to reconnect.

VBA Copy code Copy code
ThisWorkbook.Connections(1).Reconnect

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.Refresh Method (Excel)

 Copy code hover
[image]

OLEDBConnection.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes an OLE DB connection.

Version Information

Version Added: Excel 2007

Syntax

expression .Refresh

expression A variable that represents an OLEDBConnection object.

Remarks

When making the connection to the OLE DB data source, Microsoft Excel uses the connection string specified by the Connection property. If the specified connection string is missing required values, dialog boxes will be displayed to prompt the user for the required information. If the DisplayAlerts property is False, dialog boxes are not displayed and the Refresh method fails with the Insufficient Connection Information exception.

After Microsoft Excel makes a successful connection, it stores the completed connection string so that prompts will not be displayed for subsequent calls to the Refresh method during the same editing session. You can obtain the completed connection string by examining the value of the Connection property.

After the database connection is made, the SQL query is validated. If the query is not valid, the Refresh method fails with the SQL Syntax Error exception.

The Refresh method returns True if the query is successfully completed or started; it returns False if the user cancels a connection.

To see whether the number of fetched rows exceeded the number of available rows on the worksheet, examine the FetchedRowOverflow property. This property is initialized every time the Refresh method is called.

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBConnection.SaveAsODC Method (Excel)

 Copy code hover
[image]

OLEDBConnection.SaveAsODC Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the OLE DB connection as an Microsoft Office Data Connection file.

Version Information

Version Added: Excel 2007

Syntax

expression .SaveAsODC(ODCFileName, Description, Keywords)

expression A variable that represents an OLEDBConnection object.

Parameters

Name | Required/Optional | Data Type | Description
ODCFileName | Required | String | Location to save the file.
Description | Optional | Variant | Description that will be saved in the file.
Keywords | Optional | Variant | Space-separated keywords that can be used to search for this file.

Example

The following example saves the connection as an ODC file titled "ODCFile". This example assumes an OLE DB connection exists on the active worksheet.

VBA Copy code Copy code
Sub UseSaveAsODC()

 Application.ActiveWorkbook.OLEDBConnection.SaveAsODC ("ODCFile")

End Sub

See also

Concepts

OLEDBConnection Object

Other resources

OLEDBConnection Object Members


OLEDBError Object (Excel)

 Copy code hover
[image]

OLEDBError Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an OLE DB error returned by the most recent OLE DB query.

Remarks

The OLEDBError object is a member of the OLEDBErrors collection. If the specified OLE DB query runs without error, the OLEDBErrors collection is empty. The errors in the collection are indexed in the order in which they're generated by the OLE DB provider.

Example

Use OLEDBErrors(index), where index is the index number of the OLE DB error, to return a single OLEDBError object. The following example displays the error description and the SqlState property's value for the first error returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors(1)
MsgBox "The following error occurred:" & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

Excel Object Model Reference

Other resources

OLEDBError Object Members


OLEDBError Members (Excel)

 Copy code hover
[image]

OLEDBError Members (Excel)
Send feedback

Published: July 16, 2012

Represents an OLE DB error returned by the most recent OLE DB query.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorString | Returns a String value that represents the ODBC error string.
Native | Returns a provider-specific numeric value that specifies an error. The error number corresponds to an error condition that resulted after the most recent OLE DB query. Read-only Long.
Number | Returns a numeric value that specifies an error. The error number corresponds to a unique trap number corresponding to an error condition that resulted after the most recent OLE DB query. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SqlState | Returns the SQL state error. Read-only String.
Stage | Returns a numeric value specifying the stage of an error that resulted after the most recent OLE DB query. Read-only Long.


OLEDBError Properties (Excel)

 Copy code hover
[image]

OLEDBError Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorString | Returns a String value that represents the ODBC error string.
Native | Returns a provider-specific numeric value that specifies an error. The error number corresponds to an error condition that resulted after the most recent OLE DB query. Read-only Long.
Number | Returns a numeric value that specifies an error. The error number corresponds to a unique trap number corresponding to an error condition that resulted after the most recent OLE DB query. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SqlState | Returns the SQL state error. Read-only String.
Stage | Returns a numeric value specifying the stage of an error that resulted after the most recent OLE DB query. Read-only Long.


OLEDBError.Application Property (Excel)

 Copy code hover
[image]

OLEDBError.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an OLEDBError object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.Creator Property (Excel)

 Copy code hover
[image]

OLEDBError.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEDBError object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.ErrorString Property (Excel)

 Copy code hover
[image]

OLEDBError.ErrorString Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the ODBC error string.

Syntax

expression .ErrorString

expression A variable that represents an OLEDBError object.

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.Native Property (Excel)

 Copy code hover
[image]

OLEDBError.Native Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a provider-specific numeric value that specifies an error. The error number corresponds to an error condition that resulted after the most recent OLE DB query. Read-only Long.

Syntax

expression .Native

expression A variable that represents an OLEDBError object.

Example

This example displays the native error number and other error information returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors(1)
MsgBox "The following error occurred:" & _
 objEr.Number & ", " & objEr.Native & ", " & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.Number Property (Excel)

 Copy code hover
[image]

OLEDBError.Number Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a numeric value that specifies an error. The error number corresponds to a unique trap number corresponding to an error condition that resulted after the most recent OLE DB query. Read-only Long.

Syntax

expression .Number

expression A variable that represents an OLEDBError object.

Example

This example displays the error number and other error information returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors(1)
MsgBox "The following error occurred:" & _
 objEr.Number & ", " & objEr.Native & ", " & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.Parent Property (Excel)

 Copy code hover
[image]

OLEDBError.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEDBError object.

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.SqlState Property (Excel)

 Copy code hover
[image]

OLEDBError.SqlState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SQL state error. Read-only String.

Syntax

expression .SqlState

expression A variable that represents an OLEDBError object.

Remarks

For an explanation of the specific error, see you SQL documentation.

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBError.Stage Property (Excel)

 Copy code hover
[image]

OLEDBError.Stage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a numeric value specifying the stage of an error that resulted after the most recent OLE DB query. Read-only Long.

Syntax

expression .Stage

expression A variable that represents an OLEDBError object.

Example

This example displays the error numbers, stage, and other error information returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors(1)
MsgBox "The following error occurred:" & _
 objEr.Number & ", " & objEr.Native & ", " & _
 objEr.Stage & ", " & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

OLEDBError Object

Other resources

OLEDBError Object Members


OLEDBErrors Object (Excel)

 Copy code hover
[image]

OLEDBErrors Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of OLEDBError objects.

Remarks

Each OLEDBError object represents an error returned by the most recent OLE DB query. If the specified OLE DB query runs without error, the OLEDBErrors collection is empty. The errors in the collection are indexed in the order in which they're generated by the OLE DB provider. You cannot add members to the collection.

Example

Use the OLEDBErrors property to return the OLEDBErrors collection. The following example displays the error description and the SqlState property's value for each OLE DB error in the collection.

VBA Copy code Copy code
For Each objEr in Application.OLEDBErrors
 MsgBox "The following error occurred:" & _
 objEr.ErrorString & " : " & objEr.SqlState
Next objEr

Use OLEDBErrors(index), where index is the index number of the OLE DB error, to return a single OLEDBError object. The following example displays the error description and the SqlState property's value for the first error returned by the most recent OLE DB query.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors(1)
MsgBox "The following error occurred:" & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

Excel Object Model Reference

Other resources

OLEDBErrors Object Members


OLEDBErrors Members (Excel)

 Copy code hover
[image]

OLEDBErrors Members (Excel)
Send feedback

Published: July 16, 2012

A collection of OLEDBError objects.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


OLEDBErrors Properties (Excel)

 Copy code hover
[image]

OLEDBErrors Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


OLEDBErrors.Application Property (Excel)

 Copy code hover
[image]

OLEDBErrors.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an OLEDBErrors object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

OLEDBErrors Object

Other resources

OLEDBErrors Object Members


OLEDBErrors.Count Property (Excel)

 Copy code hover
[image]

OLEDBErrors.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an OLEDBErrors object.

See also

Concepts

OLEDBErrors Object

Other resources

OLEDBErrors Object Members


OLEDBErrors.Creator Property (Excel)

 Copy code hover
[image]

OLEDBErrors.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEDBErrors object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEDBErrors Object

Other resources

OLEDBErrors Object Members


OLEDBErrors.Parent Property (Excel)

 Copy code hover
[image]

OLEDBErrors.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEDBErrors object.

See also

Concepts

OLEDBErrors Object

Other resources

OLEDBErrors Object Members


OLEDBErrors Methods (Excel)

 Copy code hover
[image]

OLEDBErrors Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


OLEDBErrors.Item Method (Excel)

 Copy code hover
[image]

OLEDBErrors.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an OLEDBErrors object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number for the object.

Return Value

An OLEDBError object contained by the collection.

Example

This example displays an OLE DB error.

VBA Copy code Copy code
Set objEr = Application.OLEDBErrors.Item(1)
MsgBox "The following error occurred:" & _
 objEr.ErrorString & " : " & objEr.SqlState

See also

Concepts

OLEDBErrors Object

Other resources

OLEDBErrors Object Members


OLEFormat Object (Excel)

 Copy code hover
[image]

OLEFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains OLE object properties.

Remarks

If the Shape object doesn't represent a linked or embedded object, the OLEFormat property fails.

Example

Use the OLEFormat property to return the OLEFormat object. The following example activates an OLE object in the Shapes collection.

VBA Copy code Copy code
Worksheets(1).Shapes(1).OLEFormat.Activate

See also

Concepts

Excel Object Model Reference

Other resources

OLEFormat Object Members


OLEFormat Members (Excel)

 Copy code hover
[image]

OLEFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains OLE object properties.

Methods

Name | Description
Activate | Activates the current ole object.
Verb | Sends a verb to the server of the specified OLE object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Object | Returns the OLE Automation object associated with this OLE object. Read-only Object.
Parent | Returns the parent object for the specified object. Read-only.
progID | Returns the programmatic identifiers for the object. Read-only String.


OLEFormat Properties (Excel)

 Copy code hover
[image]

OLEFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Object | Returns the OLE Automation object associated with this OLE object. Read-only Object.
Parent | Returns the parent object for the specified object. Read-only.
progID | Returns the programmatic identifiers for the object. Read-only String.


OLEFormat.Application Property (Excel)

 Copy code hover
[image]

OLEFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an OLEFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Creator Property (Excel)

 Copy code hover
[image]

OLEFormat.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Object Property (Excel)

 Copy code hover
[image]

OLEFormat.Object Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the OLE Automation object associated with this OLE object. Read-only Object.

Syntax

expression .Object

expression A variable that represents an OLEFormat object.

Example

This example inserts text at the beginning of an embedded Word document object on Sheet1. Note that the three statements in the With control structure are WordBasic statements.

VBA Copy code Copy code
Set wordObj = Worksheets("Sheet1").OLEObjects(1)
wordObj.Activate
With wordObj.Object.Application.WordBasic
 .StartOfDocument
 .Insert "This is the beginning"
 .InsertPara
End With

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Parent Property (Excel)

 Copy code hover
[image]

OLEFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEFormat object.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.progID Property (Excel)

 Copy code hover
[image]

OLEFormat.progID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the programmatic identifiers for the object. Read-only String.

Syntax

expression .progID

expression A variable that represents an OLEFormat object.

Example

This example creates a list of the programmatic identifiers for the OLE objects on worksheet one.

VBA Copy code Copy code
rw = 0
For Each o in Worksheets(1).OLEObjects
 With Worksheets(2)
 rw = rw + 1
 .cells(rw, 1).Value = o.ProgId
 End With
Next

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat Methods (Excel)

 Copy code hover
[image]

OLEFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the current ole object.
Verb | Sends a verb to the server of the specified OLE object.


OLEFormat.Activate Method (Excel)

 Copy code hover
[image]

OLEFormat.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the current ole object.

Syntax

expression .Activate

expression A variable that represents an OLEFormat object.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Verb Method (Excel)

 Copy code hover
[image]

OLEFormat.Verb Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends a verb to the server of the specified OLE object.

Syntax

expression .Verb(Verb)

expression A variable that represents an OLEFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Verb | Optional | XlOLEVerb | The verb that the server of the OLE object should act on. If this argument is omitted, the default verb is sent. The available verbs are determined by the object's source application. Typical verbs for an OLE object are Open and Primary (represented by the XlOLEVerb constants xlOpen and xlPrimary).

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEObject Object (Excel)

 Copy code hover
[image]

OLEObject Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an ActiveX control or a linked or embedded OLE object on a worksheet.

Remarks

The OLEObject object is a member of the OLEObjects collection. The OLEObjects collection contains all the OLE objects on a single worksheet.

Example

Use OLEObjects(index), where index is the name or number of the object, to return an OLEObject object. The following example deletes OLE object one on Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").OLEObjects(1).Delete

The following example deletes the OLE object named "ListBox1."

VBA Copy code Copy code
Worksheets("sheet1").OLEObjects("ListBox1").Delete

The properties and methods of the OLEObject object are duplicated on each ActiveX control on a worksheet. This enables Visual Basic code to gain access to these properties by using the control's name. The following example selects the check box control named "MyCheckBox," aligns it with the active cell, and then activates the control.

VBA Copy code Copy code
With MyCheckBox
 .Value = True
 .Top = ActiveCell.Top
 .Activate
End With

See also

Concepts

Excel Object Model Reference

Other resources

OLEObject Object Members


OLEObject Members (Excel)

 Copy code hover
[image]

OLEObject Members (Excel)
Send feedback

Published: July 16, 2012

Represents an ActiveX control or a linked or embedded OLE object on a worksheet.

Events

Name | Description
GotFocus | Occurs when an ActiveX control gets input focus.
LostFocus | Occurs when an ActiveX control loses input focus.

Methods

Name | Description
Activate | Activates the object.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard or pastes it into a specified destination.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.
Update | Updates the link.
Verb | Sends a verb to the server of the specified OLE object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoLoad | True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.
AutoUpdate | True if the OLE object is updated automatically when the source changes. Valid only if the object is linked (its OLEType property must be xlOLELink). Read-only Boolean.
Border | Returns a Border object that represents the border of the object.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Interior | Returns an Interior object that represents the interior of the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
LinkedCell | Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.
ListFillRange | Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Object | Returns the OLE Automation object associated with this OLE object. Read-only Object.
OLEType | Returns the OLE object type. Can be one of the following XlOLEType constants: xlOLELink or xlOLEEmbed. Returns xlOLELink if the object is linked (it exists outside of the file), or returns xlOLEEmbed if the object is embedded (it's entirely contained within the file). Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
progID | Returns the programmatic identifiers for the object. Read-only String.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
SourceName | Returns or sets a String value that represents the specified object's link source name.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


OLEObject Properties (Excel)

 Copy code hover
[image]

OLEObject Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoLoad | True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.
AutoUpdate | True if the OLE object is updated automatically when the source changes. Valid only if the object is linked (its OLEType property must be xlOLELink). Read-only Boolean.
Border | Returns a Border object that represents the border of the object.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Interior | Returns an Interior object that represents the interior of the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
LinkedCell | Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.
ListFillRange | Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Object | Returns the OLE Automation object associated with this OLE object. Read-only Object.
OLEType | Returns the OLE object type. Can be one of the following XlOLEType constants: xlOLELink or xlOLEEmbed. Returns xlOLELink if the object is linked (it exists outside of the file), or returns xlOLEEmbed if the object is embedded (it's entirely contained within the file). Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
progID | Returns the programmatic identifiers for the object. Read-only String.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
SourceName | Returns or sets a String value that represents the specified object's link source name.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


OLEObject.Application Property (Excel)

 Copy code hover
[image]

OLEObject.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an OLEObject object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.AutoLoad Property (Excel)

 Copy code hover
[image]

OLEObject.AutoLoad Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.

Syntax

expression .AutoLoad

expression A variable that represents an OLEObject object.

Remarks

This property is ignored by ActiveX controls. ActiveX controls are always loaded when a workbook is opened.

For most OLE object types, this property shouldn't be set to True. By default, the AutoLoad property is set to False for new OLE objects; this saves time and memory when Microsoft Excel is loading workbooks. The benefit of automatically loading OLE objects is that, for objects that represent volatile data, links to source data can be reestablished immediately and the objects can be rendered again, if necessary.

Example

This example sets the AutoLoad property for OLE object one on the active sheet.

VBA Copy code Copy code
ActiveSheet.OLEObjects(1).AutoLoad = False

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.AutoUpdate Property (Excel)

 Copy code hover
[image]

OLEObject.AutoUpdate Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the OLE object is updated automatically when the source changes. Valid only if the object is linked (its OLEType property must be xlOLELink). Read-only Boolean.

Syntax

expression .AutoUpdate

expression A variable that represents an OLEObject object.

Example

This example displays the status of automatic updating for all OLE objects on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").Value = "Name"
Range("B1").Value = "Link Status"
Range("C1").Value = "AutoUpdate Status"
i = 2
For Each obj In ActiveSheet.OLEObjects
 Cells(i, 1) = obj.Name
 If obj.OLEType = xlOLELink Then
 Cells(i, 2) = "Linked"
 Cells(i, 3) = obj.AutoUpdate
 Else
 Cells(i, 2) = "Embedded"
 End If
 i = i + 1
Next

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Border Property (Excel)

 Copy code hover
[image]

OLEObject.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.BottomRightCell Property (Excel)

 Copy code hover
[image]

OLEObject.BottomRightCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.

Syntax

expression .BottomRightCell

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Creator Property (Excel)

 Copy code hover
[image]

OLEObject.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEObject object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Enabled Property (Excel)

 Copy code hover
[image]

OLEObject.Enabled Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object is enabled. Read/write Boolean.

Syntax

expression .Enabled

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Height Property (Excel)

 Copy code hover
[image]

OLEObject.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Index Property (Excel)

 Copy code hover
[image]

OLEObject.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Interior Property (Excel)

 Copy code hover
[image]

OLEObject.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object.

Syntax

expression .Interior

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Left Property (Excel)

 Copy code hover
[image]

OLEObject.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.LinkedCell Property (Excel)

 Copy code hover
[image]

OLEObject.LinkedCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the worksheet range linked to the control's value. If you place a value in the cell, the control takes this value. Likewise, if you change the value of the control, that value is also placed in the cell. Read/write String.

Syntax

expression .LinkedCell

expression A variable that represents an OLEObject object.

Remarks

You cannot use this property with multiselect list boxes.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.ListFillRange Property (Excel)

 Copy code hover
[image]

OLEObject.ListFillRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the worksheet range used to fill the specified list box. Setting this property destroys any existing list in the list box. Read/write String.

Syntax

expression .ListFillRange

expression A variable that represents an OLEObject object.

Remarks

Microsoft Excel reads the contents of every cell in the range and inserts the cell values into the list box. The list tracks changes in the range's cells.

If the list in the list box was created with the AddItem method, this property returns an empty string ("").

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Locked Property (Excel)

 Copy code hover
[image]

OLEObject.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents an OLEObject object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Name Property (Excel)

 Copy code hover
[image]

OLEObject.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Object Property (Excel)

 Copy code hover
[image]

OLEObject.Object Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the OLE Automation object associated with this OLE object. Read-only Object.

Syntax

expression .Object

expression A variable that represents an OLEObject object.

Example

This example inserts text at the beginning of an embedded Word document object on Sheet1. Note that the three statements in the With control structure are WordBasic statements.

VBA Copy code Copy code
Set wordObj = Worksheets("Sheet1").OLEObjects(1)
wordObj.Activate
With wordObj.Object.Application.WordBasic
 .StartOfDocument
 .Insert "This is the beginning"
 .InsertPara
End With

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.OLEType Property (Excel)

 Copy code hover
[image]

OLEObject.OLEType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the OLE object type. Can be one of the following XlOLEType constants: xlOLELink or xlOLEEmbed. Returns xlOLELink if the object is linked (it exists outside of the file), or returns xlOLEEmbed if the object is embedded (it's entirely contained within the file). Read-only Long.

Syntax

expression .OLEType

expression A variable that represents an OLEObject object.

Example

This example creates a list of link types for OLE objects on Sheet1. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
i = 2
newSheet.Range("A1").Value = "Name"
newSheet.Range("B1").Value = "Link Type"
For Each obj In Worksheets("Sheet1").OLEObjects
 newSheet.Cells(i, 1).Value = obj.Name
 If obj.OLEType = xlOLELink Then
 newSheet.Cells(i, 2) = "Linked"
 Else
 newSheet.Cells(i, 2) = "Embedded"
 End If
 i = i + 1
Next

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Parent Property (Excel)

 Copy code hover
[image]

OLEObject.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Placement Property (Excel)

 Copy code hover
[image]

OLEObject.Placement Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.

Syntax

expression .Placement

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.PrintObject Property (Excel)

 Copy code hover
[image]

OLEObject.PrintObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object will be printed when the document is printed. Read/write Boolean.

Syntax

expression .PrintObject

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.progID Property (Excel)

 Copy code hover
[image]

OLEObject.progID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the programmatic identifiers for the object. Read-only String.

Syntax

expression .progID

expression A variable that represents an OLEObject object.

Example

This example creates a list of the programmatic identifiers for the OLE objects on worksheet one.

VBA Copy code Copy code
rw = 0
For Each o in Worksheets(1).OLEObjects
 With Worksheets(2)
 rw = rw + 1
 .cells(rw, 1).Value = o.ProgId
 End With
Next

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Shadow Property (Excel)

 Copy code hover
[image]

OLEObject.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.ShapeRange Property (Excel)

 Copy code hover
[image]

OLEObject.ShapeRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents the specified object or objects. Read-only.

Syntax

expression .ShapeRange

expression An expression that returns a OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.SourceName Property (Excel)

 Copy code hover
[image]

OLEObject.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the specified object's link source name.

Syntax

expression .SourceName

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Top Property (Excel)

 Copy code hover
[image]

OLEObject.Top Property (Excel)
See also Send feedback

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.TopLeftCell Property (Excel)

 Copy code hover
[image]

OLEObject.TopLeftCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.

Syntax

expression .TopLeftCell

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Visible Property (Excel)

 Copy code hover
[image]

OLEObject.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Width Property (Excel)

 Copy code hover
[image]

OLEObject.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents an OLEObject object.

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.ZOrder Property (Excel)

 Copy code hover
[image]

OLEObject.ZOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the z-order position of the object. Read-only Long.

Syntax

expression .ZOrder

expression A variable that represents an OLEObject object.

Remarks

In any collection of objects, the object at the back of the z-order is collection(1), and the object at the front of the z-order is collection(collection.Count). For example, if there are embedded charts on the active sheet, the chart at the back of the z-order is ActiveSheet.ChartObjects(1), and the chart at the front of the z-order is ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).

Example

This example displays the z-order position of embedded chart one on Sheet1.

VBA Copy code Copy code
MsgBox "The chart's z-order position is " & _
 Worksheets("Sheet1").ChartObjects(1).ZOrder

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject Methods (Excel)

 Copy code hover
[image]

OLEObject Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the object.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard or pastes it into a specified destination.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.
Update | Updates the link.
Verb | Sends a verb to the server of the specified OLE object.


OLEObject.Activate Method (Excel)

 Copy code hover
[image]

OLEObject.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the object.

Syntax

expression .Activate

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.BringToFront Method (Excel)

 Copy code hover
[image]

OLEObject.BringToFront Method (Excel)
See also Send feedback

Published: July 16, 2012

Brings the object to the front of the z-order.

Syntax

expression .BringToFront

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Copy Method (Excel)

 Copy code hover
[image]

OLEObject.Copy Method (Excel)
See also Send feedback

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.CopyPicture Method (Excel)

 Copy code hover
[image]

OLEObject.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture. Variant.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents an OLEObject object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | XlCopyPictureFormat | . The format of the picture. The default value is xlPicture.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Cut Method (Excel)

 Copy code hover
[image]

OLEObject.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard or pastes it into a specified destination.

Syntax

expression .Cut

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Delete Method (Excel)

 Copy code hover
[image]

OLEObject.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Duplicate Method (Excel)

 Copy code hover
[image]

OLEObject.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents an OLEObject object.

Return Value

Object

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Select Method (Excel)

 Copy code hover
[image]

OLEObject.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents an OLEObject object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.SendToBack Method (Excel)

 Copy code hover
[image]

OLEObject.SendToBack Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends the object to the back of the z-order.

Syntax

expression .SendToBack

expression A variable that represents an OLEObject object.

Return Value

Variant

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Update Method (Excel)

 Copy code hover
[image]

OLEObject.Update Method (Excel)
See also Send feedback

Published: July 16, 2012

Updates the link.

Syntax

expression .Update

expression A variable that represents an OLEObject object.

Return Value

Variant

Example

This example updates the link to OLE object one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").OLEObjects(1).Update

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.Verb Method (Excel)

 Copy code hover
[image]

OLEObject.Verb Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends a verb to the server of the specified OLE object.

Syntax

expression .Verb(Verb)

expression A variable that represents an OLEObject object.

Parameters

Name | Required/Optional | Data Type | Description
Verb | Optional | XlOLEVerb | The verb that the server of the OLE object should act on. If this argument is omitted, the default verb is sent. The available verbs are determined by the object's source application. Typical verbs for an OLE object are Open and Primary (represented by the XlOLEVerb constants xlOpen and xlPrimary).

Return Value

Variant

Example

This example sends the default verb to the server for OLE object one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").OLEObjects(1).Verb

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject Events (Excel)

 Copy code hover
[image]

OLEObject Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
GotFocus | Occurs when an ActiveX control gets input focus.
LostFocus | Occurs when an ActiveX control loses input focus.


OLEObject.GotFocus Event (Excel)

 Copy code hover
[image]

OLEObject.GotFocus Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when an ActiveX control gets input focus.

Syntax

expression .GotFocus

expression A variable that represents an OLEObject object.

Return Value

Nothing

Example

This example runs when ListBox1 gets the focus.

VBA Copy code Copy code
Private Sub ListBox1_GotFocus()
 ' runs when list box gets the focus
End Sub

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObject.LostFocus Event (Excel)

 Copy code hover
[image]

OLEObject.LostFocus Event (Excel)
See also Send feedback

Occurs when an ActiveX control loses input focus.

Syntax

expression .LostFocus

expression A variable that represents an OLEObject object.

Return Value

Nothing

Example

This example runs when ListBox1 loses the focus.

VBA Copy code Copy code
Private Sub ListBox1_LostFocus()
 ' runs when list box loses the focus
End Sub

See also

Concepts

OLEObject Object

Other resources

OLEObject Object Members


OLEObjects Object (Excel)

 Copy code hover
[image]

OLEObjects Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the OLEObject objects on the specified worksheet.

Remarks

Each OLEObject object represents an ActiveX control or a linked or embedded OLE object.

An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the Name box when you view the sheet, and the code name for the control, which you can see in the cell to the right of (Name) in the Properties window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other is not automatically changed to match.

Example

Use the OLEObjects method to return the OLEObjects collection. The following example hides all the OLE objects on worksheet one.

VBA Copy code Copy code
Worksheets(1).OLEObjects.Visible = False

Use the Add method to create a new OLE object and add it to the OLEObjects collection. The following example creates a new OLE object representing the bitmap file Arcade.bmp and adds it to worksheet one.

VBA Copy code Copy code
Worksheets(1).OLEObjects.Add FileName:="arcade.gif"

The following example creates a new ActiveX control (a list box) and adds it to worksheet one.

VBA Copy code Copy code
Worksheets(1).OLEObjects.Add ClassType:="Forms.ListBox.1"

You use the code name of a control in the names of its event procedures. However, when you return a control from the Shapes or OLEObjects collection for a sheet, you must use the shape name, not the code name, to refer to the control by name. For example, assume that you add a check box to a sheet and that both the default shape name and the default code name are CheckBox1. If you then change the control code name by typing chkFinished next to (Name) in the Properties window, you must use chkFinished in event procedures names, but you still have to use CheckBox1 to return the control from the Shapes or OLEObject collection, as shown in the following example.

VBA Copy code Copy code
Private Sub chkFinished_Click()
 ActiveSheet.OLEObjects("CheckBox1").Object.Value = 1
End Sub

See also

Concepts

Excel Object Model Reference

Other resources

OLEObjects Object Members


OLEObjects Members (Excel)

 Copy code hover
[image]

OLEObjects Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the OLEObject objects on the specified worksheet.

Methods

Name | Description
Add | Adds a new OLE object to a sheet.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Item | Returns a single object from a collection.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoLoad | True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.
Border | Returns a Border object that represents the border of the object.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Interior | Returns an Interior object that represents the interior of the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
SourceName | Returns or sets a String value that represents the specified object's link source name.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


OLEObjects Properties (Excel)

 Copy code hover
[image]

OLEObjects Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoLoad | True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.
Border | Returns a Border object that represents the border of the object.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Enabled | True if the object is enabled. Read/write Boolean.
Height | Returns or sets a Double value that represents the height, in points, of the object.
Interior | Returns an Interior object that represents the interior of the specified object.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Parent | Returns the parent object for the specified object. Read-only.
Placement | Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.
PrintObject | True if the object will be printed when the document is printed. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
ShapeRange | Returns a ShapeRange object that represents the specified object or objects. Read-only.
SourceName | Returns or sets a String value that represents the specified object's link source name.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
Width | Returns or sets a Double value that represents the width, in points, of the object.
ZOrder | Returns the z-order position of the object. Read-only Long.


OLEObjects.Application Property (Excel)

 Copy code hover
[image]

OLEObjects.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an OLEObjects object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.AutoLoad Property (Excel)

 Copy code hover
[image]

OLEObjects.AutoLoad Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the OLE object is automatically loaded when the workbook that contains it is opened. Read/write Boolean.

Syntax

expression .AutoLoad

expression A variable that represents an OLEObjects object.

Remarks

This property is ignored by ActiveX controls. ActiveX controls are always loaded when a workbook is opened.

For most OLE object types, this property shouldn't be set to True. By default, the AutoLoad property is set to False for new OLE objects; this saves time and memory when Microsoft Excel is loading workbooks. The benefit of automatically loading OLE objects is that, for objects that represent volatile data, links to source data can be reestablished immediately and the objects can be rendered again, if necessary.

Example

This example sets the AutoLoad property for OLE object one on the active sheet.

VBA Copy code Copy code
ActiveSheet.OLEObjects(1).AutoLoad = False

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Border Property (Excel)

 Copy code hover
[image]

OLEObjects.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Count Property (Excel)

 Copy code hover
[image]

OLEObjects.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Creator Property (Excel)

 Copy code hover
[image]

OLEObjects.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an OLEObjects object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Enabled Property (Excel)

 Copy code hover
[image]

OLEObjects.Enabled Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object is enabled. Read/write Boolean.

Syntax

expression .Enabled

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Height Property (Excel)

 Copy code hover
[image]

OLEObjects.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Interior Property (Excel)

 Copy code hover
[image]

OLEObjects.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object.

Syntax

expression .Interior

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Left Property (Excel)

 Copy code hover
[image]

OLEObjects.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Locked Property (Excel)

 Copy code hover
[image]

OLEObjects.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents an OLEObjects object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Parent Property (Excel)

 Copy code hover
[image]

OLEObjects.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Placement Property (Excel)

 Copy code hover
[image]

OLEObjects.Placement Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an XlPlacement constant, that represents the way the object is attached to the cells below it.

Syntax

expression .Placement

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.PrintObject Property (Excel)

 Copy code hover
[image]

OLEObjects.PrintObject Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the object will be printed when the document is printed. Read/write Boolean.

Syntax

expression .PrintObject

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Shadow Property (Excel)

 Copy code hover
[image]

OLEObjects.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.ShapeRange Property (Excel)

 Copy code hover
[image]

OLEObjects.ShapeRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents the specified object or objects. Read-only.

Syntax

expression .ShapeRange

expression An expression that returns a OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.SourceName Property (Excel)

 Copy code hover
[image]

OLEObjects.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the specified object's link source name.

Syntax

expression .SourceName

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Top Property (Excel)

 Copy code hover
[image]

OLEObjects.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Visible Property (Excel)

 Copy code hover
[image]

OLEObjects.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Width Property (Excel)

 Copy code hover
[image]

OLEObjects.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents an OLEObjects object.

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.ZOrder Property (Excel)

 Copy code hover
[image]

OLEObjects.ZOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the z-order position of the object. Read-only Long.

Syntax

expression .ZOrder

expression A variable that represents an OLEObjects object.

Remarks

In any collection of objects, the object at the back of the z-order is collection(1), and the object at the front of the z-order is collection(collection.Count). For example, if there are embedded charts on the active sheet, the chart at the back of the z-order is ActiveSheet.ChartObjects(1), and the chart at the front of the z-order is ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).

Example

This example displays the z-order position of embedded chart one on Sheet1.

VBA Copy code Copy code
MsgBox "The chart's z-order position is " & _
 Worksheets("Sheet1").ChartObjects(1).ZOrder

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects Methods (Excel)

 Copy code hover
[image]

OLEObjects Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new OLE object to a sheet.
BringToFront | Brings the object to the front of the z-order.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Item | Returns a single object from a collection.
Select | Selects the object.
SendToBack | Sends the object to the back of the z-order.


OLEObjects.Add Method (Excel)

 Copy code hover
[image]

OLEObjects.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new OLE object to a sheet.

Syntax

expression .Add(ClassType, FileName, Link, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Left, Top, Width, Height)

expression A variable that represents an OLEObjects object.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | (you must specify either ClassType or FileName). A string that contains the programmatic identifier for the object to be created. If ClassType is specified, FileName and Link are ignored.
Height | Optional | Variant | (you must specify either ClassType or FileName). A string that specifies the file to be used to create the OLE object.
Link | Optional | Variant | True to have the new OLE object based on FileName be linked to that file. If the object isn't linked, the object is created as a copy of the file. The default value is False.
DisplayAsIcon | Optional | Variant | True to display the new OLE object either as an icon or as its regular picture. If this argument is True, IconFileName and IconIndex can be used to specify an icon.
IconFileName | Optional | Variant | A string that specifies the file that contains the icon to be displayed. This argument is used only if DisplayAsIcon is True. If this argument isn't specified or the file contains no icons, the default icon for the OLE class is used.
IconIndex | Optional | Variant | The number of the icon in the icon file. This is used only if DisplayAsIcon is True and IconFileName refers to a valid file that contains icons. If an icon with the given index number doesn't exist in the file specified by IconFileName, the first icon in the file is used.
IconLabel | Optional | Variant | A string that specifies a label to display beneath the icon. This is used only if DisplayAsIcon is True. If this argument is omitted or is an empty string (""), no caption is displayed.
Left | Optional | Variant | The initial coordinates of the new object, in points, relative to the upper-left corner of cell A1 on a worksheet, or to the upper-left corner of a chart.
Width | Optional | Variant | The initial size of the new object, in points.
Top | Optional | Variant | The initial coordinates of the new object in points, relative to the upper-left corner of cell A1 on a worksheet, or to the upper-left corner of a chart.

Return Value

An OLEObject object that represents the new OLE object.

Example

This example creates a new Microsoft Word OLE object on Sheet1.

VBA Copy code Copy code
ActiveWorkbook.Worksheets("Sheet1").OLEObjects.Add _
 ClassType:="Word.Document"

This example adds a command button to sheet one.

VBA Copy code Copy code
Worksheets(1).OLEObjects.Add ClassType:="Forms.CommandButton.1", _
 Link:=False, DisplayAsIcon:=False, Left:=40, Top:=40, _
 Width:=150, Height:=10

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.BringToFront Method (Excel)

 Copy code hover
[image]

OLEObjects.BringToFront Method (Excel)
See also Send feedback

Published: July 16, 2012

Brings the object to the front of the z-order.

Syntax

expression .BringToFront

expression A variable that represents an OLEObjects object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Copy Method (Excel)

 Copy code hover
[image]

OLEObjects.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents an OLEObjects object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.CopyPicture Method (Excel)

 Copy code hover
[image]

OLEObjects.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture. Variant.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents an OLEObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | XlCopyPictureFormat | . The format of the picture. The default value is xlPicture.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Cut Method (Excel)

 Copy code hover
[image]

OLEObjects.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard.

Syntax

expression .Cut

expression A variable that represents an OLEObjects object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Delete Method (Excel)

 Copy code hover
[image]

OLEObjects.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an OLEObjects object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Duplicate Method (Excel)

 Copy code hover
[image]

OLEObjects.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents an OLEObjects object.

Return Value

Object

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Item Method (Excel)

 Copy code hover
[image]

OLEObjects.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an OLEObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

An Object value that represents an object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example deletes OLE object one from Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").OLEObjects.Item(1).Delete

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.Select Method (Excel)

 Copy code hover
[image]

OLEObjects.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents an OLEObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


OLEObjects.SendToBack Method (Excel)

 Copy code hover
[image]

OLEObjects.SendToBack Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends the object to the back of the z-order.

Syntax

expression .SendToBack

expression A variable that represents an OLEObjects object.

Return Value

Variant

See also

Concepts

OLEObjects Object

Other resources

OLEObjects Object Members


Outline Object (Excel)

 Copy code hover
[image]

Outline Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an outline on a worksheet.

Example

Use the Outline property to return an Outline object. The following example sets the outline on Sheet4 so that only the first outline level is shown.

VBA Copy code Copy code
Worksheets("sheet4").Outline.ShowLevels 1

See also

Concepts

Excel Object Model Reference

Other resources

Outline Object Members


Outline Members (Excel)

 Copy code hover
[image]

Outline Members (Excel)
Send feedback

Published: July 16, 2012

Represents an outline on a worksheet.

Methods

Name | Description
ShowLevels | Displays the specified number of row and/or column levels of an outline.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutomaticStyles | True if the outline uses automatic styles. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SummaryColumn | Returns or sets the location of the summary columns in the outline. Read/write XlSummaryColumn.
SummaryRow | Returns or sets the location of the summary rows in the outline. Read/write XlSummaryRow.


Outline Properties (Excel)

 Copy code hover
[image]

Outline Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutomaticStyles | True if the outline uses automatic styles. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SummaryColumn | Returns or sets the location of the summary columns in the outline. Read/write XlSummaryColumn.
SummaryRow | Returns or sets the location of the summary rows in the outline. Read/write XlSummaryRow.


Outline.Application Property (Excel)

 Copy code hover
[image]

Outline.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents an Outline object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline.AutomaticStyles Property (Excel)

 Copy code hover
[image]

Outline.AutomaticStyles Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the outline uses automatic styles. Read/write Boolean.

Syntax

expression .AutomaticStyles

expression A variable that represents an Outline object.

Example

This example sets the outline on Sheet1 to use automatic styles.

VBA Copy code Copy code
Worksheets("Sheet1").Outline.AutomaticStyles = True

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline.Creator Property (Excel)

 Copy code hover
[image]

Outline.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Outline object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline.Parent Property (Excel)

 Copy code hover
[image]

Outline.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents an Outline object.

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline.SummaryColumn Property (Excel)

 Copy code hover
[image]

Outline.SummaryColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of the summary columns in the outline. Read/write XlSummaryColumn.

Syntax

expression .SummaryColumn

expression A variable that represents an Outline object.

Remarks

XlSummaryColumn can be one of these XlSummaryColumn constants.

xlSummaryOnRight The summary column will be positioned to the right of the detail columns in the outline.

xlSummaryOnLeft The summary column will be positioned to the left of the detail columns in the outline.

Example

This example creates an outline with automatic styles, with the summary row above the detail rows, and with the summary column to the right of the detail columns.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Selection.AutoOutline
With ActiveSheet.Outline
 .SummaryRow = xlAbove
 .SummaryColumn = xlRight
 .AutomaticStyles = True
End With

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline.SummaryRow Property (Excel)

 Copy code hover
[image]

Outline.SummaryRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of the summary rows in the outline. Read/write XlSummaryRow.

Syntax

expression .SummaryRow

expression A variable that represents an Outline object.

Remarks

XlSummaryRow can be one of these XlSummaryRow constants.

xlSummaryBelow The summary row will be positioned below the detail rows in the outline.

xlSummaryAbove The summary row will be positioned above the detail rows in the outline.

Set XlSummaryRow to xlAbove for Microsoft Word-style outlines, where category headers are above the detailed information. Set XlSummaryRow to xlBelow for accounting-style outlines, where summations are below the detailed information.

Example

This example creates an outline with automatic styles, with the summary row above the detail rows, and with the summary column to the right of the detail columns.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Selection.AutoOutline
With ActiveSheet.Outline
 .SummaryRow = xlAbove
 .SummaryColumn = xlRight
 .AutomaticStyles = True
End With

See also

Concepts

Outline Object

Other resources

Outline Object Members


Outline Methods (Excel)

 Copy code hover
[image]

Outline Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ShowLevels | Displays the specified number of row and/or column levels of an outline.


Outline.ShowLevels Method (Excel)

 Copy code hover
[image]

Outline.ShowLevels Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the specified number of row and/or column levels of an outline.

Syntax

expression .ShowLevels(RowLevels, ColumnLevels)

expression A variable that represents an Outline object.

Parameters

Name | Required/Optional | Data Type | Description
RowLevels | Optional | Variant | Specifies the number of row levels of an outline to display. If the outline has fewer levels than the number specified, Microsoft Excel displays all the levels. If this argument is 0 (zero) or is omitted, no action is taken on rows.
ColumnLevels | Optional | Variant | Specifies the number of column levels of an outline to display. If the outline has fewer levels than the number specified, Microsoft Excel displays all the levels. If this argument is 0 (zero) or is omitted, no action is taken on columns.

Return Value

Variant

Remarks

You must specify at least one argument.

Example

This example displays row levels one through three and column level one of the outline on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Outline _
 .ShowLevels rowLevels:=3, columnLevels:=1

See also

Concepts

Outline Object

Other resources

Outline Object Members


Page Object (Excel)

 Copy code hover
[image]

Page Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a page in a workbook. Use the PageSetup object and the related methods and properties for programmatically defining page layout in a workbook.

Version Information

Version Added: Excel 2007

Remarks

Use the Item method to access a specific page in a workbook. The following example accesses the first page in the active workbook.

VBA Copy code Copy code
Dim objPage As Page

Set objPage = ActiveWorkbook.ActiveWindow _
 .Panes(1).Pages.Item(1)

See also

Concepts

Excel Object Model Reference

Other resources

Page Object Members


Page Members (Excel)

 Copy code hover
[image]

Page Members (Excel)
Send feedback

Published: July 16, 2012

Represents a page in a workbook. Use the PageSetup object and the related methods and properties for programmatically defining page layout in a workbook.

Properties

Name | Description
CenterFooter | Specifies a picture or text to be center aligned in the page footer.
CenterHeader | Specifies a picture or text to be center aligned in the page header.
LeftFooter | Specifies a picture or text to be left aligned in the page footer.
LeftHeader | Specifies a picture or text to be left aligned in the page header.
RightFooter | Specifies a picture or text to be right aligned in the page footer.
RightHeader | Specifies a picture or text to be right aligned in the page header.


Page Properties (Excel)

 Copy code hover
[image]

Page Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
CenterFooter | Specifies a picture or text to be center aligned in the page footer.
CenterHeader | Specifies a picture or text to be center aligned in the page header.
LeftFooter | Specifies a picture or text to be left aligned in the page footer.
LeftHeader | Specifies a picture or text to be left aligned in the page header.
RightFooter | Specifies a picture or text to be right aligned in the page footer.
RightHeader | Specifies a picture or text to be right aligned in the page header.


Page.CenterFooter Property (Excel)

 Copy code hover
[image]

Page.CenterFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be center aligned in the page footer.

Version Information

Version Added: Excel 2007

Syntax

expression .CenterFooter

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.CenterHeader Property (Excel)

 Copy code hover
[image]

Page.CenterHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be center aligned in the page header.

Version Information

Version Added: Excel 2007

Syntax

expression .CenterHeader

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.LeftFooter Property (Excel)

 Copy code hover
[image]

Page.LeftFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be left aligned in the page footer.

Version Information

Version Added: Excel 2007

Syntax

expression .LeftFooter

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.LeftHeader Property (Excel)

 Copy code hover
[image]

Page.LeftHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be left aligned in the page header.

Version Information

Version Added: Excel 2007

Syntax

expression .LeftHeader

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.RightFooter Property (Excel)

 Copy code hover
[image]

Page.RightFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be right aligned in the page footer.

Version Information

Version Added: Excel 2007

Syntax

expression .RightFooter

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.RightHeader Property (Excel)

 Copy code hover
[image]

Page.RightHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a picture or text to be right aligned in the page header.

Version Information

Version Added: Excel 2007

Syntax

expression .RightHeader

expression A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Pages Object (Excel)

 Copy code hover
[image]

Pages Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of pages in a document. Use the Pages collection and the related objects and properties for programmatically defining page layout in a workbook.

Version Information

Version Added: Excel 2007

Remarks

Use the Pages property to return a Pages collection. The following example accesses all pages in the active worksheet.

VBA Copy code Copy code
Dim objPages As Pages

Set objPage = ActiveWorksheet. _
 ActiveWindow.Panes(1).Pages

Use the Item method to access an individual Page object that represents an individual page in a worksheet. The following example accesses the first page in the active worksheet.

VBA Copy code Copy code
Dim objPage As Page

Set objPage = ActiveWorksheet.ActiveWindow _
 .Panes(1).Pages.Item(1)

See also

Concepts

Excel Object Model Reference

Other resources

Pages Object Members


Pages Members (Excel)

 Copy code hover
[image]

Pages Members (Excel)
Send feedback

Published: July 16, 2012

A collection of pages in a document. Use the Pages collection and the related objects and properties for programmatically defining page layout in a workbook.

Properties

Name | Description
Count | Returns the number of objects in the collection. Read-only Long.
Item | Returns a Page object that represents a collection of pages in a workbook. Read-only.


Pages Properties (Excel)

 Copy code hover
[image]

Pages Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in the collection. Read-only Long.
Item | Returns a Page object that represents a collection of pages in a workbook. Read-only.


Pages.Count Property (Excel)

 Copy code hover
[image]

Pages.Count Property (Excel)
See also Send feedback

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a Pages object.

See also

Concepts

Pages Object

Other resources

Pages Object Members


Pages.Item Property (Excel)

 Copy code hover
[image]

Pages.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Page object that represents a collection of pages in a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the page.

See also

Concepts

Pages Object

Other resources

Pages Object Members


PageSetup Object (Excel)

 Copy code hover
[image]

PageSetup Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the page setup description.

Remarks

The PageSetup object contains all page setup attributes (left margin, bottom margin, paper size, and so on) as properties.

Example

Use the PageSetup property to return a PageSetup object. The following example sets the orientation to landscape mode and then prints the worksheet.

VBA Copy code Copy code
With Worksheets("Sheet1")
 .PageSetup.Orientation = xlLandscape
 .PrintOut
End With

The With statement makes it easier and faster to set several properties at the same time. The following example sets all the margins for worksheet one.

VBA Copy code Copy code
With Worksheets(1).PageSetup
 .LeftMargin = Application.InchesToPoints(0.5)
 .RightMargin = Application.InchesToPoints(0.75)
 .TopMargin = Application.InchesToPoints(1.5)
 .BottomMargin = Application.InchesToPoints(1)
 .HeaderMargin = Application.InchesToPoints(0.5)
 .FooterMargin = Application.InchesToPoints(0.5)
End With

See also

Concepts

Excel Object Model Reference

Other resources

PageSetup Object Members


PageSetup Members (Excel)

 Copy code hover
[image]

PageSetup Members (Excel)
Send feedback

Published: July 16, 2012

Represents the page setup description.

Properties

Name | Description
AlignMarginsHeaderFooter | Returns True for Excel to align the header and the footer with the margins set in the page setup options. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BlackAndWhite | True if elements of the document will be printed in black and white. Read/write Boolean.
BottomMargin | Returns or sets the size of the bottom margin, in points. Read/write Double.
CenterFooter | Center aligns the footer information in the PageSetup object. Read/write String.
CenterFooterPicture | Returns a Graphic object that represents the picture for the center section of the footer. Used to set attributes about the picture.
CenterHeader | Center aligns the header information in the PageSetup object. Read/write String.
CenterHeaderPicture | Returns a Graphic object that represents the picture for the center section of the header. Used to set attributes about the picture.
CenterHorizontally | True if the sheet is centered horizontally on the page when it's printed. Read/write Boolean.
CenterVertically | True if the sheet is centered vertically on the page when it's printed. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DifferentFirstPageHeaderFooter | True if a different header or footer is used on the first page. Read/write Boolean.
Draft | True if the sheet will be printed without graphics. Read/write Boolean.
EvenPage | Returns or sets the alignment of text on the even page of a workbook or section.
FirstPage | Returns or sets the alignment of text on the first page of a workbook or section.
FirstPageNumber | Returns or sets the first page number that will be used when this sheet is printed. If xlAutomatic, Microsoft Excel chooses the first page number. The default is xlAutomatic. Read/write Long.
FitToPagesTall | Returns or sets the number of pages tall the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.
FitToPagesWide | Returns or sets the number of pages wide the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.
FooterMargin | Returns or sets the distance from the bottom of the page to the footer, in points. Read/write Double.
HeaderMargin | Returns or sets the distance from the top of the page to the header, in points. Read/write Double.
LeftFooter | Returns or sets the alignment of text on the left footer of a workbook or section.
LeftFooterPicture | Returns a Graphic object that represents the picture for the left section of the footer. Used to set attributes about the picture.
LeftHeader | Returns or sets the alignment of text on the left header of a workbook or section.
LeftHeaderPicture | Returns a Graphic object that represents the picture for the left section of the header. Used to set attributes about the picture.
LeftMargin | Returns or sets the size of the left margin, in points. Read/write Double.
OddAndEvenPagesHeaderFooter | True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Boolean.
Order | Returns or sets a XlOrder value that represents the order that Microsoft Excel uses to number pages when printing a large worksheet.
Orientation | Returns or sets a XlPageOrientation value that represents the portrait or landscape printing mode.
Pages | Returns or sets the count or item number of the pages in Pages collection.
PaperSize | Returns or sets the size of the paper. Read/write XlPaperSize.
Parent | Returns the parent object for the specified object. Read-only.
PrintArea | Returns or sets the range to be printed, as a string using A1-style references in the language of the macro. Read/write String.
PrintComments | Returns or sets the way comments are printed with the sheet. Read/write XlPrintLocation.
PrintErrors | Sets or returns an XlPrintErrors contstant specifying the type of print error displayed. This feature allows users to suppress the display of error values when printing a worksheet. Read/write .
PrintGridlines | True if cell gridlines are printed on the page. Applies only to worksheets. Read/write Boolean.
PrintHeadings | True if row and column headings are printed with this page. Applies only to worksheets. Read/write Boolean.
PrintNotes | True if cell notes are printed as end notes with the sheet. Applies only to worksheets. Read/write Boolean.
PrintQuality | Returns or sets the print quality. Read/write Variant.
PrintTitleColumns | Returns or sets the columns that contain the cells to be repeated on the left side of each page, as a string in A1-style notation in the language of the macro. Read/write String.
PrintTitleRows | Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string in A1-style notation in the language of the macro. Read/write String.
RightFooter | Returns or sets the distance (in points) between the right edge of the page and the right boundary of the footer. Read/write String.
RightFooterPicture | Returns a Graphic object that represents the picture for the right section of the footer. Used to set attributes of the picture.
RightHeader | Returns or sets the right part of the header. Read/write String.
RightHeaderPicture | Specifies the graphic image that should be displayed in the right header. Read-only.
RightMargin | Returns or sets the size of the right margin, in points. Read/write Double.
ScaleWithDocHeaderFooter | Returns or sets if the header and footer should be scaled with the document when the size of the document changes. Read/write Boolean.
TopMargin | Returns or sets the size of the top margin, in points. Read/write Double.
Zoom | Returns or sets a Variant value that represents a percentage (between 10 and 400 percent) by which Microsoft Excel will scale the worksheet for printing.


PageSetup Properties (Excel)

 Copy code hover
[image]

PageSetup Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignMarginsHeaderFooter | Returns True for Excel to align the header and the footer with the margins set in the page setup options. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BlackAndWhite | True if elements of the document will be printed in black and white. Read/write Boolean.
BottomMargin | Returns or sets the size of the bottom margin, in points. Read/write Double.
CenterFooter | Center aligns the footer information in the PageSetup object. Read/write String.
CenterFooterPicture | Returns a Graphic object that represents the picture for the center section of the footer. Used to set attributes about the picture.
CenterHeader | Center aligns the header information in the PageSetup object. Read/write String.
CenterHeaderPicture | Returns a Graphic object that represents the picture for the center section of the header. Used to set attributes about the picture.
CenterHorizontally | True if the sheet is centered horizontally on the page when it's printed. Read/write Boolean.
CenterVertically | True if the sheet is centered vertically on the page when it's printed. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DifferentFirstPageHeaderFooter | True if a different header or footer is used on the first page. Read/write Boolean.
Draft | True if the sheet will be printed without graphics. Read/write Boolean.
EvenPage | Returns or sets the alignment of text on the even page of a workbook or section.
FirstPage | Returns or sets the alignment of text on the first page of a workbook or section.
FirstPageNumber | Returns or sets the first page number that will be used when this sheet is printed. If xlAutomatic, Microsoft Excel chooses the first page number. The default is xlAutomatic. Read/write Long.
FitToPagesTall | Returns or sets the number of pages tall the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.
FitToPagesWide | Returns or sets the number of pages wide the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.
FooterMargin | Returns or sets the distance from the bottom of the page to the footer, in points. Read/write Double.
HeaderMargin | Returns or sets the distance from the top of the page to the header, in points. Read/write Double.
LeftFooter | Returns or sets the alignment of text on the left footer of a workbook or section.
LeftFooterPicture | Returns a Graphic object that represents the picture for the left section of the footer. Used to set attributes about the picture.
LeftHeader | Returns or sets the alignment of text on the left header of a workbook or section.
LeftHeaderPicture | Returns a Graphic object that represents the picture for the left section of the header. Used to set attributes about the picture.
LeftMargin | Returns or sets the size of the left margin, in points. Read/write Double.
OddAndEvenPagesHeaderFooter | True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Boolean.
Order | Returns or sets a XlOrder value that represents the order that Microsoft Excel uses to number pages when printing a large worksheet.
Orientation | Returns or sets a XlPageOrientation value that represents the portrait or landscape printing mode.
Pages | Returns or sets the count or item number of the pages in Pages collection.
PaperSize | Returns or sets the size of the paper. Read/write XlPaperSize.
Parent | Returns the parent object for the specified object. Read-only.
PrintArea | Returns or sets the range to be printed, as a string using A1-style references in the language of the macro. Read/write String.
PrintComments | Returns or sets the way comments are printed with the sheet. Read/write XlPrintLocation.
PrintErrors | Sets or returns an XlPrintErrors contstant specifying the type of print error displayed. This feature allows users to suppress the display of error values when printing a worksheet. Read/write .
PrintGridlines | True if cell gridlines are printed on the page. Applies only to worksheets. Read/write Boolean.
PrintHeadings | True if row and column headings are printed with this page. Applies only to worksheets. Read/write Boolean.
PrintNotes | True if cell notes are printed as end notes with the sheet. Applies only to worksheets. Read/write Boolean.
PrintQuality | Returns or sets the print quality. Read/write Variant.
PrintTitleColumns | Returns or sets the columns that contain the cells to be repeated on the left side of each page, as a string in A1-style notation in the language of the macro. Read/write String.
PrintTitleRows | Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string in A1-style notation in the language of the macro. Read/write String.
RightFooter | Returns or sets the distance (in points) between the right edge of the page and the right boundary of the footer. Read/write String.
RightFooterPicture | Returns a Graphic object that represents the picture for the right section of the footer. Used to set attributes of the picture.
RightHeader | Returns or sets the right part of the header. Read/write String.
RightHeaderPicture | Specifies the graphic image that should be displayed in the right header. Read-only.
RightMargin | Returns or sets the size of the right margin, in points. Read/write Double.
ScaleWithDocHeaderFooter | Returns or sets if the header and footer should be scaled with the document when the size of the document changes. Read/write Boolean.
TopMargin | Returns or sets the size of the top margin, in points. Read/write Double.
Zoom | Returns or sets a Variant value that represents a percentage (between 10 and 400 percent) by which Microsoft Excel will scale the worksheet for printing.


PageSetup.AlignMarginsHeaderFooter Property (Excel)

 Copy code hover
[image]

PageSetup.AlignMarginsHeaderFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True for Excel to align the header and the footer with the margins set in the page setup options. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AlignMarginsHeaderFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Application Property (Excel)

 Copy code hover
[image]

PageSetup.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PageSetup object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BlackAndWhite Property (Excel)

 Copy code hover
[image]

PageSetup.BlackAndWhite Property (Excel)
See also Send feedback

Published: July 16, 2012

True if elements of the document will be printed in black and white. Read/write Boolean.

Syntax

expression .BlackAndWhite

expression A variable that represents a PageSetup object.

Remarks

This property applies only to worksheet pages.

Example

This example causes Sheet1 to be printed in black and white.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.BlackAndWhite = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BottomMargin Property (Excel)

 Copy code hover
[image]

PageSetup.BottomMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the bottom margin, in points. Read/write Double.

Syntax

expression .BottomMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use either the InchesToPoints method or the CentimetersToPoints method to do the conversion.

Example

These two examples set the bottom margin of Sheet1 to 0.5 inch (36 points).

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.BottomMargin = _
 Application.InchesToPoints(0.5)

Worksheets("Sheet1").PageSetup.BottomMargin = 36

This example displays the current setting for the bottom margin on Sheet1.

VBA Copy code Copy code
marginInches = Worksheets("Sheet1").PageSetup.BottomMargin / _
 Application.InchesToPoints(1)
MsgBox "The current bottom margin is " & marginInches & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterFooter Property (Excel)

 Copy code hover
[image]

PageSetup.CenterFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Center aligns the footer information in the PageSetup object. Read/write String.

Syntax

expression .CenterFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterFooterPicture Property (Excel)

 Copy code hover
[image]

PageSetup.CenterFooterPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Graphic object that represents the picture for the center section of the footer. Used to set attributes about the picture.

Syntax

expression .CenterFooterPicture

expression A variable that represents a PageSetup object.

Remarks

The CenterFooterPicture property is read-only, but the properties on it are not all read-only.

It is required that "&G" is a part of the CenterFooter property string in order for the image to show up in the center footer.

Example

The following example adds a picture titled: Sample.jpg from the C:\ drive to the center section of the footer. This example assumes that a file called Sample.jpg exists on the C:\ drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.CentertFooterPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the center footer.
 ActiveSheet.PageSetup.CenterFooter = "&G"

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterHeader Property (Excel)

 Copy code hover
[image]

PageSetup.CenterHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Center aligns the header information in the PageSetup object. Read/write String.

Syntax

expression .CenterHeader

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterHeaderPicture Property (Excel)

 Copy code hover
[image]

PageSetup.CenterHeaderPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Graphic object that represents the picture for the center section of the header. Used to set attributes about the picture.

Syntax

expression .CenterHeaderPicture

expression A variable that represents a PageSetup object.

Remarks

The CenterHeaderPicture property is read-only, but the properties on it are not all read-only.

It is required that "&G" is a part of the CenterHeader property string in order for the image to show up in the center header.

Example

The following example adds a picture titled: Sample.jpg from the C:\ drive to the center section of the header. This example assumes that a file called Sample.jpg exists on the C:\ drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.CentertHeaderPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the center header.
 ActiveSheet.PageSetup.CenterHeader = "&G"

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterHorizontally Property (Excel)

 Copy code hover
[image]

PageSetup.CenterHorizontally Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the sheet is centered horizontally on the page when it's printed. Read/write Boolean.

Syntax

expression .CenterHorizontally

expression A variable that represents a PageSetup object.

Example

This example centers Sheet1 horizontally when it's printed.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.CenterHorizontally = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CenterVertically Property (Excel)

 Copy code hover
[image]

PageSetup.CenterVertically Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the sheet is centered vertically on the page when it's printed. Read/write Boolean.

Syntax

expression .CenterVertically

expression A variable that represents a PageSetup object.

Example

This example centers Sheet1 vertically when it's printed.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.CenterVertically = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Creator Property (Excel)

 Copy code hover
[image]

PageSetup.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PageSetup object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.DifferentFirstPageHeaderFooter Property (Excel)

 Copy code hover
[image]

PageSetup.DifferentFirstPageHeaderFooter Property (Excel)
See also Send feedback

True if a different header or footer is used on the first page. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DifferentFirstPageHeaderFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Draft Property (Excel)

 Copy code hover
[image]

PageSetup.Draft Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the sheet will be printed without graphics. Read/write Boolean.

Syntax

expression .Draft

expression A variable that represents a PageSetup object.

Remarks

Setting this property to True makes printing faster (at the expense of not printing graphics).

Example

This example turns off graphics printing for Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.Draft = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.EvenPage Property (Excel)

 Copy code hover
[image]

PageSetup.EvenPage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment of text on the even page of a workbook or section.

Version Information

Version Added: Excel 2007

Syntax

expression .EvenPage

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FirstPage Property (Excel)

 Copy code hover
[image]

PageSetup.FirstPage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment of text on the first page of a workbook or section.

Version Information

Version Added: Excel 2007

Syntax

expression .FirstPage

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FirstPageNumber Property (Excel)

 Copy code hover
[image]

PageSetup.FirstPageNumber Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the first page number that will be used when this sheet is printed. If xlAutomatic, Microsoft Excel chooses the first page number. The default is xlAutomatic. Read/write Long.

Syntax

expression .FirstPageNumber

expression A variable that represents a PageSetup object.

Example

This example sets the first page number of Sheet1 to 100.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.FirstPageNumber = 100

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FitToPagesTall Property (Excel)

 Copy code hover
[image]

PageSetup.FitToPagesTall Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of pages tall the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.

Syntax

expression .FitToPagesTall

expression A variable that represents a PageSetup object.

Remarks

If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesWide property.

If the Zoom property is True, the FitToPagesTall property is ignored.

Example

This example causes Microsoft Excel to print Sheet1 exactly one page tall and wide.

VBA Copy code Copy code
With Worksheets("Sheet1").PageSetup
 .Zoom = False
 .FitToPagesTall = 1
 .FitToPagesWide = 1
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FitToPagesWide Property (Excel)

 Copy code hover
[image]

PageSetup.FitToPagesWide Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of pages wide the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.

Syntax

expression .FitToPagesWide

expression A variable that represents a PageSetup object.

Remarks

If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesTall property.

If the Zoom property is True, the FitToPagesWide property is ignored.

Example

This example causes Microsoft Excel to print Sheet1 exactly one page wide and tall.

VBA Copy code Copy code
With Worksheets("Sheet1").PageSetup
 .Zoom = False
 .FitToPagesTall = 1
 .FitToPagesWide = 1
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FooterMargin Property (Excel)

 Copy code hover
[image]

PageSetup.FooterMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance from the bottom of the page to the footer, in points. Read/write Double.

Syntax

expression .FooterMargin

expression A variable that represents a PageSetup object.

Example

This example sets the footer margin of Sheet1 to 0.5 inch.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.FooterMargin = _
 Application.InchesToPoints(0.5)

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.HeaderMargin Property (Excel)

 Copy code hover
[image]

PageSetup.HeaderMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance from the top of the page to the header, in points. Read/write Double.

Syntax

expression .HeaderMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

Example

This example sets the header margin of Sheet1 to 0.5 inch.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.HeaderMargin = _
 Application.InchesToPoints(0.5)

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftFooter Property (Excel)

 Copy code hover
[image]

PageSetup.LeftFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment of text on the left footer of a workbook or section.

Syntax

expression .LeftFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftFooterPicture Property (Excel)

 Copy code hover
[image]

PageSetup.LeftFooterPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Graphic object that represents the picture for the left section of the footer. Used to set attributes about the picture.

Syntax

expression .LeftFooterPicture

expression A variable that represents a PageSetup object.

Remarks

The LeftFooterPicture property is read-only, but the properties on it are not all read-only.

Note Note

It is required that "&G" is a part of the LeftFooter property string in order for the image to show up in the left footer.

Example

The following example adds a picture titled: Sample.jpg from the C:\ drive to the left section of the footer. This example assumes that a file called Sample.jpg exists on the C:\ drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.LeftFooterPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the left footer.
 ActiveSheet.PageSetup.LeftFooter = "&G"

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftHeader Property (Excel)

 Copy code hover
[image]

PageSetup.LeftHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment of text on the left header of a workbook or section.

Syntax

expression .LeftHeader

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftHeaderPicture Property (Excel)

 Copy code hover
[image]

PageSetup.LeftHeaderPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Graphic object that represents the picture for the left section of the header. Used to set attributes about the picture.

Syntax

expression .LeftHeaderPicture

expression A variable that represents a PageSetup object.

Remarks

The LeftHeaderPicture property is read-only, but not all of its properties are read-only.

Note Note

It is required that "&G" be a part of the LeftHeader property string in order for the image to show up in the left header.

Example

The following example adds a picture titled: Sample.jpg from the C: drive to the left section of the header. This example assumes that a file called Sample.jpg exists on the C: drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.LeftHeaderPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the left header.
 ActiveSheet.PageSetup.LeftHeader = "&G"

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftMargin Property (Excel)

 Copy code hover
[image]

PageSetup.LeftMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the left margin, in points. Read/write Double.

Syntax

expression .LeftMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

Example

This example sets the left margin of Sheet1 to 1.5 inches.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.LeftMargin = _
 Application.InchesToPoints(1.5)

This example sets the left margin of Sheet1 to 2 centimeters.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.LeftMargin = _
 Application.CentimetersToPoints(2)

This example displays the current left-margin setting for Sheet1.

VBA Copy code Copy code
marginInches = Worksheets("Sheet1").PageSetup.LeftMargin / _
 Application.InchesToPoints(1)
MsgBox "The current left margin is " & marginInches & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.OddAndEvenPagesHeaderFooter Property (Excel)

 Copy code hover
[image]

PageSetup.OddAndEvenPagesHeaderFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .OddAndEvenPagesHeaderFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Order Property (Excel)

 Copy code hover
[image]

PageSetup.Order Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlOrder value that represents the order that Microsoft Excel uses to number pages when printing a large worksheet.

Syntax

expression .Order

expression A variable that represents a PageSetup object.

Example

This example breaks Sheet1 into pages when the worksheet is printed. Numbering and printing proceed from the first page to the pages to the right, and then move down and continue printing across the sheet.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.Order = xlOverThenDown

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Orientation Property (Excel)

 Copy code hover
[image]

PageSetup.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPageOrientation value that represents the portrait or landscape printing mode.

Syntax

expression .Orientation

expression A variable that represents a PageSetup object.

Example

This example sets Sheet1 to be printed in landscape orientation.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.Orientation = xlLandscape

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Pages Property (Excel)

 Copy code hover
[image]

PageSetup.Pages Property (Excel)
See also Send feedback

Returns or sets the count or item number of the pages in Pages collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Pages

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PaperSize Property (Excel)

 Copy code hover
[image]

PageSetup.PaperSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the paper. Read/write XlPaperSize.

Syntax

expression .PaperSize

expression A variable that represents a PageSetup object.

Remarks

XlPaperSize can be one of these XlPaperSize constants.

xlPaper11x17. 11 in. x 17 in.

xlPaperA4. A4 (210 mm x 297 mm)

xlPaperA5. A5 (148 mm x 210 mm)

xlPaperB5. A5 (148 mm x 210 mm)

xlPaperDsheet. D size sheet

xlPaperEnvelope11. Envelope #11 (4-1/2 in. x 10-3/8 in.)

xlPaperEnvelope14. Envelope #14 (5 in. x 11-1/2 in.)

xlPaperEnvelopeB4. Envelope B4 (250 mm x 353 mm)

xlPaperEnvelopeB6. Envelope B6 (176 mm x 125 mm)

xlPaperEnvelopeC4. Envelope C4 (229 mm x 324 mm)

xlPaperEnvelopeC6. Envelope C6 (114 mm x 162 mm)

xlPaperEnvelopeDL. Envelope DL (110 mm x 220 mm)

xlPaperEnvelopeMonarch. Envelope Monarch (3-7/8 in. x 7-1/2 in.)

xlPaperEsheet. E size sheet

xlPaperFanfoldLegalGerman. German Legal Fanfold (8-1/2 in. x 13 in.)

xlPaperFanfoldUS. U.S. Standard Fanfold (14-7/8 in. x 11 in.)

xlPaperLedger. Ledger (17 in. x 11 in.)

xlPaperLetter. Letter (8-1/2 in. x 11 in.)

xlPaperNote. Note (8-1/2 in. x 11 in.)

xlPaperStatement. Statement (5-1/2 in. x 8-1/2 in.)

xlPaperUser. User-defined

xlPaper10x14. 10 in. x 14 in.

xlPaperA3. A3 (297 mm x 420 mm)

xlPaperA4Small. A4 Small (210 mm x 297 mm)

xlPaperB4. B4 (250 mm x 354 mm)

xlPaperCsheet. C size sheet

xlPaperEnvelope10. Envelope #10 (4-1/8 in. x 9-1/2 in.)

xlPaperEnvelope12. Envelope #12 (4-1/2 in. x 11 in.)

xlPaperEnvelope9. Envelope #9 (3-7/8 in. x 8-7/8 in.)

xlPaperEnvelopeB5. Envelope B5 (176 mm x 250 mm)

xlPaperEnvelopeC3. Envelope C3 (324 mm x 458 mm)

xlPaperEnvelopeC5. Envelope C5 (162 mm x 229 mm)

xlPaperEnvelopeC65. Envelope C65 (114 mm x 229 mm)

xlPaperEnvelopeItaly. Envelope (110 mm x 230 mm)

xlPaperEnvelopePersonal. Envelope (3-5/8 in. x 6-1/2 in.)

xlPaperExecutive. Executive (7-1/2 in. x 10-1/2 in.)

xlPaperFanfoldStdGerman. German Legal Fanfold (8-1/2 in. x 13 in.)

xlPaperFolio. Folio (8-1/2 in. x 13 in.)

xlPaperLegal. Legal (8-1/2 in. x 14 in.)

xlPaperLetterSmall. Letter Small (8-1/2 in. x 11 in.)

xlPaperQuarto. Quarto (215 mm x 275 mm)

xlPaperTabloid. Tabloid (11 in. x 17 in.)

Note Note

Some printers may not support all of these paper sizes.

Example

This example sets the paper size to legal for Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PaperSize = xlPaperLegal

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Parent Property (Excel)

 Copy code hover
[image]

PageSetup.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintArea Property (Excel)

 Copy code hover
[image]

PageSetup.PrintArea Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the range to be printed, as a string using A1-style references in the language of the macro. Read/write String.

Syntax

expression .PrintArea

expression A variable that represents a PageSetup object.

Remarks

Set this property to False or to the empty string ("") to set the print area to the entire sheet.

This property applies only to worksheet pages.

Example

This example sets the print area to cells A1:C5 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$C$5"

This example sets the print area to the current region on Sheet1. Note that you use the Address property to return an A1-style address.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.PrintArea = _
 ActiveCell.CurrentRegion.Address

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintComments Property (Excel)

 Copy code hover
[image]

PageSetup.PrintComments Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way comments are printed with the sheet. Read/write XlPrintLocation.

Syntax

expression .PrintComments

expression A variable that represents a PageSetup object.

Remarks

XlPrintLocation can be one of these XlPrintLocation constants.

xlPrintInPlace

xlPrintNoComments

xlPrintSheetEnd

Example

This example causes comments to be printed as end notes when worksheet one is printed.

VBA Copy code Copy code
Worksheets(1).PageSetup.PrintComments = xlPrintSheetEnd

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintErrors Property (Excel)

 Copy code hover
[image]

PageSetup.PrintErrors Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns an XlPrintErrors contstant specifying the type of print error displayed. This feature allows users to suppress the display of error values when printing a worksheet. Read/write .

Syntax

expression .PrintErrors

expression A variable that represents a PageSetup object.

Remarks

XlPrintErrors can be one of these XlPrintErrors constants.

xlPrintErrorsBlank

xlPrintErrorsDash

xlPrintErrorsDisplayed

xlPrintErrorsNA

Example

In this example, Microsoft Excel uses a formula that returns an error in the active worksheet. The PrintErrors property is set to display dashes. A Print Preview window displays the dashes for the print error. This example assumes a printer driver has been installed.

VBA Copy code Copy code
Sub UsePrintErrors()

 Dim wksOne As Worksheet

 Set wksOne = Application.ActiveSheet

 ' Create a formula that returns an error value.
 Range("A1").Value = 1
 Range("A2").Value = 0
 Range("A3").Formula = "=A1/A2"

 ' Change print errors to display dashes.
 wksOne.PageSetup.PrintErrors = xlPrintErrorsDash

 ' Use the Print Preview window to see the dashes used for print errors.
 ActiveWindow.SelectedSheets.PrintPreview

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintGridlines Property (Excel)

 Copy code hover
[image]

PageSetup.PrintGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if cell gridlines are printed on the page. Applies only to worksheets. Read/write Boolean.

Syntax

expression .PrintGridlines

expression A variable that represents a PageSetup object.

Example

This example prints cell gridlines when Sheet1 is printed.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PrintGridlines = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintHeadings Property (Excel)

 Copy code hover
[image]

PageSetup.PrintHeadings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if row and column headings are printed with this page. Applies only to worksheets. Read/write Boolean.

Syntax

expression .PrintHeadings

expression A variable that represents a PageSetup object.

Remarks

The DisplayHeadings property controls the on-screen display of headings.

Example

This example turns off the printing of headings for Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PrintHeadings = False

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintNotes Property (Excel)

 Copy code hover
[image]

PageSetup.PrintNotes Property (Excel)
See also Send feedback

Published: July 16, 2012

True if cell notes are printed as end notes with the sheet. Applies only to worksheets. Read/write Boolean.

Syntax

expression .PrintNotes

expression A variable that represents a PageSetup object.

Remarks

Use the PrintComments property to print comments as text boxes or end notes.

Example

This example turns off the printing of notes.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PrintNotes = False

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintQuality Property (Excel)

 Copy code hover
[image]

PageSetup.PrintQuality Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the print quality. Read/write Variant.

Syntax

expression .PrintQuality(Index)

expression A variable that represents a PageSetup object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | Horizontal print quality (1) or vertical print quality (2). Some printers may not support vertical print quality. If you don't specify this argument, the PrintQuality property returns (or can be set to) a two-element array that contains both horizontal and vertical print quality.

Example

This example sets the print quality on a printer with non-square pixels. The array specifies both horizontal and vertical print quality. This example may cause an error, depending on the printer driver you're using.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.PrintQuality = Array(240, 140)

This example displays the current setting for horizontal print quality.

VBA Copy code Copy code
MsgBox "Horizontal Print Quality is " & _
 Worksheets("Sheet1").PageSetup.PrintQuality(1)

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintTitleColumns Property (Excel)

 Copy code hover
[image]

PageSetup.PrintTitleColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the columns that contain the cells to be repeated on the left side of each page, as a string in A1-style notation in the language of the macro. Read/write String.

Syntax

expression .PrintTitleColumns

expression A variable that represents a PageSetup object.

Remarks

If you specify only part of a column or columns, Microsoft Excel expands the range to full columns.

Set this property to False or to the empty string ("") to turn off title columns.

This property applies only to worksheet pages.

Example

This example defines row three as the title row, and it defines columns one through three as the title columns.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.PrintTitleRows = ActiveSheet.Rows(3).Address
ActiveSheet.PageSetup.PrintTitleColumns = _
 ActiveSheet.Columns("A:C").Address

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PrintTitleRows Property (Excel)

 Copy code hover
[image]

PageSetup.PrintTitleRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string in A1-style notation in the language of the macro. Read/write String.

Syntax

expression .PrintTitleRows

expression A variable that represents a PageSetup object.

Remarks

If you specify only part of a row or rows, Microsoft Excel expands the range to full rows.

Set this property to False or to the empty string ("") to turn off title rows.

This property applies only to worksheet pages.

Example

This example defines row three as the title row, and it defines columns one through three as the title columns.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.PrintTitleRows = ActiveSheet.Rows(3).Address
ActiveSheet.PageSetup.PrintTitleColumns = _
 ActiveSheet.Columns("A:C").Address

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightFooter Property (Excel)

 Copy code hover
[image]

PageSetup.RightFooter Property (Excel)
See also Send feedback

Returns or sets the distance (in points) between the right edge of the page and the right boundary of the footer. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .RightFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightFooterPicture Property (Excel)

 Copy code hover
[image]

PageSetup.RightFooterPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Graphic object that represents the picture for the right section of the footer. Used to set attributes of the picture.

Syntax

expression .RightFooterPicture

expression A variable that represents a PageSetup object.

Remarks

The RightFooterPicture property itself is read-only, but not all of its properties are read-only.

Example

The following example adds a picture titled Sample.jpg from the C: drive to the right section of the footer. This example assumes that a file called Sample.jpg exists on the C: drive.

VBA Copy code Copy code
Sub InsertPicture()

 With ActiveSheet.PageSetup.RightFooterPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With

 ' Enable the image to show up in the right footer.
 ActiveSheet.PageSetup.RightFooter = "&G"

End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightHeader Property (Excel)

 Copy code hover
[image]

PageSetup.RightHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the right part of the header. Read/write String.

Syntax

expression .RightHeader

expression A variable that represents a PageSetup object.

Example

This example prints the file name in the upper-right corner of every page.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.RightHeader = "&F"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightHeaderPicture Property (Excel)

 Copy code hover
[image]

PageSetup.RightHeaderPicture Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the graphic image that should be displayed in the right header. Read-only.

Syntax

expression .RightHeaderPicture

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightMargin Property (Excel)

 Copy code hover
[image]

PageSetup.RightMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the right margin, in points. Read/write Double.

Syntax

expression .RightMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

Example

This example sets the right margin of Sheet1 to 1.5 inches.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.RightMargin = _
 Application.InchesToPoints(1.5)

This example sets the right margin of Sheet1 to 2 centimeters.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.RightMargin = _
 Application.CentimetersToPoints(2)

This example displays the current right-margin setting for Sheet1.

VBA Copy code Copy code
marginInches = Worksheets("Sheet1").PageSetup.RightMargin / _
 Application.InchesToPoints(1)
MsgBox "The current right margin is " & marginInches & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.ScaleWithDocHeaderFooter Property (Excel)

 Copy code hover
[image]

PageSetup.ScaleWithDocHeaderFooter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the header and footer should be scaled with the document when the size of the document changes. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ScaleWithDocHeaderFooter

expression A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.TopMargin Property (Excel)

 Copy code hover
[image]

PageSetup.TopMargin Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the top margin, in points. Read/write Double.

Syntax

expression .TopMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

Example

These two examples set the top margin of Sheet1 to 0.5 inch (36 points).

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.TopMargin = _
 Application.InchesToPoints(0.5)

Worksheets("Sheet1").PageSetup.TopMargin = 36

This example displays the current top-margin setting.

VBA Copy code Copy code
marginInches = ActiveSheet.PageSetup.TopMargin / _
 Application.InchesToPoints(1)
MsgBox "The current top margin is " & marginInches & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Zoom Property (Excel)

 Copy code hover
[image]

PageSetup.Zoom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents a percentage (between 10 and 400 percent) by which Microsoft Excel will scale the worksheet for printing.

Syntax

expression .Zoom

expression A variable that represents a PageSetup object.

Remarks

This property applies only to worksheets.

If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.

All scaling retains the aspect ratio of the original document.

Example

This example scales Sheet1 by 150 percent when the worksheet is printed.

VBA Copy code Copy code
Worksheets("Sheet1").PageSetup.Zoom = 150

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


Pane Object (Excel)

 Copy code hover
[image]

Pane Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a pane of a window.

Remarks

Pane objects exist only for worksheets and Microsoft Excel 4.0 macro sheets. The Pane object is a member of the Panes collection. The Panes collection contains all of the panes shown in a single window.

Example

Use Panes(index), where index is the pane index number, to return a single Pane object. The following example splits the window in which worksheet one is displayed and then scrolls through the pane in the lower-left corner until row five is at the top of the pane.

VBA Copy code Copy code
Worksheets(1).Activate
ActiveWindow.Split = True
ActiveWindow.Panes(3).ScrollRow = 5

See also

Concepts

Excel Object Model Reference

Other resources

Pane Object Members


Pane Members (Excel)

 Copy code hover
[image]

Pane Members (Excel)
Send feedback

Published: July 16, 2012

Represents a pane of a window.

Methods

Name | Description
Activate | Activates the pane.
LargeScroll | Scrolls the contents of the window by pages.
PointsToScreenPixelsX | Returns or sets a pixel point on the screen.
PointsToScreenPixelsY | Returns or sets the location of the pixel on the screen.
ScrollIntoView | Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).
SmallScroll | Scrolls the contents of the window by rows or columns.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Parent | Returns the parent object for the specified object. Read-only.
ScrollColumn | Returns or sets the number of the leftmost column in the pane or window. Read/write Long.
ScrollRow | Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.
VisibleRange | Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.


Pane Properties (Excel)

 Copy code hover
[image]

Pane Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Parent | Returns the parent object for the specified object. Read-only.
ScrollColumn | Returns or sets the number of the leftmost column in the pane or window. Read/write Long.
ScrollRow | Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.
VisibleRange | Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.


Pane.Application Property (Excel)

 Copy code hover
[image]

Pane.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Pane object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Creator Property (Excel)

 Copy code hover
[image]

Pane.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Pane object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Index Property (Excel)

 Copy code hover
[image]

Pane.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Parent Property (Excel)

 Copy code hover
[image]

Pane.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.ScrollColumn Property (Excel)

 Copy code hover
[image]

Pane.ScrollColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the leftmost column in the pane or window. Read/write Long.

Syntax

expression .ScrollColumn

expression A variable that represents a Pane object.

Remarks

If the window is split, the ScrollColumn property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollColumn property of the Window object excludes the frozen areas.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.ScrollRow Property (Excel)

 Copy code hover
[image]

Pane.ScrollRow Property (Excel)
See also Send feedback

Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.

Syntax

expression .ScrollRow

expression A variable that represents a Pane object.

Remarks

If the window is split, the ScrollRow property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollRow property of the Window object excludes the frozen areas.

Example

This example moves row ten to the top of the window.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWindow.ScrollRow = 10

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.VisibleRange Property (Excel)

 Copy code hover
[image]

Pane.VisibleRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.

Syntax

expression .VisibleRange

expression A variable that represents a Pane object.

Example

This example displays the number of cells visible on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "There are " & Windows(1).VisibleRange.Cells.Count _
 & " cells visible"

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane Methods (Excel)

 Copy code hover
[image]

Pane Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the pane.
LargeScroll | Scrolls the contents of the window by pages.
PointsToScreenPixelsX | Returns or sets a pixel point on the screen.
PointsToScreenPixelsY | Returns or sets the location of the pixel on the screen.
ScrollIntoView | Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).
SmallScroll | Scrolls the contents of the window by rows or columns.


Pane.Activate Method (Excel)

 Copy code hover
[image]

Pane.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the pane.

Syntax

expression .Activate

expression A variable that represents a Pane object.

Return Value

Boolean

Remarks

If the pane isn't in the active window, the window that the pane belongs to will also be activated. You cannot activate a frozen pane.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.LargeScroll Method (Excel)

 Copy code hover
[image]

Pane.LargeScroll Method (Excel)
See also Send feedback

Scrolls the contents of the window by pages.

Syntax

expression .LargeScroll(Down, Up, ToRight, ToLeft)

expression A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of pages to scroll the contents down.
Up | Optional | Variant | The number of pages to scroll the contents up.
ToRight | Optional | Variant | The number of pages to scroll the contents to the right.
ToLeft | Optional | Variant | The number of pages to scroll the contents to the left.

Return Value

Variant

Remarks

If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three pages.

If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three pages.

Any of the arguments can be a negative number.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.PointsToScreenPixelsX Method (Excel)

 Copy code hover
[image]

Pane.PointsToScreenPixelsX Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a pixel point on the screen.

Version Information

Version Added: Excel 2007

Syntax

expression .PointsToScreenPixelsX(Points)

expression A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Long | Location of the pixel on the screen.

Return Value

Long

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.PointsToScreenPixelsY Method (Excel)

 Copy code hover
[image]

Pane.PointsToScreenPixelsY Method (Excel)
See also Send feedback

Returns or sets the location of the pixel on the screen.

Version Information

Version Added: Excel 2007

Syntax

expression .PointsToScreenPixelsY(Points)

expression A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Long | Location of the starting point.

Return Value

Long

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.ScrollIntoView Method (Excel)

 Copy code hover
[image]

Pane.ScrollIntoView Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).

Syntax

expression .ScrollIntoView(Left, Top, Width, Height, Start)

expression A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Long | The horizontal position of the rectangle (in points) from the left edge of the document window or pane.
Top | Required | Long | The vertical position of the rectangle (in points) from the top of the document window or pane.
Width | Required | Long | The width of the rectangle, in points.
Height | Required | Long | The height of the rectangle, in points.
Start | Optional | Variant | True to have the upper-left corner of the rectangle appear in the upper-left corner of the document window or pane. False to have the lower-right corner of the rectangle appear in the lower-right corner of the document window or pane. The default value is True.

Remarks

The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.

Example

This example defines a 100-by-200-pixel rectangle in the active document window, positioned 20 pixels from the top of the window and 50 pixels from the left edge of the window.The example then scrolls the document up and to the left so that the upper-left corner of the rectangle is aligned with the upper-left corner of the window.

VBA Copy code Copy code
ActiveWindow.ScrollIntoView _
 Left:=50, Top:=20, _
 Width:=100, Height:=200

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.SmallScroll Method (Excel)

 Copy code hover
[image]

Pane.SmallScroll Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls the contents of the window by rows or columns.

Syntax

expression .SmallScroll(Down, Up, ToRight, ToLeft)

expression A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of rows to scroll the contents down.
Up | Optional | Variant | The number of rows to scroll the contents up.
ToRight | Optional | Variant | The number of columns to scroll the contents to the right.
ToLeft | Optional | Variant | The number of columns to scroll the contents to the left.

Return Value

Variant

Remarks

If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three rows.

If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three columns.

Any of these arguments can be a negative number.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Panes Object (Excel)

 Copy code hover
[image]

Panes Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Pane objects shown in the specified window.

Remarks

Pane objects exist only for worksheets and Microsoft Excel 4.0 macro sheets.

Example

Use the Panes property to return the Panes collection. The following example freezes panes in the active window if the window contains more than one pane.

VBA Copy code Copy code
If ActiveWindow.Panes.Count > 1 Then _
 ActiveWindow.FreezePanes = True

Use Panes(index), where index is the pane index number, to return a single Pane object. The following example scrolls through the upper-left pane of the window in which Sheet1 is displayed.

VBA Copy code Copy code
Worksheets("sheet1").Activate
Windows(1).Panes(1).LargeScroll down:=1

See also

Concepts

Excel Object Model Reference

Other resources

Panes Object Members


Panes Members (Excel)

 Copy code hover
[image]

Panes Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Pane objects shown in the specified window.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Panes Properties (Excel)

 Copy code hover
[image]

Panes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Panes.Application Property (Excel)

 Copy code hover
[image]

Panes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Panes object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Panes Object

Other resources

Panes Object Members


Panes.Count Property (Excel)

 Copy code hover
[image]

Panes.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Panes object.

See also

Concepts

Panes Object

Other resources

Panes Object Members


Panes.Creator Property (Excel)

 Copy code hover
[image]

Panes.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Panes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Panes Object

Other resources

Panes Object Members


Panes.Item Property (Excel)

 Copy code hover
[image]

Panes.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Panes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example splits the window in which worksheet one is displayed and then scrolls through the pane in the lower-left corner of the window until row five is at the top of the pane.

VBA Copy code Copy code
Worksheets(1).Activate
ActiveWindow.Split = True
ActiveWindow.Panes.Item(3).ScrollRow = 5

See also

Concepts

Panes Object

Other resources

Panes Object Members


Panes.Parent Property (Excel)

 Copy code hover
[image]

Panes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Panes object.

See also

Concepts

Panes Object

Other resources

Panes Object Members


Parameter Object (Excel)

 Copy code hover
[image]

Parameter Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single parameter used in a parameter query.

Remarks

The Parameter object is a member of the Parameters collection.

Example

Use Parameters(index), where index is the index number of the parameter, to return a single Parameter object. The following example modifies the prompt string for parameter one.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1).Parameters(1)
 .SetParam xlPrompt, "Please " & .PromptString
End With

See also

Concepts

Excel Object Model Reference

Other resources

Parameter Object Members


Parameter Members (Excel)

 Copy code hover
[image]

Parameter Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single parameter used in a parameter query.

Methods

Name | Description
SetParam | Defines a parameter for the specified query table.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataType | Returns or sets a XlParameterDataType value that represents the data type of the specified query parameter.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PromptString | Returns the phrase that prompts the user for a parameter value in a parameter query. Read-only String.
RefreshOnChange | True if the specified query table is refreshed whenever you change the parameter value of a parameter query. Read/write Boolean.
SourceRange | Returns a Range object that represents the cell that contains the value of the specified query parameter. Read-only.
Type | Returns a XlParameterType value that represents the parameter type.
Value | Returns a Variant value that represents the parameter value.


Parameter Properties (Excel)

 Copy code hover
[image]

Parameter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataType | Returns or sets a XlParameterDataType value that represents the data type of the specified query parameter.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PromptString | Returns the phrase that prompts the user for a parameter value in a parameter query. Read-only String.
RefreshOnChange | True if the specified query table is refreshed whenever you change the parameter value of a parameter query. Read/write Boolean.
SourceRange | Returns a Range object that represents the cell that contains the value of the specified query parameter. Read-only.
Type | Returns a XlParameterType value that represents the parameter type.
Value | Returns a Variant value that represents the parameter value.


Parameter.Application Property (Excel)

 Copy code hover
[image]

Parameter.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Parameter object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.Creator Property (Excel)

 Copy code hover
[image]

Parameter.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Parameter object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.DataType Property (Excel)

 Copy code hover
[image]

Parameter.DataType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlParameterDataType value that represents the data type of the specified query parameter.

Syntax

expression .DataType

expression A variable that represents a Parameter object.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.Name Property (Excel)

 Copy code hover
[image]

Parameter.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Parameter object.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.Parent Property (Excel)

 Copy code hover
[image]

Parameter.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Parameter object.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.PromptString Property (Excel)

 Copy code hover
[image]

Parameter.PromptString Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the phrase that prompts the user for a parameter value in a parameter query. Read-only String.

Syntax

expression .PromptString

expression A variable that represents a Parameter object.

Example

This example modifies the parameter prompt string for query table one.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1).Parameters(1)
 .SetParam xlPrompt, "Please " & .PromptString
End With

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.RefreshOnChange Property (Excel)

 Copy code hover
[image]

Parameter.RefreshOnChange Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified query table is refreshed whenever you change the parameter value of a parameter query. Read/write Boolean.

Syntax

expression .RefreshOnChange

expression A variable that represents a Parameter object.

Remarks

You can set this property to True only if you use parameters of type xlRange and if the referenced parameter value is in a single cell. The refresh occurs when you change the value of the cell.

Example

This example changes the SQL statement for the first query table on Sheet1. The clause "(ContactTitle=?)" indicates that the query is a parameter query, and the value of the title is set to the value of cell D4. The query table will be automatically refreshed whenever the value of this cell changes.

VBA Copy code Copy code
Set objQT = Worksheets("Sheet1").QueryTables(1)
objQT.CommandText = "Select * From Customers Where (ContactTitle=?)"
Set objParam1 = objQT.Parameters _
 .Add("Contact Title", xlParamTypeVarChar)
objParam1.RefreshOnChange = True
objParam1.SetParam xlRange, Range("D4")

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.SourceRange Property (Excel)

 Copy code hover
[image]

Parameter.SourceRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that contains the value of the specified query parameter. Read-only.

Syntax

expression .SourceRange

expression A variable that represents a Parameter object.

Example

This example changes the value of the cell used as the source range for the query.

VBA Copy code Copy code
Set qt = Sheets("sheet1").QueryTables(1)
Set param1 = qt.Parameters(1)
Set r = param1.SourceRange
r.Value = "New York"
qt.Refresh

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.Type Property (Excel)

 Copy code hover
[image]

Parameter.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlParameterType value that represents the parameter type.

Syntax

expression .Type

expression A variable that represents a Parameter object.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter.Value Property (Excel)

 Copy code hover
[image]

Parameter.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the parameter value.

Syntax

expression .Value

expression A variable that represents a Parameter object.

Remarks

For more information, see the Parameter object.

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameter Methods (Excel)

 Copy code hover
[image]

Parameter Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
SetParam | Defines a parameter for the specified query table.


Parameter.SetParam Method (Excel)

 Copy code hover
[image]

Parameter.SetParam Method (Excel)
See also Send feedback

Published: July 16, 2012

Defines a parameter for the specified query table.

Syntax

expression .SetParam(Type, Value)

expression A variable that represents a Parameter object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlParameterType | One of the constants of XlParameterType which specifies the parameter type.
Value | Required | Variant | The value of the specified parameter, as shown in the description of the Type argument.

Remarks

XlParameterType can be one of these XlParameterType constants.

xlConstant. Uses the value specified by the Value argument.

xlPrompt. Displays a dialog box that prompts the user for the value. The Value argument specifies the text shown in the dialog box.

xlRange. Uses the value of the cell in the upper-left corner of the range. The Value argument specifies a Range object

Example

This example changes the SQL statement for query table one. The clause "(city=?)" indicates that the query is a parameter query, and the example sets the value of city to the constant "Oakland."

VBA Copy code Copy code
Set qt = Sheets("sheet1").QueryTables(1)
qt.Sql = "SELECT * FROM authors WHERE (city=?)"
Set param1 = qt.Parameters.Add("City Parameter", _
 xlParamTypeVarChar)
param1.SetParam xlConstant, "Oakland"
qt.Refresh

See also

Concepts

Parameter Object

Other resources

Parameter Object Members


Parameters Object (Excel)

 Copy code hover
[image]

Parameters Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of Parameter objects for the specified query table.

Remarks

Each Parameter object represents a single query parameter. Every query table contains a Parameters collection, but the collection is empty unless the query table is using a parameter query.

You cannot use the Add method on a URL connection query table. For URL connection query tables, Microsoft Excel creates the parameters based on the Connection and PostText properties.

Example

Use the Parameters property to return the Parameters collection. The following example displays the number of parameters in query table one.

VBA Copy code Copy code
MsgBox Workbooks(1).ActiveSheet.QueryTables(1).Parameters.Count

Use the Add method to create a new parameter for a query table. The following example changes the SQL statement for query table one. The clause "(city=?)" indicates that the query is a parameter query, and the value of city is set to the constant "Oakland."

VBA Copy code Copy code
Set qt = Sheets("sheet1").QueryTables(1)
qt.Sql = "SELECT * FROM authors WHERE (city=?)"
Set param1 = qt.Parameters.Add("City Parameter", _
 xlParamTypeVarChar)
param1.SetParam xlConstant, "Oakland"
qt.Refresh

See also

Concepts

Excel Object Model Reference

Other resources

Parameters Object Members


Parameters Members (Excel)

 Copy code hover
[image]

Parameters Members (Excel)
Send feedback

Published: July 16, 2012

A collection of Parameter objects for the specified query table.

Methods

Name | Description
Add | Creates a new query parameter.
Delete | Deletes the object.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Parameters Properties (Excel)

 Copy code hover
[image]

Parameters Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Parameters.Application Property (Excel)

 Copy code hover
[image]

Parameters.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Parameters object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters.Count Property (Excel)

 Copy code hover
[image]

Parameters.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Parameters object.

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters.Creator Property (Excel)

 Copy code hover
[image]

Parameters.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Parameters object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters.Parent Property (Excel)

 Copy code hover
[image]

Parameters.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Parameters object.

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters Methods (Excel)

 Copy code hover
[image]

Parameters Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new query parameter.
Delete | Deletes the object.
Item | Returns a single object from a collection.


Parameters.Add Method (Excel)

 Copy code hover
[image]

Parameters.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new query parameter.

Syntax

expression .Add(Name, iDataType)

expression A variable that represents a Parameters object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the specified parameter. The parameter name should match the parameter clause in the SQL statement.
iDataType | Optional | Variant | The data type of the parameter. Can be any XlParameterDataType constant. These values correspond to ODBC data types. They indicate the type of value the ODBC driver is expecting to receive. Microsoft Excel and the ODBC driver manager will coerce the parameter value given in Microsoft Excel into the correct data type for the driver.

Return Value

A Parameter object that represents the new query parameter.

Example

This example changes the SQL statement for query table one. The clause "(city=?)" indicates that the query is a parameter query, and the value of city is set to the constant "Oakland."

VBA Copy code Copy code
Set qt = Sheets("sheet1").QueryTables(1)
qt.Sql = "SELECT * FROM authors WHERE (city=?)"
Set param1 = qt.Parameters.Add("City Parameter", _
 xlParamTypeVarChar)
param1.SetParam xlConstant, "Oakland"
qt.Refresh

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters.Delete Method (Excel)

 Copy code hover
[image]

Parameters.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Parameters object.

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Parameters.Item Method (Excel)

 Copy code hover
[image]

Parameters.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Parameters object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Parameter object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example modifies the parameter prompt string.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1).Parameters.Item(1)
 .SetParam xlPrompt, "Please " & .PromptString
End With

See also

Concepts

Parameters Object

Other resources

Parameters Object Members


Phonetic Object (Excel)

 Copy code hover
[image]

Phonetic Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains information about a specific phonetic text string in a cell.

Remarks

In Microsoft Excel 97, this object contained the formatting attributes for any phonetic text in the specified range.

Example

Use Phonetics(index), where index is the index number of the phonetic text, to return a single Phonetic object. The following example sets the first phonetic text string in the active cell to "フリガナ".

VBA Copy code Copy code
ActiveCell.Phonetics(1).Text = "フリガナ"

The Phonetic property provides compatibility with earlier versions of Microsoft Excel. You should use Phonetics(index), where index is the index number of the phonetic text, to return a single Phonetic object. To demonstrate compatibility with earlier versions of Microsoft Excel, the following example adds Furigana characters to the range A1:C4. If you add Furigana characters to a range, a new Phonetic object is automatically created.

VBA Copy code Copy code
With Range("A1:C4").Phonetic
    .CharacterType = xlHiragana
    .Alignment = xlPhoneticAlignCenter
    .Font.Name = "MS P ゴシック"
    .Font.FontStyle = "標準"
    .Font.Size = 6
    .Font.Strikethrough = False
    .Font.Underline = xlUnderlineStyleNone
    .Font.ColorIndex = xlAutomatic
    .Visible = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

Phonetic Object Members


Phonetic Members (Excel)

 Copy code hover
[image]

Phonetic Members (Excel)
Send feedback

Published: July 16, 2012

Contains information about a specific phonetic text string in a cell.

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CharacterType | Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Parent | Returns the parent object for the specified object. Read-only.
Text | Returns or sets the text for the specified object. Read/write String.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Phonetic Properties (Excel)

 Copy code hover
[image]

Phonetic Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CharacterType | Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Parent | Returns the parent object for the specified object. Read-only.
Text | Returns or sets the text for the specified object. Read/write String.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Phonetic.Alignment Property (Excel)

 Copy code hover
[image]

Phonetic.Alignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.

Syntax

expression .Alignment

expression A variable that represents a Phonetic object.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Application Property (Excel)

 Copy code hover
[image]

Phonetic.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Phonetic object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.CharacterType Property (Excel)

 Copy code hover
[image]

Phonetic.CharacterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.

Syntax

expression .CharacterType

expression A variable that represents a Phonetic object.

Example

This example changes the first phonetic text string in the active cell from Furigana to Hiragana.

VBA Copy code Copy code
ActiveCell.Phonetics(1).CharacterType = xlHiragana

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Creator Property (Excel)

 Copy code hover
[image]

Phonetic.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Phonetic object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Font Property (Excel)

 Copy code hover
[image]

Phonetic.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a Phonetic object.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Parent Property (Excel)

 Copy code hover
[image]

Phonetic.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Phonetic object.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Text Property (Excel)

 Copy code hover
[image]

Phonetic.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a Phonetic object.

Remarks

For the Phonetic object, this property returns or sets its phonetic text. You cannot set this property to Null.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetic.Visible Property (Excel)

 Copy code hover
[image]

Phonetic.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Phonetic object.

See also

Concepts

Phonetic Object

Other resources

Phonetic Object Members


Phonetics Object (Excel)

 Copy code hover
[image]

Phonetics Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Phonetic objects in the specified range.

Remarks

Each Phonetic object contains information about a specific phonetic text string.

Example

Use the Phonetics property to return the Phonetics collection. The following example makes all phonetic text in the range A1:C4 visible.

VBA Copy code Copy code
Range("A1:C4").Phonetics.Visible = True

Use Phonetics(index), where index is the index number of the phonetic text, to return a single Phonetic object. The following example sets the first phonetic text string in the active cell to "フリガナ".

VBA Copy code Copy code
ActiveCell.Phonetics(1).Text = "フリガナ"

See also

Concepts

Excel Object Model Reference

Other resources

Phonetics Object Members


Phonetics Members (Excel)

 Copy code hover
[image]

Phonetics Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Phonetic objects in the specified range.

Methods

Name | Description
Add | Adds phonetic text to the specified cell.
Delete | Deletes the object.

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CharacterType | Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Item | Returns a single object from a collection.
Length | Returns a Long value that represents the number of characters of phonetic text from the position you've specified with the Start property.
Parent | Returns the parent object for the specified object. Read-only.
Start | Returns the position that represents the first character of a phonetic text string in the specified cell. Read-only Long.
Text | Returns or sets the text for the specified object. Read/write String.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Phonetics Properties (Excel)

 Copy code hover
[image]

Phonetics Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CharacterType | Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
Item | Returns a single object from a collection.
Length | Returns a Long value that represents the number of characters of phonetic text from the position you've specified with the Start property.
Parent | Returns the parent object for the specified object. Read-only.
Start | Returns the position that represents the first character of a phonetic text string in the specified cell. Read-only Long.
Text | Returns or sets the text for the specified object. Read/write String.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


Phonetics.Alignment Property (Excel)

 Copy code hover
[image]

Phonetics.Alignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.

Syntax

expression .Alignment

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Application Property (Excel)

 Copy code hover
[image]

Phonetics.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Phonetics object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.CharacterType Property (Excel)

 Copy code hover
[image]

Phonetics.CharacterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of phonetic text in the specified cell. Read/write XlPhoneticCharacterType.

Syntax

expression .CharacterType

expression A variable that represents a Phonetics object.

Example

This example changes the first phonetic text string in the active cell from Furigana to Hiragana.

VBA Copy code Copy code
ActiveCell.Phonetics(1).CharacterType = xlHiragana

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Count Property (Excel)

 Copy code hover
[image]

Phonetics.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Creator Property (Excel)

 Copy code hover
[image]

Phonetics.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Phonetics object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Font Property (Excel)

 Copy code hover
[image]

Phonetics.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Item Property (Excel)

 Copy code hover
[image]

Phonetics.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Phonetics object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example makes the first phonetic text string in the active cell visible.

VBA Copy code Copy code
ActiveCell.Phonetics.Item(1).Visible = True

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Length Property (Excel)

 Copy code hover
[image]

Phonetics.Length Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of characters of phonetic text from the position you've specified with the Start property.

Syntax

expression .Length

expression A variable that represents a Phonetics object.

Example

This example returns the length of the second phonetic text string in the active cell.

VBA Copy code Copy code
ActiveCell.FormulaR1C1 = "東京都渋谷区代々木"
ActiveCell.Phonetics.Add Start:=1, Length:=3, Text:="トウキョウト"
ActiveCell.Phonetics.Add Start:=4, Length:=3, Text:="シブヤク"
MsgBox ActiveCell.Phonetics(2).Length

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Parent Property (Excel)

 Copy code hover
[image]

Phonetics.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Start Property (Excel)

 Copy code hover
[image]

Phonetics.Start Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the position that represents the first character of a phonetic text string in the specified cell. Read-only Long.

Syntax

expression .Start

expression A variable that represents a Phonetics object.

Example

This example returns the starting position of the second phonetic text string in the active cell.

VBA Copy code Copy code
ActiveCell.FormulaR1C1 = "東京都渋谷区代々木"
ActiveCell.Phonetics.Add Start:=1, Length:=3, Text:="トウキョウト"
ActiveCell.Phonetics.Add Start:=4, Length:=3, Text:="シブヤク"
MsgBox ActiveCell.Phonetics(2).Start

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Text Property (Excel)

 Copy code hover
[image]

Phonetics.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a Phonetics object.

Remarks

For the Phonetic object, this property returns or sets its phonetic text. You cannot set this property to Null.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Visible Property (Excel)

 Copy code hover
[image]

Phonetics.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics Methods (Excel)

 Copy code hover
[image]

Phonetics Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds phonetic text to the specified cell.
Delete | Deletes the object.


Phonetics.Add Method (Excel)

 Copy code hover
[image]

Phonetics.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds phonetic text to the specified cell.

Syntax

expression .Add(Start, Length, Text)

expression A variable that represents a Phonetics object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The position that represents the first character in the specified cell.
Length | Required | Long | The number of characters from the Start position to the end of the text in the cell.
Text | Required | String | Collectively, the characters that represent the phonetic text in the cell.

Example

This example adds three phonetic text strings to the active cell. The example then sets the character type to Hiragana, sets the font color to blue, and sets the text to visible.

VBA Copy code Copy code
ActiveCell.FormulaR1C1 = "東京都渋谷区代々木"
ActiveCell.Phonetics.Add Start:=1, Length:=3, Text:="トウキョウト"
ActiveCell.Phonetics.Add Start:=4, Length:=3, Text:="シブヤク"
ActiveCell.Phonetics.CharacterType = xlHiragana
ActiveCell.Phonetics.Font.Color = vbBlue
ActiveCell.Phonetics.Visible = True

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


Phonetics.Delete Method (Excel)

 Copy code hover
[image]

Phonetics.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Phonetics object.

See also

Concepts

Phonetics Object

Other resources

Phonetics Object Members


PictureFormat Object (Excel)

 Copy code hover
[image]

PictureFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to pictures and OLE objects.

Remarks

The LinkFormat object contains properties and methods that apply to linked OLE objects only. The OLEFormat object contains properties and methods that apply to OLE objects whether or not they're linked.

Example

Use the PictureFormat property to return a PictureFormat object. The following example sets the brightness, contrast, and color transformation for shape one on myDocument and crops 18 points off the bottom of the shape. For this example to work, shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).PictureFormat
 .Brightness = 0.3
 .Contrast = 0.7
 .ColorType = msoPictureGrayScale
 .CropBottom = 18

See also

Concepts

Excel Object Model Reference

Other resources

PictureFormat Object Members


PictureFormat Members (Excel)

 Copy code hover
[image]

PictureFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to pictures and OLE objects.

Methods

Name | Description
IncrementBrightness | Changes the brightness of the picture by the specified amount. Use the Brightness property to set the absolute brightness of the picture.
IncrementContrast | Changes the contrast of the picture by the specified amount. Use the Contrast property to set the absolute contrast for the picture.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write .
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Crop | Returns an Crop object that represents the cropping settings for the specified PictureFormat object. Read-only
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
TransparencyColor | Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. For this property to take effect, the TransparentBackground property must be set to True. Applies to bitmaps only. Read/write Long.
TransparentBackground | Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.


PictureFormat Properties (Excel)

 Copy code hover
[image]

PictureFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write .
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Crop | Returns an Crop object that represents the cropping settings for the specified PictureFormat object. Read-only
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
TransparencyColor | Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. For this property to take effect, the TransparentBackground property must be set to True. Applies to bitmaps only. Read/write Long.
TransparentBackground | Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.


PictureFormat.Application Property (Excel)

 Copy code hover
[image]

PictureFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PictureFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Brightness Property (Excel)

 Copy code hover
[image]

PictureFormat.Brightness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.

Syntax

expression .Brightness

expression A variable that represents a PictureFormat object.

Example

This example sets the brightness for shape one on myDocument. Shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).PictureFormat.Brightness = 0.3

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.ColorType Property (Excel)

 Copy code hover
[image]

PictureFormat.ColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write .

Syntax

expression .ColorType

expression An expression that returns a PictureFormat object.

Example

This example sets the color transformation to grayscale through MsoPictureColorType for shape one on myDocument. Shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).PictureFormat.ColorType = msoPictureGrayScale

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Contrast Property (Excel)

 Copy code hover
[image]

PictureFormat.Contrast Property (Excel)
See also Send feedback

Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.

Syntax

expression .Contrast

expression An expression that returns a PictureFormat object.

Example

This example sets the contrast for shape one on myDocument. Shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).PictureFormat.Contrast = 0.8

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Creator Property (Excel)

 Copy code hover
[image]

PictureFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PictureFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Crop Property (Excel)

 Copy code hover
[image]

PictureFormat.Crop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Crop object that represents the cropping settings for the specified PictureFormat object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Crop

expression A variable that represents a PictureFormat object.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropBottom Property (Excel)

 Copy code hover
[image]

PictureFormat.CropBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropBottom

expression An expression that returns a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the CropBottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture.

Example

This example crops 20 points off the bottom of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropBottom = 20

Using this example, you can specify the percentage you want to crop off the bottom of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop off" & _
 " the bottom of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleHeight 1, True
 origHeight = .Height
 .Delete
End With
cropPoints = origHeight * percentToCrop / 100
shapeToCrop.PictureFormat.CropBottom = cropPoints

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropLeft Property (Excel)

 Copy code hover
[image]

PictureFormat.CropLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropLeft

expression An expression that returns a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the CropLeft property to 50, 100 points (not 50) will be cropped off the left side of your picture.

Example

This example crops 20 points off the left side of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropLeft = 20

Using this example, you can specify the percentage you want to crop off the left side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the left of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleWidth 1, True
 origWidth = .Width
 .Delete
End With
cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropLeft = cropPoints

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropRight Property (Excel)

 Copy code hover
[image]

PictureFormat.CropRight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropRight

expression An expression that returns a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the CropRight property to 50, 100 points (not 50) will be cropped off the right side of your picture.

Example

This example crops 20 points off the right side of shape three on myDocument. For this example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropRight = 20

Using this example, you can specify the percentage you want to cropp off the right side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the right of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleWidth 1, True
 origWidth = .Width
 .Delete
End With
cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropRight = cropPoints

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropTop Property (Excel)

 Copy code hover
[image]

PictureFormat.CropTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropTop

expression An expression that returns a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the CropTop property to 50, 100 points (not 50) will be cropped off the top of your picture.

Example

This example crops 20 points off the top of shape three on myDocument. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).PictureFormat.CropTop = 20

This example allows you to specify the percentage you want to crop off the top of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
percentToCrop = InputBox( _
 "What percentage do you want to crop" & _
 " off the top of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
 .ScaleHeight 1, True
 origHeight = .Height
 .Delete
End With
cropPoints = origHeight * percentToCrop / 100
shapeToCrop.PictureFormat.CropTop = cropPoints

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Parent Property (Excel)

 Copy code hover
[image]

PictureFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PictureFormat object.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.TransparencyColor Property (Excel)

 Copy code hover
[image]

PictureFormat.TransparencyColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. For this property to take effect, the TransparentBackground property must be set to True. Applies to bitmaps only. Read/write Long.

Syntax

expression .TransparencyColor

expression A variable that represents a PictureFormat object.

Remarks

If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to False. If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to True, the picture's fill will be visible through the transparent color, but objects behind the picture will be obscured.

Example

This example sets the color that has the RGB value returned by the function RGB(0, 0, 255) as the transparent color for shape one on myDocument. For the example to work, shape one must be a bitmap.

VBA Copy code Copy code
blueScreen = RGB(0, 0, 255)
Set myDocument = Worksheets(1)
With myDocument.Shapes(1)
 With .PictureFormat
 .TransparentBackground = True
 .TransparencyColor = blueScreen
 End With
 .Fill.Visible = False
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.TransparentBackground Property (Excel)

 Copy code hover
[image]

PictureFormat.TransparentBackground Property (Excel)
See also Send feedback

Published: July 16, 2012

Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.

Syntax

expression .TransparentBackground

expression A variable that represents a PictureFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue The parts of the picture that are the color defined as the transparent color appear transparent.

If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to False. If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to True, the picture's fill will be visible through the transparent color, but objects behind the picture will be obscured.

Example

This example sets the color that has the RGB value returned by the function RGB(0, 24, 240) as the transparent color for shape one on myDocument. For the example to work, shape one must be a bitmap.

VBA Copy code Copy code
blueScreen = RGB(0, 0, 255)
Set myDocument = Worksheets(1)
With myDocument.Shapes(1)
 With .PictureFormat
 .TransparentBackground = True
 .TransparencyColor = blueScreen
 End With
 .Fill.Visible = False
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat Methods (Excel)

 Copy code hover
[image]

PictureFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementBrightness | Changes the brightness of the picture by the specified amount. Use the Brightness property to set the absolute brightness of the picture.
IncrementContrast | Changes the contrast of the picture by the specified amount. Use the Contrast property to set the absolute contrast for the picture.


PictureFormat.IncrementBrightness Method (Excel)

 Copy code hover
[image]

PictureFormat.IncrementBrightness Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the brightness of the picture by the specified amount. Use the Brightness property to set the absolute brightness of the picture.

Syntax

expression .IncrementBrightness(Increment)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Brightness property for the picture. A positive value makes the picture brighter; a negative value makes the picture darker.

Remarks

You cannot adjust the brightness of a picture past the upper or lower limit for the Brightness property. For example, if the Brightness property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting brightness level will be 1.0, which is the upper limit for the Brightness property, instead of 1.2.

Example

This example creates a duplicate of shape one on myDocument and then moves and darkens the duplicate. For the example to work, shape one must be either a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .PictureFormat.IncrementBrightness -0.2
 .IncrementLeft 50
 .IncrementTop 50
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.IncrementContrast Method (Excel)

 Copy code hover
[image]

PictureFormat.IncrementContrast Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the contrast of the picture by the specified amount. Use the Contrast property to set the absolute contrast for the picture.

Syntax

expression .IncrementContrast(Increment)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Contrast property for the picture. A positive value increases the contrast; a negative value decreases the contrast.

Remarks

You cannot adjust the contrast of a picture past the upper or lower limit for the Contrast property. For example, if the Contrast property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting contrast level will be 1.0, which is the upper limit for the Contrast property, instead of 1.2.

Example

This example increases the contrast for all pictures on myDocument that aren't already set to maximum contrast.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 If s.Type = msoPicture Or s.Type = msoLinkedPicture Then
 s.PictureFormat.IncrementContrast 0.1
 End If
Next

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PivotAxis Object (Excel)

 Copy code hover
[image]

PivotAxis Object (Excel)
See also Send feedback

Published: July 16, 2012

The PivotAxis object is used for asymmetric drilling in a PivotTable.

Version Information

Version Added: Excel 2007

Remarks

The PivotAxis object contains properties such as PivotRowAxis and PivotRowAxis to work with the rows and columns in the PivotTable.

See also

Concepts

Excel Object Model Reference

Other resources

PivotAxis Object Members


PivotAxis Members (Excel)

 Copy code hover
[image]

PivotAxis Members (Excel)
Send feedback

Published: July 16, 2012

The PivotAxis object is used for asymmetric drilling in a PivotTable.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified PivotAxis object. Read-only.
PivotLines | Returns the PivotLines attached to the specified PivotAxis object. Read-only.


PivotAxis Properties (Excel)

 Copy code hover
[image]

PivotAxis Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified PivotAxis object. Read-only.
PivotLines | Returns the PivotLines attached to the specified PivotAxis object. Read-only.


PivotAxis.Application Property (Excel)

 Copy code hover
[image]

PivotAxis.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotAxis object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotAxis Object

Other resources

PivotAxis Object Members


PivotAxis.Creator Property (Excel)

 Copy code hover
[image]

PivotAxis.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotAxis object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotAxis Object

Other resources

PivotAxis Object Members


PivotAxis.Parent Property (Excel)

 Copy code hover
[image]

PivotAxis.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotAxis object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotAxis object.

See also

Concepts

PivotAxis Object

Other resources

PivotAxis Object Members


PivotAxis.PivotLines Property (Excel)

 Copy code hover
[image]

PivotAxis.PivotLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotLines attached to the specified PivotAxis object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotLines

expression A variable that represents a PivotAxis object.

See also

Concepts

PivotAxis Object

Other resources

PivotAxis Object Members


PivotCache Object (Excel)

 Copy code hover
[image]

PivotCache Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the memory cache for a PivotTable report.

Remarks

The PivotCache object is a member of the PivotCaches collection.

Example

Use the PivotCache method to return a PivotCache object for a PivotTable report (each report has only one cache). The following example causes the first PivotTable report on the first worksheet to refresh itself whenever its file is opened.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotCache.RefreshOnFileOpen = True

Use PivotCaches(index), where index is the PivotTable cache number, to return a single PivotCache object from the PivotCaches collection for a workbook. The following example refreshes cache one.

VBA Copy code Copy code
ActiveWorkbook.PivotCaches(1).Refresh

See also

Concepts

Excel Object Model Reference

Other resources

PivotCache Object Members


PivotCache Members (Excel)

 Copy code hover
[image]

PivotCache Members (Excel)
Send feedback

Published: July 16, 2012

Represents the memory cache for a PivotTable report.

Methods

Name | Description
CreatePivotChart | Creates a standalone PivotChart from a PivotCache Object (Excel) object. A Shape Object (Excel) object is returned.
CreatePivotTable | Creates a PivotTable report based on a PivotCache object. Returns a PivotTable object.
MakeConnection | Establishes a connection for the specified PivotTable cache.
Refresh | Causes the specified chart to be redrawn immediately.
ResetTimer | Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.
SaveAsODC | Saves the PivotTable cache source as an Microsoft Office Data Connection file.

Properties

Name | Description
ADOConnection | Returns an ADO Connection object if the PivotTable cache is connected to an OLE DB data source. The ADOConnection property exposes the Microsoft Excel connection to the data provider, allowing the user to write code within the context of the same session that Excel is using with ADO (relational source) or ADO MD (OLAP source). Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundQuery | True if queries for the PivotTable report are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.
Connection | Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
IsConnected | Returns True if the MaintainConnection property is True and the PivotTable cache is currently connected to its source. Returns False if it is not currently connected to its source. Read-only Boolean.
LocalConnection | Returns or sets the connection string to an offline cube file. Read/write String.
MaintainConnection | True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.
MemoryUsed | Returns the amount of memory currently being used by the object, in bytes. Read-only Long.
MissingItemsLimit | Returns or sets the maximum quantity of unique items per PivotTable field that are retained even when they have no supporting data in the cache records. Read/write XlPivotTableMissingItems.
OLAP | Returns True if the PivotTable cache is connected to an Online Analytical Processing (OLAP) server. Read-onlyBoolean.
OptimizeCache | True if the PivotTable cache is optimized when it's constructed. The default value is False. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
QueryType | Indicates the type of query used by Microsoft Excel to populate the PivotTable cache. Read-only XlQueryType.
RecordCount | Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.
Recordset | Returns or sets a Recordset object that's used as the data source for the specified PivotTable cache. Read/write.
RefreshDate | Returns the date on which the cache was last refreshed. Read-only Date.
RefreshName | Returns the name of the person who last refreshed the PivotTable cache. Read-only String.
RefreshOnFileOpen | True if the PivotTable cache is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RobustConnect | Returns or sets how the PivotTable cache connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the PivotTable. Read/write.
SourceData | Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.
SourceDataFile | Returns a String value that indicates the source data file for the cache of the PivotTable.
SourceType | Returns a XlPivotTableSourceType value that represents the type of item being published.
UpgradeOnRefresh | Contains information on whether to upgrade the PivotCache and all connected PivotTables on the next refresh. Read/write Boolean.
UseLocalConnection | Returns True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. Returns False if the connection string specified by the Connection property is used. Read/write Boolean.
Version | Returns the version of Microsoft Excel in which the PivotCache was created. Read-only.
WorkbookConnection | Establishes a connection between the current workbook and the PivotCache object. Read-only.


PivotCache Properties (Excel)

 Copy code hover
[image]

PivotCache Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ADOConnection | Returns an ADO Connection object if the PivotTable cache is connected to an OLE DB data source. The ADOConnection property exposes the Microsoft Excel connection to the data provider, allowing the user to write code within the context of the same session that Excel is using with ADO (relational source) or ADO MD (OLAP source). Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundQuery | True if queries for the PivotTable report are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.
Connection | Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EnableRefresh | True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
IsConnected | Returns True if the MaintainConnection property is True and the PivotTable cache is currently connected to its source. Returns False if it is not currently connected to its source. Read-only Boolean.
LocalConnection | Returns or sets the connection string to an offline cube file. Read/write String.
MaintainConnection | True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.
MemoryUsed | Returns the amount of memory currently being used by the object, in bytes. Read-only Long.
MissingItemsLimit | Returns or sets the maximum quantity of unique items per PivotTable field that are retained even when they have no supporting data in the cache records. Read/write XlPivotTableMissingItems.
OLAP | Returns True if the PivotTable cache is connected to an Online Analytical Processing (OLAP) server. Read-onlyBoolean.
OptimizeCache | True if the PivotTable cache is optimized when it's constructed. The default value is False. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
QueryType | Indicates the type of query used by Microsoft Excel to populate the PivotTable cache. Read-only XlQueryType.
RecordCount | Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.
Recordset | Returns or sets a Recordset object that's used as the data source for the specified PivotTable cache. Read/write.
RefreshDate | Returns the date on which the cache was last refreshed. Read-only Date.
RefreshName | Returns the name of the person who last refreshed the PivotTable cache. Read-only String.
RefreshOnFileOpen | True if the PivotTable cache is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RobustConnect | Returns or sets how the PivotTable cache connects to its data source. Read/write XlRobustConnect.
SavePassword | True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the PivotTable. Read/write.
SourceData | Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.
SourceDataFile | Returns a String value that indicates the source data file for the cache of the PivotTable.
SourceType | Returns a XlPivotTableSourceType value that represents the type of item being published.
UpgradeOnRefresh | Contains information on whether to upgrade the PivotCache and all connected PivotTables on the next refresh. Read/write Boolean.
UseLocalConnection | Returns True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. Returns False if the connection string specified by the Connection property is used. Read/write Boolean.
Version | Returns the version of Microsoft Excel in which the PivotCache was created. Read-only.
WorkbookConnection | Establishes a connection between the current workbook and the PivotCache object. Read-only.


PivotCache.ADOConnection Property (Excel)

 Copy code hover
[image]

PivotCache.ADOConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an ADO Connection object if the PivotTable cache is connected to an OLE DB data source. The ADOConnection property exposes the Microsoft Excel connection to the data provider, allowing the user to write code within the context of the same session that Excel is using with ADO (relational source) or ADO MD (OLAP source). Read-only.

Syntax

expression .ADOConnection

expression A variable that represents a PivotCache object.

Remarks

The ADOConnection property is available only for sessions with an OLE DB data source. When there is no ADO session, the query will result in a run-time error.

The ADOConnection property can be used for any OLE DB-based cache with ADO. The ADO Connection object can be used with ADO MD for finding information about OLAP cubes on which the cache is based.

Example

This example sets an ADO DB Connection object to the ADOConnection property of the PivotTable cache. The example assumes that a PivotTable report exists on the active worksheet.

Copy code Copy code
Sub UseADOConnection()

 Dim ptOne As PivotTable
 Dim cmdOne As New ADODB.Command
 Dim cfOne As CubeField

 Set ptOne = Sheet1.PivotTables(1)
 ptOne.PivotCache.MaintainConnection = True
 Set cmdOne.ActiveConnection = ptOne.PivotCache.ADOConnection

 ptOne.PivotCache.MakeConnection

 ' Create a set.
 cmdOne.CommandText = "Create Set [Warehouse].[My Set] as '{[Product].[All Products].Children}'"
 cmdOne.CommandType = adCmdUnknown
 cmdOne.Execute

 ' Add a set to the CubeField.
 Set cfOne = ptOne.CubeFields.AddSet("My Set", "My Set")

End Sub

This example adds a calculated member, assuming that a PivotTable report exists on the active worksheet.

Copy code Copy code
Sub AddMember()

 Dim cmd As New ADODB.Command

 If Not ActiveSheet.PivotTables(1).PivotCache.IsConnected Then
 ActiveSheet.PivotTables(1).PivotCache.MakeConnection
 End If

 Set cmd.ActiveConnection = ActiveSheet.PivotTables(1).PivotCache.ADOConnection

 ' Add a calculated member.
 cmd.CommandText = "CREATE MEMBER [Warehouse].[Product].[All Products].[Drink and Non-Consumable] AS '[Product].[All Products].[Drink] + [Product].[All Products].[Non-Consumable]'"
 cmd.CommandType = adCmdUnknown
 cmd.Execute

 ActiveSheet.PivotTables(1).PivotCache.Refresh

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Application Property (Excel)

 Copy code hover
[image]

PivotCache.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotCache object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.BackgroundQuery Property (Excel)

 Copy code hover
[image]

PivotCache.BackgroundQuery Property (Excel)
See also Send feedback

Published: July 16, 2012

True if queries for the PivotTable report are performed asynchronously (in the background). Read/write Boolean.

Syntax

expression .BackgroundQuery

expression A variable that represents a PivotCache object.

Remarks

For OLAP data sources, this property is read-only and always returns False.

Example

This example causes queries for the first PivotTable report on worksheet one to be performed in the background.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotCache.BackgroundQuery = True

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.CommandText Property (Excel)

 Copy code hover
[image]

PivotCache.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Read/write Variant.

Syntax

expression .CommandText

expression An expression that returns a PivotCache object.

Remarks

For OLE DB sources, the CommandType property describes the value of the CommandText property.

For ODBC sources, setting the CommandText causes the data to be refreshed.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.CommandType Property (Excel)

 Copy code hover
[image]

PivotCache.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.

Syntax

expression .CommandType

expression An expression that returns a PivotCache object.

Remarks

XlCmdType can be one of these XlCmdType constants.

xlCmdCube. Contains a cube name for an OLAP data source.

xlCmdDefault. Contains command text that the OLE DB provider understands.

xlCmdSql. Contains an SQL statement.

xlCmdTable. Contains a table name for accessing OLE DB data sources.

You can set the CommandType property only if the value of the QueryType property for the query table or PivotTable cache is xlOLEDBQuery.

If the value of the CommandType property is xlCmdCube, you cannot change this value if there is a PivotTable report associated with the query table.

Example

This example sets the command string for the first query table's ODBC data source. The command string is an SQL statement.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 .CommandType = xlCmdSQL
 .CommandText = _
 "Select ProductID From Products Where ProductID < 10"
 .Refresh
End With

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Connection Property (Excel)

 Copy code hover
[image]

PivotCache.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.

Syntax

expression .Connection

expression An expression that returns a PivotCache object.

Remarks

When using an offline cube file, set the UseLocalConnection property to True and use the LocalConnection property instead of the Connection property.

Alternatively, you may choose to access a data source directly by using the Microsoft ActiveX Data Objects (ADO) library instead.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .MaintainConnection = True
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 0
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 0
 End With
End With

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Creator Property (Excel)

 Copy code hover
[image]

PivotCache.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotCache object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.EnableRefresh Property (Excel)

 Copy code hover
[image]

PivotCache.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.

Syntax

expression .EnableRefresh

expression A variable that represents a PivotCache object.

Remarks

The RefreshOnFileOpen property is ignored if the EnableRefresh property is set to False.

For OLAP data sources, setting this property to False disables updates.

Example

This example sets the first PivotTable report on worksheet one so that it cannot be refreshed.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotCache.EnableRefresh = False

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Index Property (Excel)

 Copy code hover
[image]

PivotCache.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a PivotCache object.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.IsConnected Property (Excel)

 Copy code hover
[image]

PivotCache.IsConnected Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the MaintainConnection property is True and the PivotTable cache is currently connected to its source. Returns False if it is not currently connected to its source. Read-only Boolean.

Syntax

expression .IsConnected

expression A variable that represents a PivotCache object.

Remarks

The IsConnected property does not check to see if the connection is connected. Even if this property returns True, sending commands to the provider could result in an error if the connection is no longer valid.

Requires that the cache source type is external and that it is an OLE DB data source.

Example

The following example determines if the cache is connected to its source and notifies the user. This example assumes that a PivotTable exists on the active worksheet.

Copy code Copy code
Sub CheckIsConnected()

 ' Handle run-time error if external source is not OLE DB.
 On Error GoTo Not_OLEDB

 ' Check connection setting and notify the user accordingly.
 If Application.ActiveWorkbook.PivotCaches.Item(1).IsConnected = True Then
 MsgBox "The PivotCache is currently connected to its source."
 Else
 MsgBox "The PivotCache is not currently connected to its source."
 End If
 Exit Sub

Not_OLEDB:
 MsgBox "The data source is not an OLE DB data source."

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.LocalConnection Property (Excel)

 Copy code hover
[image]

PivotCache.LocalConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the connection string to an offline cube file. Read/write String.

Syntax

expression .LocalConnection

expression A variable that represents a PivotCache object.

Remarks

For a non-OLAP data source, the value of the LocalConnection property is an empty string, and the UseLocalConnection property is set to False.

Setting the LocalConnection property does not immediately initiate the connection to the data source. You must first use the Refresh method to make the connection and retrieve the data.

The value of the LocalConnection property is used if the UseLocalConnection property is set to True. If the UseLocalConnection property is set to False, the Connection property specifies the connection string for query tables based on sources other than local cube files.

For more information about the syntax for connection strings, see the Help topic for the Add method of the PivotTable collection.

Example

This example sets the connection string of the first PivotTable cache to reference an offline cube file.

Copy code Copy code
With ActiveWorkbook.PivotCaches(1)
 .LocalConnection = _
 "OLEDB;Provider=MSOLAP;Data Source=C:\Data\DataCube.cub"
 .UseLocalConnection = True
End With

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.MaintainConnection Property (Excel)

 Copy code hover
[image]

PivotCache.MaintainConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.

Syntax

expression .MaintainConnection

expression A variable that represents a PivotCache object.

Remarks

You can set the MaintainConnection property only if the QueryType property of the query table or PivotTable cache is set to xlOLEDBQuery.

If you anticipate frequent queries to a server, setting this property to True might improve performance by reducing reconnection time. Setting the property to False causes an open connection to be closed.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet. The example terminates the connection after the initial refresh.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .MaintainConnection = False
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 0
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 0
 End With
End With

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.MemoryUsed Property (Excel)

 Copy code hover
[image]

PivotCache.MemoryUsed Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the amount of memory currently being used by the object, in bytes. Read-only Long.

Syntax

expression .MemoryUsed

expression A variable that represents a PivotCache object.

Remarks

For PivotCache objects, this property reflects the transient state of the cache at the time that it's queried.

If the PivotCache object has no PivotTable report attached to it, this property returns 0 (zero).

Example

This example displays a message box showing the number of bytes that Microsoft Excel is currently using.

VBA Copy code Copy code
MsgBox "Microsoft Excel is currently using " & _
 Application.MemoryUsed & " bytes"

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.MissingItemsLimit Property (Excel)

 Copy code hover
[image]

PivotCache.MissingItemsLimit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum quantity of unique items per PivotTable field that are retained even when they have no supporting data in the cache records. Read/write XlPivotTableMissingItems.

Syntax

expression .MissingItemsLimit

expression A variable that represents a PivotCache object.

Remarks

XlPivotTableMissingItems can be one of these XlPivotTableMissingItems constants.

xlMissingItemsDefault The default number of unique items per PivotField allowed.

xlMissingItemsMax The maximum number of unique items per PivotField allowed (32,500).

xlMissingItemsNone No unique items per PivotField allowed (zero).

This property can be set to a value between 0 and 32500. If an integer less than zero is specified, this is equivalent to specifying xlMissingItemsDefault. Integers greater than 32,500 can be specified but will have the same effect as specifying xlMissingItemsMax.

The MissingItemsLimit property only works for non-OLAP PivotTables; otherwise, a run-time error can occur.

Example

This example determines the maximum quantity of unique items per field and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckMissingItemsList()

 Dim pvtCache As PivotCache

 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 ' Determine the maximum number of unique items allowed per PivotField and notify the user.
 Select Case pvtCache.MissingItemsLimit
 Case xlMissingItemsDefault
 MsgBox "The default value of unique items per PivotField is allowed."
 Case xlMissingItemsMax
 MsgBox "The maximum value of unique items per PivotField is allowed."
 Case xlMissingItemsNone
 MsgBox "No unique items per PivotField are allowed."
 End Select

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.OLAP Property (Excel)

 Copy code hover
[image]

PivotCache.OLAP Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the PivotTable cache is connected to an Online Analytical Processing (OLAP) server. Read-onlyBoolean.

Syntax

expression .OLAP

expression A variable that represents a PivotCache object.

Example

This example determines whether or not the cache connection is to an OLAP server. The example assumes that a PivotTable exists on the active worksheet.

Copy code Copy code
Sub CheckPivotCache()

 ' Determine if PivotCache has OLAP connection.
 If Application.ActiveWorkbook.PivotCaches.Item(1).OLAP = True Then
 MsgBox "The PivotCache is connected to an OLAP server"
 Else
 MsgBox "The PivotCache is not connected to an OLAP server."
 End If

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.OptimizeCache Property (Excel)

 Copy code hover
[image]

PivotCache.OptimizeCache Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable cache is optimized when it's constructed. The default value is False. Read/write Boolean.

Syntax

expression .OptimizeCache

expression A variable that represents a PivotCache object.

Remarks

Cache optimization results in additional queries and degrades initial performance of the PivotTable report.

For OLE DB data sources, this property is read-only and always returns False.

Example

This example causes the PivotTable cache for the first PivotTable report on worksheet one to be optimized when it's constructed.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotCache.OptimizeCache = True

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Parent Property (Excel)

 Copy code hover
[image]

PivotCache.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotCache object.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.QueryType Property (Excel)

 Copy code hover
[image]

PivotCache.QueryType Property (Excel)
See also Send feedback

Published: July 16, 2012

Indicates the type of query used by Microsoft Excel to populate the PivotTable cache. Read-only XlQueryType.

Syntax

expression .QueryType

expression A variable that represents a PivotCache object.

Remarks

XlQueryType can be one of these XlQueryType constants.

xlTextImport. Based on a text file, for query tables only

xlOLEDBQuery. Based on an OLE DB query, including OLAP data sources

xlWebQuery. Based on a Web page, for query tables only

xlADORecordset. Based on an ADO recordset query

xlDAORecordSet. Based on a DAO recordset query, for query tables only

xlODBCQuery. Based on an ODBC data source

You specify the data source in the prefix for the Connection property's value.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RecordCount Property (Excel)

 Copy code hover
[image]

PivotCache.RecordCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.

Syntax

expression .RecordCount

expression A variable that represents a PivotCache object.

Remarks

This property reflects the transient state of the cache at the time that it's queried. The cache can change between queries.

Example

This example displays the number of cache records that contain "Kiwi" in the "Products" field.

VBA Copy code Copy code
MsgBox Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Product").PivotItems("Kiwi").RecordCount

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Recordset Property (Excel)

 Copy code hover
[image]

PivotCache.Recordset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Recordset object that's used as the data source for the specified PivotTable cache. Read/write.

Syntax

expression .Recordset

expression A variable that represents a PivotCache object.

Remarks

If this property is used to overwrite an existing recordset, the change takes effect when the Refresh method is run.

Example

This example creates a new PivotTable cache using an ADO connection to Microsoft Jet, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet.

VBA Copy code Copy code
Dim cnnConn As ADODB.Connection
Dim rstRecordset As ADODB.Recordset
Dim cmdCommand As ADODB.Command

' Open the connection.
Set cnnConn = New ADODB.Connection
With cnnConn
 .ConnectionString = _
 "Provider=Microsoft.Jet.OLEDB.4.0"
 .Open "C:\perfdate\record.mdb"
End With

' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnnConn
With cmdCommand
 .CommandText = "Select Speed, Pressure, Time From DynoRun"
 .CommandType = adCmdText
 .Execute
End With

' Open the recordset.
Set rstRecordset = New ADODB.Recordset
Set rstRecordset.ActiveConnection = cnnConn
rstRecordset.Open cmdCommand

' Create a PivotTable cache and report.
Set objPivotCache = ActiveWorkbook.PivotCaches.Add( _
 SourceType:=xlExternal)
Set objPivotCache.Recordset = rstRecordset
With objPivotCache
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:="Performance"
End With

With ActiveSheet.PivotTables("Performance")
 .SmallGrid = False
 With .PivotFields("Pressure")
 .Orientation = xlRowField
 .Position = 1
 End With
 With .PivotFields("Speed")
 .Orientation = xlColumnField
 .Position = 1
 End With
 With .PivotFields("Time")
 .Orientation = xlDataField
 .Position = 1
 End With
End With

' Close the connections and clean up.
cnnConn.Close
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
Set cnnConn = Nothing

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RefreshDate Property (Excel)

 Copy code hover
[image]

PivotCache.RefreshDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the date on which the cache was last refreshed. Read-only Date.

Syntax

expression .RefreshDate

expression A variable that represents a PivotCache object.

Remarks

For PivotCache objects, the cache must have at least one PivotTable report associated with it.

For OLAP data sources, this property is updated after each query.

Example

This example displays the date on which the PivotTable report was last refreshed.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
dateString = Format(pvtTable.RefreshDate, "Long Date")
MsgBox "The data was last refreshed on " & dateString

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RefreshName Property (Excel)

 Copy code hover
[image]

PivotCache.RefreshName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the person who last refreshed the PivotTable cache. Read-only String.

Syntax

expression .RefreshName

expression A variable that represents a PivotCache object.

Remarks

For OLAP data sources, this property is updated after each query.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RefreshOnFileOpen Property (Excel)

 Copy code hover
[image]

PivotCache.RefreshOnFileOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable cache is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.

Syntax

expression .RefreshOnFileOpen

expression A variable that represents a PivotCache object.

Remarks

Query tables and PivotTable reports are not automatically refreshed when you open the workbook by using the Open method in Visual Basic. Use the Refresh method to refresh the data after the workbook is open.

Example

This example causes the PivotTable cache to automatically update each time the workbook is opened.

VBA Copy code Copy code
ActiveWorkbook.PivotCaches(1).RefreshOnFileOpen = True

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RefreshPeriod Property (Excel)

 Copy code hover
[image]

PivotCache.RefreshPeriod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between refreshes. Read/write Long.

Syntax

expression .RefreshPeriod

expression A variable that represents a PivotCache object.

Remarks

Setting the period to 0 (zero) disables automatic timed refreshes and is equivalent to setting this property to Null.

The value of the RefreshPeriod property can be an integer from 0 through 32767.

Example

This example sets the refresh period for the PivotTable cache (PivotTable3) to 15 minutes.

VBA Copy code Copy code
Set objPC = Worksheets("Sheet1").PivotTables("PivotTable3").PivotCache
objPC.RefreshPeriod = 15

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.RobustConnect Property (Excel)

 Copy code hover
[image]

PivotCache.RobustConnect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how the PivotTable cache connects to its data source. Read/write XlRobustConnect.

Syntax

expression .RobustConnect

expression A variable that represents a PivotCache object.

Remarks

XlRobustConnect can be one of these XlRobustConnect constants.

xlAlways . The cache always uses external source information (as defined by the SourceConnectionFile or SourceDataFile property) to reconnect.

xlAsRequired . The cache uses external source info to reconnect using the Connection property.

xlNever . The cache never uses source info to reconnect.

Example

The following example determines the setting for the cache connection and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckRobustConnect()

 Dim pvtCache As PivotCache

 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 ' Determine the connection robustness and notify user.
 Select Case pvtCache.RobustConnect
 Case xlAlways
 MsgBox "The PivotTable cache is always connected to its source."
 Case xlAsRequired
 MsgBox "The PivotTable cache is connected to its source as required."
 Case xlNever
 MsgBox "The PivotTable cache is never connected to its source."
 End Select

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SavePassword Property (Excel)

 Copy code hover
[image]

PivotCache.SavePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.

Syntax

expression .SavePassword

expression A variable that represents a PivotCache object.

Remarks

This property is used in both ODBC and OLEDB queries, and by both PivotTables and QueryTables.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SourceConnectionFile Property (Excel)

 Copy code hover
[image]

PivotCache.SourceConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the PivotTable. Read/write.

Syntax

expression .SourceConnectionFile

expression A variable that represents a PivotCache object.

Example

This example determines if a connection exists for the PivotTable cache and, if there is a connection, displays the file name. If no connection exists, the code handles the run-time error and notifies the user. This example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckSourceConnection()

 Dim pvtCache As PivotCache

 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 On Error GoTo No_Connection

 MsgBox "The source connection is: " & pvtCache.SourceConnectionFile
 Exit Sub

No_Connection:
 MsgBox "PivotCache source can not be determined."

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SourceData Property (Excel)

 Copy code hover
[image]

PivotCache.SourceData Property (Excel)
See also Send feedback

Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.

Syntax

expression .SourceData

expression A variable that represents a PivotCache object.

Remarks

Data source | Return value
Microsoft Excel list or database | The cell reference, as text.
External data source | An array. Each row consists of an SQL connection string with the remaining elements as the query string, broken down into 255-character segments.
Multiple consolidation ranges | A two-dimensional array. Each row consists of a reference and its associated page field items.
Another PivotTable report | One of the above three kinds of information.

This property is not available for OLE DB data sources.

Example

Assume that you used an external data source to create a PivotTable report on Sheet1. This example inserts the SQL connection string and query string into a new worksheet.

VBA Copy code Copy code
Set newSheet = ActiveWorkbook.Worksheets.Add
sdArray = Worksheets("Sheet1").UsedRange.PivotTable.SourceData
For i = LBound(sdArray) To UBound(sdArray)
 newSheet.Cells(i, 1) = sdArray(i)
Next i

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SourceDataFile Property (Excel)

 Copy code hover
[image]

PivotCache.SourceDataFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that indicates the source data file for the cache of the PivotTable.

Syntax

expression .SourceDataFile

expression A variable that represents a PivotCache object.

Remarks

For file-based data sources (e.g. Access), the SourceDataFile property contains a fully qualified path to the source data file. It is set to Null for server-based data sources (e.g. SQL Server). The SourceDataFile property is set to Null if the Connection property is changed programmatically.

Example

This example determines if a connection exists for the cache and, if there is a connection, displays the data source file name. If no connection exists, the code handles the run-time error and notifies the user. This example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckSourceConnection()

 Dim pvtCache As PivotCache

 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

 On Error GoTo No_Connection

 MsgBox "The data source connection is: " & _
 pvtCache.SourceDataFile
 Exit Sub

No_Connection:
 MsgBox "PivotCache source cannot be determined."

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SourceType Property (Excel)

 Copy code hover
[image]

PivotCache.SourceType Property (Excel)
See also Send feedback

Returns a XlPivotTableSourceType value that represents the type of item being published.

Syntax

expression .SourceType

expression A variable that represents a PivotCache object.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.UpgradeOnRefresh Property (Excel)

 Copy code hover
[image]

PivotCache.UpgradeOnRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

Contains information on whether to upgrade the PivotCache and all connected PivotTables on the next refresh. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .UpgradeOnRefresh

expression A variable that represents a PivotCache object.

Remarks

The default value is False. If the property is set to True for a PivotCache, refreshing any PivotTable attached to that PivotCache will upgrade the PivotCache and all the attached PivotTables to xlPivotTableVersion12 (PivotTable.Version = 3) as part of the refresh.

If the property is set to False for a PivotCache, refreshing any PivotTable attached to that PivotCache will not change the version of the PivotCache, nor the version of all the attached PivotTables. They all stay the same version as before the refresh.

Saving to an Excel 2007 or later file format, when in compatibility mode, will set this property to True for all PivotCaches in the workbook.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.UseLocalConnection Property (Excel)

 Copy code hover
[image]

PivotCache.UseLocalConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the LocalConnection property is used to specify the string that enables Microsoft Excel to connect to a data source. Returns False if the connection string specified by the Connection property is used. Read/write Boolean.

Syntax

expression .UseLocalConnection

expression A variable that represents a PivotCache object.

Example

This example sets the connection string of the first PivotTable cache to reference an offline cube file.

Copy code Copy code
With ActiveWorkbook.PivotCaches(1)
 .LocalConnection = _
 "OLEDB;Provider=MSOLAP;Data Source=C:\Data\DataCube.cub"
 .UseLocalConnection = True
End With

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Version Property (Excel)

 Copy code hover
[image]

PivotCache.Version Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the version of Microsoft Excel in which the PivotCache was created. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Version

expression A variable that represents a PivotCache object.

Remarks

This property returns the version of the PivotTable. Default settings and behaviors depend on the version to allow for old PivotTable object model code to run in Microsoft Office Excel 2007 with the same behaviors when the version of the PivotTable corresponds to the version of Excel for which the code was written.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.WorkbookConnection Property (Excel)

 Copy code hover
[image]

PivotCache.WorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Establishes a connection between the current workbook and the PivotCache object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .WorkbookConnection

expression A variable that represents a PivotCache object.

Remarks

The WorkbookConnection object represents a connection to an external data source.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache Methods (Excel)

 Copy code hover
[image]

PivotCache Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CreatePivotChart | Creates a standalone PivotChart from a PivotCache Object (Excel) object. A Shape Object (Excel) object is returned.
CreatePivotTable | Creates a PivotTable report based on a PivotCache object. Returns a PivotTable object.
MakeConnection | Establishes a connection for the specified PivotTable cache.
Refresh | Causes the specified chart to be redrawn immediately.
ResetTimer | Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.
SaveAsODC | Saves the PivotTable cache source as an Microsoft Office Data Connection file.


PivotCache.CreatePivotChart Method (Excel)

 Copy code hover
[image]

PivotCache.CreatePivotChart Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a standalone PivotChart from a PivotCache Object (Excel) object. A Shape Object (Excel) object is returned.

Version information

Version Added: Excel 2013

Syntax

expression .CreatePivotChart(ChartDestination,XlChartType,Left,Top,Width,Height)

expression A variable that represents a PivotCache Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
ChartDestination | Required | VARIANT | The Destination worksheet
XlChartType | Optional | VARIANT | The type of chart
Left | Optional | VARIANT | The distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Top | Optional | VARIANT | The distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.
Width | Optional | VARIANT | The width, in points, of the object.
Height | Optional | VARIANT | The width, in points, of the object.

Return value

Shape Object (Excel) object

Remarks

If the PivotCache object that the method is called from has no attached PivotTable:

  • A workbook-level PivotTable is created from the existing PivotCache.

  • A standalone PivotChart will be created with a reference to the newly created PivotTable.

If the PivotCache already has an associated PivotTable:

  • The PivotCache is cloned

  • A new workbook-level PivotTable is created based on the cloned PivotCache.

  • A standalone PivotChart is created with a reference to the new workbook-level PivotTable.

Example

The following code creates a decoupled PivotChart from a PivotCache object.

VBA Copy code Copy code
Workbooks("Book1").Connections.Add _
     "cubes4 Adventure Works DW 2008 Special Char Adventure Works", "", Array( _
     "OLEDB;Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Data Source=<server name here>;Initial Catalog=Adventure Works DW 2008" _
     , " Special Char"), Array("Adventure Works"), 1
   ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:= _
     ActiveWorkbook.Connections( _
     "cubes4 Adventure Works DW 2008 Special Char Adventure Works"), Version:= _
     xlPivotTableVersion14).CreatePivotChart(ChartDestination:="Sheet1").Select

   ActiveChart.ChartType = xlColumnClustered

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.CreatePivotTable Method (Excel)

 Copy code hover
[image]

PivotCache.CreatePivotTable Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a PivotTable report based on a PivotCache object. Returns a PivotTable object.

Syntax

expression .CreatePivotTable(TableDestination, TableName, ReadData, DefaultVersion)

expression A variable that represents a PivotCache object.

Parameters

Name | Required/Optional | Data Type | Description
TableDestination | Required | Variant | The cell in the upper-left corner of the PivotTable report's destination range (the range on the worksheet where the resulting PivotTable report will be placed). The destination range must be on a worksheet in the workbook that contains the PivotCache object specified by expression.
TableName | Optional | Variant | The name of the new PivotTable report.
ReadData | Optional | Variant | True to create a PivotTable cache that contains all of the records from the external database; this cache can be very large. False to enable setting some of the fields as server-based page fields before the data is actually read.
DefaultVersion | Optional | Variant | The default version of the PivotTable report.

Return Value

PivotTable

Remarks

For an alternative way to create a PivotTable report based on a PivotTable cache, see the Add method of the PivotTables object.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .CommandType = xlCmdCube
 .CommandText = Array("Sales")
 .MaintainConnection = True
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 1
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 1
 End With
End With

This example creates a new PivotTable cache using an ADO connection to Microsoft Jet, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet.

VBA Copy code Copy code
Dim cnnConn As ADODB.Connection
Dim rstRecordset As ADODB.Recordset
Dim cmdCommand As ADODB.Command

' Open the connection.
Set cnnConn = New ADODB.Connection
With cnnConn
 .ConnectionString = _
 "Provider=Microsoft.Jet.OLEDB.4.0"
 .Open "C:\perfdate\record.mdb"
End With

' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnnConn
With cmdCommand
 .CommandText = "Select Speed, Pressure, Time From DynoRun"
 .CommandType = adCmdText
 .Execute
End With

' Open the recordset.
Set rstRecordset = New ADODB.Recordset
Set rstRecordset.ActiveConnection = cnnConn
rstRecordset.Open cmdCommand

' Create a PivotTable cache and report.
Set objPivotCache = ActiveWorkbook.PivotCaches.Add( _
 SourceType:=xlExternal)
Set objPivotCache.Recordset = rstRecordset
With objPivotCache
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:="Performance"
End With

With ActiveSheet.PivotTables("Performance")
 .SmallGrid = False
 With .PivotFields("Pressure")
 .Orientation = xlRowField
 .Position = 1
 End With
 With .PivotFields("Speed")
 .Orientation = xlColumnField
 .Position = 1
 End With
 With .PivotFields("Time")
 .Orientation = xlDataField
 .Position = 1
 End With
End With

' Close the connections and clean up.
cnnConn.Close
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
Set cnnConn = Nothing

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.MakeConnection Method (Excel)

 Copy code hover
[image]

PivotCache.MakeConnection Method (Excel)
See also Send feedback

Published: July 16, 2012

Establishes a connection for the specified PivotTable cache.

Syntax

expression .MakeConnection

expression A variable that represents a PivotCache object.

Remarks

The MakeConnection method can be used after the cache drops a connection and the user wants to reestablish the connection.

Various objects and methods might return a run-time error if the cache is not connected. Use of this method assures a connection before executing other objects or methods.

This method will result in a run-time error if the MaintainConnection property of the specified PivotTable cache has been set to False, the SourceType property of the specified PivotTable cache has not been set to xlExternal, or if the connection is not to an OLE DB data source.

Note Note

Microsoft Excel might drop a connection temporarily in the course of a session (unknown to the VBA programmer), so this method proves useful.

Example

The following example determines if the cache is connected to its source and makes a connection to the source if necessary. This example assumes that a PivotTable cache exists on the active worksheet.

Copy code Copy code
Sub UseMakeConnection()

    Dim pvtCache As PivotCache

    Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

    ' Handle run-time error if external source is not an OLE DB data source.
    On Error GoTo Not_OLEDB

    ' Check connection setting and make connection if necessary.
    If pvtCache.IsConnected = True Then
        MsgBox "The MakeConnection method is not needed."
    Else
        pvtCache.MakeConnection
        MsgBox "A connection has been made."
    End If
    Exit Sub

Not_OLEDB:
    MsgBox "The data source is not an OLE DB data source"

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.Refresh Method (Excel)

 Copy code hover
[image]

PivotCache.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Causes the specified chart to be redrawn immediately.

Syntax

expression .Refresh

expression A variable that represents a PivotCache object.

Example

This example refreshes the PivotTable cache for the first PivotTable report on the first worksheet in a workbook.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotCache.Refresh

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.ResetTimer Method (Excel)

 Copy code hover
[image]

PivotCache.ResetTimer Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.

Syntax

expression .ResetTimer

expression A variable that represents a PivotCache object.

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCache.SaveAsODC Method (Excel)

 Copy code hover
[image]

PivotCache.SaveAsODC Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the PivotTable cache source as an Microsoft Office Data Connection file.

Syntax

expression .SaveAsODC(ODCFileName, Description, Keywords)

expression A variable that represents a PivotCache object.

Parameters

Name | Required/Optional | Data Type | Description
ODCFileName | Required | String | Location to save the file.
Description | Optional | Variant | Description that will be saved in the file.
Keywords | Optional | Variant | Space-separated keywords that can be used to search for this file.

Example

The following example saves the cache source as an ODC file titled "ODCFile". This example assumes a PivotTable cache exists on the active worksheet.

VBA Copy code Copy code
Sub UseSaveAsODC()

 Application.ActiveWorkbook.PivotCaches.Item(1).SaveAsODC ("ODCFile")

End Sub

See also

Concepts

PivotCache Object

Other resources

PivotCache Object Members


PivotCaches Object (Excel)

 Copy code hover
[image]

PivotCaches Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of memory caches from the PivotTable reports in a workbook.

Remarks

Each memory cache is represented by a PivotCache object.

Example

Use the PivotCaches method to return the PivotCaches collection. The following example sets the RefreshOnFileOpen property for all memory caches in the active workbook.

VBA Copy code Copy code
For Each pc In ActiveWorkbook.PivotCaches
 pc.RefreshOnFileOpen = True
Next

See also

Concepts

Excel Object Model Reference

Other resources

PivotCaches Object Members


PivotCaches Members (Excel)

 Copy code hover
[image]

PivotCaches Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of memory caches from the PivotTable reports in a workbook.

Methods

Name | Description
Create | Creates a new PivotCache.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotCaches Properties (Excel)

 Copy code hover
[image]

PivotCaches Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotCaches.Application Property (Excel)

 Copy code hover
[image]

PivotCaches.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotCaches object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCaches.Count Property (Excel)

 Copy code hover
[image]

PivotCaches.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotCaches object.

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCaches.Creator Property (Excel)

 Copy code hover
[image]

PivotCaches.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotCaches object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCaches.Parent Property (Excel)

 Copy code hover
[image]

PivotCaches.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotCaches object.

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCaches Methods (Excel)

 Copy code hover
[image]

PivotCaches Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Create | Creates a new PivotCache.
Item | Returns a single object from a collection.


PivotCaches.Create Method (Excel)

 Copy code hover
[image]

PivotCaches.Create Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new PivotCache.

Version Information

Version Added: Excel 2007

Syntax

expression .Create(SourceType, SourceData, Version)

expression A variable that represents a PivotCaches object.

Parameters

Name | Required/Optional | Data Type | Description
SourceType | Required | XlPivotTableSourceType | SourceType can be one of these xlPivotTableSourceType constants: xlConsolidation, xlDatabase, or xlExternal.
SourceData | Optional | Variant | The data for the new PivotTable cache.
Version | Optional | Variant | Version of the PivotTable. The version can be one of the xlPivotTableVersionList constants.

Return Value

PivotCache

Remarks

The following two xlPivotTableSourceType constants are not supported when creating a PivotCache using this method: xlPivotTable and xlScenario. A run-time error is returned if one of these two constants is supplied.

The SourceData argument is required if SourceType isn't xlExternal. It can be a Range object (when SourceType is either xlConsolidation or xlDatabase) or an Excel Workbook Connection object (when SourceType is xlExternal).

When not supplied, the version of the PivotTable will be xlPivotTableVersion12. The use of the xlPivotTableVersionCurrent constant is not allowed and returns a run-time error if it is supplied.

Example

The following code sample defines a connection and then creates a connection to a PivotCache.

VBA Copy code Copy code
Workbooks("Book1").Connections.Add2 _
        "Target Connection Name", "", Array("OLEDB;Provider=MSOLAP.5;Integrated Security=SSPI;Persist Security Info=True;Data Source=##TargetServer##;Initial Catalog=Adventure Works DW", ""), "Adventure Works", 1
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:=ActiveWorkbook.Connections("Target Connection Name"), _ Version:=xlPivotTableVersion15).CreatePivotChart(ChartDestination:="Sheet1").Select

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCaches.Item Method (Excel)

 Copy code hover
[image]

PivotCaches.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotCaches object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotCache object contained by the collection.

Example

This example refreshes cache one.

VBA Copy code Copy code
ActiveWorkbook.PivotCaches.Item(1).Refresh

See also

Concepts

PivotCaches Object

Other resources

PivotCaches Object Members


PivotCell Object (Excel)

 Copy code hover
[image]

PivotCell Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a cell in a PivotTable report.

Remarks

Use the PivotCell property of the Range collection to return a PivotCell object.

Once a PivotCell object is returned, you can use the ColumnItems or RowItems property to determine the PivotItems collection that corresponds to the items on the column or row axis that represents the selected number. The following example uses the ColumnItems property of the PivotCell object to return a PivotItemList collection.

Example

Once a PivotCell object is returned, you can use the PivotCellType property to determine what type of cell a particular range is. The following example determines if cell A5 in the PivotTable is a data item and notifies the user. This example assumes that a PivotTable exists on the active worksheet and that cell A5 is contained in the PivotTable. If cell A5 is not in the PivotTable, the example handles the run-time error.

VBA Copy code Copy code
Sub CheckPivotCellType()

 On Error GoTo Not_In_PivotTable

 ' Determine if cell A5 is a data item in the PivotTable.
 If Application.Range("A5").PivotCell.PivotCellType = xlPivotCellValue Then
 MsgBox "The PivotCell at A5 is a data item."
 Else
 MsgBox "The PivotCell at A5 is not a data item."
 End If
 Exit Sub

Not_In_PivotTable:
 MsgBox "The chosen cell is not in a PivotTable."

End Sub

This example determines the column field that the data item of cell B5 is in. It then determines if the column field title matches "Inventory" and notifies the user. The example assumes that a PivotTable exists on the active worksheet and that column B of the worksheet contains a column field of the PivotTable.

VBA Copy code Copy code
Sub CheckColumnItems()

 ' Determine if there is a match between the item and column field.
 If Application.Range("B5").PivotCell.ColumnItems.Item(1) = "Inventory" Then
 MsgBox "Item in B5 is a member of the 'Inventory' column field."
 Else
 MsgBox "Item in B5 is not a member of the 'Inventory' column field."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

PivotCell Object Members


PivotCell Members (Excel)

 Copy code hover
[image]

PivotCell Members (Excel)
Send feedback

Published: July 16, 2012

Represents a cell in a PivotTable report.

Methods

Name | Description
AllocateChange | Performs a writeback operation on the specified cell in a PivotTable report based on an OLAP data source.
DiscardChange | Discards changes to the specified cell in a PivotTable report.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CellChanged | Returns whether a PivotTable value cell has been edited or recalculated since the PivotTable report was created or the last commit operation was performed. Read-only
ColumnItems | Returns a PivotItemList collection that corresponds to the items on the column axis that represent the selected range.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomSubtotalFunction | Returns the custom subtotal function field setting of a PivotCell object. Read-only XlConsolidationFunction.
DataField | Returns a PivotField object that corresponds to the selected data field.
DataSourceValue | Returns the value last retrieved from the data source for edited cells in a PivotTable report. Read-only
MDX | Returns a tuple that provides the full MDX coordinates of the specified value cell in PivotTable with an OLAP data source. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PivotCellType | Returns one of the XlPivotCellType constants that identifies the PivotTable entity the cell corresponds to. Read-only.
PivotColumnLine | Returns the PivotLine on a column for a specific PivotCell object. Read-only PivotLine.
PivotField | Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.
PivotItem | Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
PivotRowLine | Returns the PivotLine on a row for a specific PivotCell object. Read-only PivotLine.
PivotTable | Returns a PivotTable object that represents the PivotTable report associated with the PivotCell.
Range | Returns a Range object that represents the range the specified PivotCell applies to.
RowItems | Returns a PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.
ServerActions | Represents a collection of actions consisting of OLAP-defined actions which can be executed. The actions are specific to PivotTables existing at a worksheet-level. Read-only


PivotCell Properties (Excel)

 Copy code hover
[image]

PivotCell Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CellChanged | Returns whether a PivotTable value cell has been edited or recalculated since the PivotTable report was created or the last commit operation was performed. Read-only
ColumnItems | Returns a PivotItemList collection that corresponds to the items on the column axis that represent the selected range.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomSubtotalFunction | Returns the custom subtotal function field setting of a PivotCell object. Read-only XlConsolidationFunction.
DataField | Returns a PivotField object that corresponds to the selected data field.
DataSourceValue | Returns the value last retrieved from the data source for edited cells in a PivotTable report. Read-only
MDX | Returns a tuple that provides the full MDX coordinates of the specified value cell in PivotTable with an OLAP data source. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PivotCellType | Returns one of the XlPivotCellType constants that identifies the PivotTable entity the cell corresponds to. Read-only.
PivotColumnLine | Returns the PivotLine on a column for a specific PivotCell object. Read-only PivotLine.
PivotField | Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.
PivotItem | Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
PivotRowLine | Returns the PivotLine on a row for a specific PivotCell object. Read-only PivotLine.
PivotTable | Returns a PivotTable object that represents the PivotTable report associated with the PivotCell.
Range | Returns a Range object that represents the range the specified PivotCell applies to.
RowItems | Returns a PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.
ServerActions | Represents a collection of actions consisting of OLAP-defined actions which can be executed. The actions are specific to PivotTables existing at a worksheet-level. Read-only


PivotCell.Application Property (Excel)

 Copy code hover
[image]

PivotCell.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotCell object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.CellChanged Property (Excel)

 Copy code hover
[image]

PivotCell.CellChanged Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether a PivotTable value cell has been edited or recalculated since the PivotTable report was created or the last commit operation was performed. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .CellChanged

expression A variable that represents a PivotCell object.

Return Value

XlCellChangedState

Remarks

The value of the CellChanged property is xlCellNotChanged by default.

For PivotTable reports with non-OLAP data sources, the value of this property can be only either xlCellNotChanged or xlCellChanged. It is xlCellNotChanged for cells that have not been edited, and is xlCellChanged for cells that have been edited. Discarding changes sets its value to xlCellNotChanged.

Applying and saving changes applies only to PivotTable reports with OLAP data sources. The following list of descriptions of the possible states of the CellChange property apply only to PivotTables with OLAP data sources:

  • xlCellNotChanged - the cell has not been edited or recalculated (if the cell contains a formula) since the PivotTable was created, or since the last save or discard changes operation was performed.

  • xlCellChanged - the cell has been edited or recalculated since the PivotTable was created, or since the last apply changes or save changes operation was performed, but that change has not yet been applied (the UPDATE CUBE statement has not been run for it).

  • xlCellChangeApplied - the cell has been edited or recalculated since the PivotTable was created, or since the last apply changes, save changes, or discard changes operation was performed, and that change has been applied (the UPDATE CUBE statement has been run for it).

The following table lists descriptions of how different actions by the user affect the setting of the CellChanged property in a PivotTable with an OLAP data source.

User Action | Setting of CellChanged property for cells without formulas | Setting of CellChanged property for cells with formulas
Types a value or formula into a cell or multiple cells. | Set to xlCellChanged for those cells. | Set to xlCellChanged for those cells.
Recalculates a cell or multiple cells with a formula, either manually (F9) or automatically by Excel. | N/A | Set to xlCellChanged for those cells.
Saves (commits) changes. | Set to xlCellNotChanged for all edited cells without a formula. | Set to xlCellChangeApplied for all edited cells with a formula.
Discards all changes. | Set to xlCellNotChanged for all edited cells without a formula. | Set to xlCellNotChanged for all edited cells with a formula.
Discards change in single cell. | Set to xlCellNotChanged for that cell only. | Set to xlCellNotChanged for that cell only.
Clears multiple cells in one operation. | Set to xlCellNotChanged for all those cells. | Set to xlCellNotChanged for all those cells.
Clears a cell. | Set to xlCellNotChanged for that cell only. | Set to xlCellNotChanged for that cell only.
Performs an undo operation that changes the value back to a previously edited value, before that value was applied. | Set to xlCellChanged for all edited cells without a formula. | Set to xlCellChanged for all edited cells with a formula.
Performs an undo operation that changes the value back to a previously edited value, after that value was applied. | Set to xlCellChangedApplied for all edited cells without a formula. | Set to xlCellChangeApplied for all edited cells with a formula.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.ColumnItems Property (Excel)

 Copy code hover
[image]

PivotCell.ColumnItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotItemList collection that corresponds to the items on the column axis that represent the selected range.

Syntax

expression .ColumnItems

expression A variable that represents a PivotCell object.

Example

This example determines if the data item in cell B5 is under the Inventory item in the first column field and notifies the user. The example assumes that a PivotTable exists on the active worksheet and that column B contains a column field of the PivotTable.

VBA Copy code Copy code
Sub CheckColumnItems()

 ' Determine if there is a match between the item and column field.
 If Application.Range("B5").PivotCell.ColumnItems.Item(1) = "Inventory" Then
 MsgBox "Item in B5 is a member of the 'Inventory' column field."
 Else
 MsgBox "Item in B5 is not a member of the 'Inventory' column field."
 End If

End Sub

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.Creator Property (Excel)

 Copy code hover
[image]

PivotCell.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotCell object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.CustomSubtotalFunction Property (Excel)

 Copy code hover
[image]

PivotCell.CustomSubtotalFunction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the custom subtotal function field setting of a PivotCell object. Read-only XlConsolidationFunction.

Syntax

expression .CustomSubtotalFunction

expression A variable that represents a PivotCell object.

Remarks

XlConsolidationFunction can be one of these XlConsolidationFunction constants.

xlAverage

xlCount

xlCountNums

xlMax

xlMin

xlProduct

xlStDev

xlStDevP

xlSum

xlUnknown

xlVar

xlVarP

The CustomSubtotalFunction property will return an error if the PivotCell object type is not a custom subtotal. This property applies only to non-OLAP source data.

Example

This example determines if cell C20 contains a custom subtotal function that uses a consolidation function of count and then it notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseCustomSubtotalFunction()

 On Error GoTo Not_A_Function

 ' Determine if custom subtotal function is a count function.
 If Application.Range("C20").PivotCell.CustomSubtotalFunction = xlCount Then
 MsgBox "The custom subtotal function is a Count."
 Else
 MsgBox "The custom subtotal function is not a Count."
 End If
 Exit Sub

Not_A_Function:
 MsgBox "The selected cell is not a custom subtotal function."

End Sub

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.DataField Property (Excel)

 Copy code hover
[image]

PivotCell.DataField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that corresponds to the selected data field.

Syntax

expression .DataField

expression A variable that represents a PivotCell object.

Remarks

This property will return an error if the PivotCell object is not one of the allowed constants of XlPivotCellType: xlPivotCellTypeDataField, xlPivotCellTypeSubtotal, or xlPivotCellTypeGrandTotal.

Example

This example determines if cell L10 is in the data field of the PivotTable and either returns the PivotTable field that corresponds to the cell by notifying the user, or handles the run-time error. The example assumes a PivotTable exists in the active worksheet.

VBA Copy code Copy code
Sub CheckDataField()

 On Error GoTo Not_In_DataField

 MsgBox Application.Range("L10").PivotCell.DataField
 Exit Sub

Not_In_DataField:
 MsgBox "The selected range is not in the data field of the PivotTable."

End Sub

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.DataSourceValue Property (Excel)

 Copy code hover
[image]

PivotCell.DataSourceValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value last retrieved from the data source for edited cells in a PivotTable report. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .DataSourceValue

expression A variable that represents a PivotCell object.

Return Value

Variant

Remarks

Whenever a cell in the values area of a PivotTable report is edited, the DataSourceValue property will hold the value that was last retrieved from the data source before editing took place. For PivotTable report value cells that have not been edited, or for which the data source value has not been explicitly retrieved, this property will return NULL. For PivotTable reports with OLAP data sources, the value of the DataSourceValue property is retrieved from a separate connection to ensure that it does not contain the value of any writeback operations that the user might have made.

Reading the DataSourceValue property for cells that are outside of the values area of a PivotTable report generates a run-time error.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.MDX Property (Excel)

 Copy code hover
[image]

PivotCell.MDX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a tuple that provides the full MDX coordinates of the specified value cell in PivotTable with an OLAP data source. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .MDX

expression A variable that represents a PivotCell object.

Return Value

String

Remarks

The dimensions returned in the tuple by the MDX property include row and column coordinates as well as report filter coordinates. For cells outside the values area of the PivotTable, and outside a PivotTable, accessing this property will generate a run-time error. For PivotTables with multi-item selection in a report filter field, accessing this property will also generate a run-time error.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.Parent Property (Excel)

 Copy code hover
[image]

PivotCell.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotCell object.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotCellType Property (Excel)

 Copy code hover
[image]

PivotCell.PivotCellType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the XlPivotCellType constants that identifies the PivotTable entity the cell corresponds to. Read-only.

Syntax

expression .PivotCellType

expression A variable that represents a PivotCell object.

Remarks

XlPivotCellType can be one of these XlPivotCellType constants.

xlPivotCellBlankCell A structural blank cell in the PivotTable.

xlPivotCellCustomSubtotal A cell in the row or column area that is a custom subtotal.

xlPivotCellDataField A data field label (not the Data button).

xlPivotCellDataPivotField The Data button.

xlPivotCellGrandTotal A cell in a row or column area which is a grand total.

xlPivotCellPageFieldItem The cell that shows the selected item of a Page field.

xlPivotCellPivotField The button for a field (not the Data button).

xlPivotCellPivotItem A cell in the row or column area which is not a subtotal, grand total, custom subtotal, or blank line.

xlPivotCellSubtotal A cell in the row or column area which is a subtotal.

xlPivotCellValue Any cell in the data area (except a blank row).

Example

This example determines if cell A5 in the PivotTable is a data item and notifies the user. The example assumes a PivotTable exists on the active worksheet and cell A5 is contained in the PivotTable. If cell A5 is not in the PivotTable, the example handles the run-time error.

VBA Copy code Copy code
Sub CheckPivotCellType()

 On Error GoTo Not_In_PivotTable

 ' Determine if cell A5 is a data item in the PivotTable.
 If Application.Range("A5").PivotCell.PivotCellType = xlPivotCellValue Then
 MsgBox "The cell at A5 is a data item."
 Else
 MsgBox "The cell at A5 is not a data item."
 End If
 Exit Sub

Not_In_PivotTable:
 MsgBox "The chosen cell is not in a PivotTable."

End Sub

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotColumnLine Property (Excel)

 Copy code hover
[image]

PivotCell.PivotColumnLine Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotLine on a column for a specific PivotCell object. Read-only PivotLine.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotColumnLine

expression A variable that represents a PivotCell object.

Remarks

If the PivotCell is on rows, the PivotColumnLine property returns a run-time error.

If the PivotCell is on columns, the PivotColumnLine property returns the column PivotLine object.

If the PivotCell is in the data area, the PivotColumnLine property returns the corresponding column PivotLine object.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotField Property (Excel)

 Copy code hover
[image]

PivotCell.PivotField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.

Syntax

expression .PivotField

expression A variable that represents a PivotCell object.

Example

This example displays the name of the PivotTable field that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active cell is in the field " & _
 ActiveCell.PivotField.Name

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotItem Property (Excel)

 Copy code hover
[image]

PivotCell.PivotItem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.

Syntax

expression .PivotItem

expression A variable that represents a PivotCell object.

Example

This example displays the name of the PivotTable item that contains the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active cell is in the item " & _
 ActiveCell.PivotItem.Name

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotRowLine Property (Excel)

 Copy code hover
[image]

PivotCell.PivotRowLine Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotLine on a row for a specific PivotCell object. Read-only PivotLine.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotRowLine

expression A variable that represents a PivotCell object.

Remarks

If the PivotCell is on rows, PivotRowLine returns the row's PivotLine object.

If the PivotCell is on columns, PivotRowLine returns a run-time error.

If the PivotCell is in the data area, PivotRowLine returns the corresponding row's PivotLine object.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.PivotTable Property (Excel)

 Copy code hover
[image]

PivotCell.PivotTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotTable object that represents the PivotTable report associated with the PivotCell.

Syntax

expression .PivotTable

expression A variable that represents a PivotCell object.

Example

This example sets the current page for the PivotTable report on Sheet1 to the page named "Canada."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.PivotFields("Country").CurrentPage = "Canada"

This example determines the PivotTable report associated with the Sales chart on the active worksheet, and then it sets the page named "Oregon" as the current page for the PivotTable report.

VBA Copy code Copy code
Set objPT = _
 ActiveSheet.Charts("Sales").PivotLayout.PivotTable
objPT.PivotFields("State").CurrentPageName = "Oregon"

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.Range Property (Excel)

 Copy code hover
[image]

PivotCell.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range the specified PivotCell applies to.

Syntax

expression .Range

expression A variable that represents a PivotCell object.

Example

The following example stores in a variable the address for the AutoFilter applied to the Crew worksheet.

VBA Copy code Copy code
rAddress = Worksheets("Crew").AutoFilter.Range.Address

This example scrolls through the workbook window until the hyperlink range is in the upper-left corner of the active window.

VBA Copy code Copy code
Workbooks(1).Activate
Set hr = ActiveSheet.Hyperlinks(1).Range
ActiveWindow.ScrollRow = hr.Row
ActiveWindow.ScrollColumn = hr.Column

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.RowItems Property (Excel)

 Copy code hover
[image]

PivotCell.RowItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotItemList collection that corresponds to the items on the category axis that represent the selected cell.

Syntax

expression .RowItems

expression A variable that represents a PivotCell object.

Example

This example determines if the data item in cell B5 is under the Inventory item in the first row field and notifies the user. The example assumes a PivotTable exists on the active worksheet and that column B of the worksheet contains a row item of the PivotTable.

VBA Copy code Copy code
Sub CheckRowItems()

 ' Determine if there is a match between the item and row field.
 If Application.Range("B5").PivotCell.RowItems.Item(1) = "Inventory" Then
 MsgBox "Cell B5 is a member of the 'Inventory' row field.
 Else
 MsgBox "Cell B5 is not a member of the 'Inventory' row field.
 End If

End Sub

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.ServerActions Property (Excel)

 Copy code hover
[image]

PivotCell.ServerActions Property (Excel)
See also Send feedback

Published: July 16, 2012

Represents a collection of actions consisting of OLAP-defined actions which can be executed. The actions are specific to PivotTables existing at a worksheet-level. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ServerActions

expression A variable that represents a PivotCell object.

Remarks

A server action is an optional feature that an OLAP cube administrator can define on a server that uses a cube member or measure as a parameter into a query to obtain details in the cube.

Example

The following code segment executes a server action against a series in a PivotChart.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 1").Chart.PivotLayout.PivotTable.PivotColumnAxis.PivotLines(index of line).PivotLineCells(index of cells).ServerAction("OLAP Action name").Execute

Property value

ACTIONS

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell Methods (Excel)

 Copy code hover
[image]

PivotCell Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AllocateChange | Performs a writeback operation on the specified cell in a PivotTable report based on an OLAP data source.
DiscardChange | Discards changes to the specified cell in a PivotTable report.


PivotCell.AllocateChange Method (Excel)

 Copy code hover
[image]

PivotCell.AllocateChange Method (Excel)
See also Send feedback

Published: July 16, 2012

Performs a writeback operation on the specified cell in a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Syntax

expression .AllocateChange

expression A variable that represents a PivotCell object.

Return Value

Nothing

Remarks

This method executes an UPDATE CUBE statement to add just the change in this particular cell, but also includes any previous changes applied. After the UPDATE CUBE statement is executed, a PivotTable update is run, and then a ROLLBACK TRANSACTION statement is executed.

Running the AllocateChange method for a cell in a PivotTable report based on a non-OLAP data source generates a run-time error.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotCell.DiscardChange Method (Excel)

 Copy code hover
[image]

PivotCell.DiscardChange Method (Excel)
See also Send feedback

Published: July 16, 2012

Discards changes to the specified cell in a PivotTable report.

Version Information

Version Added: Excel 2010

Syntax

expression .DiscardChange

expression A variable that represents a PivotCell object.

Return Value

Nothing

Remarks

For a cell in a PivotTable based on an OLAP data source, the DiscardChange method removes the value or formula entered in the specified cell, and then runs a PivotTable update to retrieve the latest value from the data source. The data source value will be set to NULL by this method for the specified cell. The method also removes all changes made to this cell from the Excel change list so that it will no longer be included in the UPDATE CUBE statement for the data source. This method also recreates the session state for all other changes made in the transaction. This includes executing a ROLLBACK TRANSACTION statement, and then executing an UPDATE CUBE statement with all changes except for the specified cell. For a cell in a PivotTable based on a non-OLAP data source, this method clears the edited cell.

See also

Concepts

PivotCell Object

Other resources

PivotCell Object Members


PivotField Object (Excel)

 Copy code hover
[image]

PivotField Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a field in a PivotTable report.

Remarks

The PivotField object is a member of the PivotFields collection. The PivotFields collection contains all the fields in a PivotTable report, including hidden fields.

In some cases, it may be easier to use one of the properties that returns a subset of the PivotTable fields. The following properties are available:

  • ColumnFields property

  • DataFields property

  • HiddenFields property

  • PageFields property

  • RowFields property

  • VisibleFields property

Example

Use PivotFields(index), where index is the field name or index number, to return a single PivotField object. The following example makes the Year field a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").Orientation = xlRowField

See also

Concepts

Excel Object Model Reference

Other resources

PivotField Object Members


PivotField Members (Excel)

 Copy code hover
[image]

PivotField Members (Excel)
Send feedback

Published: July 16, 2012

Represents a field in a PivotTable report.

Methods

Name | Description
AddPageItem | Adds an additional item to a multiple item page field.
AutoShow | Displays the number of top or bottom items for a row, page, or column field in the specified PivotTable report.
AutoSort | Establishes automatic field-sorting rules for PivotTable reports.
CalculatedItems | Returns a CalculatedItems collection that represents all the calculated items in the specified PivotTable report. Read-only.
ClearAllFilters | Calling this method deletes all filters currently applied to the PivotField. This includes deleting all filters from the PivotFilters collection of the PivotField and removing any manual filtering applied to the PivotField as well. If the PivotField is in the Report Filter area, the item selected will be set to the default item.
ClearLabelFilters | This method deletes all label filters or all date filters in the PivotFilters collection of the PivotField.
ClearManualFilter | Provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList and VisibleItemsList collections in OLAP PivotTables.
ClearValueFilters | Calling this method deletes all value filters in the PivotFilters collection of the PivotField.
Delete | Deletes the object.
DrillTo | The DrillTo method supports drilling to a specified PivotField from another PivotField.
PivotItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the visible and hidden items (a PivotItems object) in the specified field. Read-only.

Properties

Name | Description
AllItemsVisible | Used to retrieve a Boolean value that indicates whether or not any manual filtering is applied to the PivotField. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShowCount | Returns the number of top or bottom items that are automatically shown in the specified PivotTable field. Read-only Long.
AutoShowField | Returns the name of the data field used to determine the top or bottom items that are automatically shown in the specified PivotTable field. Read-only String.
AutoShowRange | Returns xlTop if the top items are shown automatically in the specified PivotTable field; returns xlBottom if the bottom items are shown. Read-only Long.
AutoShowType | Returns xlAutomatic if AutoShow is enabled for the specified PivotTable field; returns xlManual if AutoShow is disabled. Read-only Long.
AutoSortCustomSubtotal | Returns the name of the custom subtotal used to sort the specified PivotTable field automatically. Read-only.
AutoSortField | Returns the name of the data field used to sort the specified PivotTable field automatically. Read-only String.
AutoSortOrder | Returns the order used to sort the specified PivotTable field automatically. Can be one of the constants of XlSortOrder. Read-only Long.
AutoSortPivotLine | Returns the name of the PivotLine used to sort the specified PivotTable field automatically. Read-only.
BaseField | Returns or sets the base field for a custom calculation. This property is valid only for data fields. Read/write Variant.
BaseItem | Returns or sets the item in the base field for a custom calculation. Valid only for data fields. Read/write Variant.
Calculation | Returns or sets a XlPivotFieldCalculation value that represents the type of calculation performed by the specified field. This property is valid only for data fields.
Caption | Returns a String value that represents the label text for the pivot field.
ChildField | Returns a PivotField object that represents the child field for the specified field (if the field is grouped and has a child field). Read-only.
ChildItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeField | Returns the CubeField object from which the specified PivotTable field is descended. Read-only.
CurrentPage | Returns or sets the current page showing for the page field (valid only for page fields). Read/write PivotItem.
CurrentPageList | Returns or sets an array of strings corresponding to the list of items included in a multiple-item page field of a PivotTable report. Read/write Variant.
CurrentPageName | Returns or sets the currently displayed page of the specified PivotTable report. The name of the page appears in the page field. Note that this property works only if the currently displayed page already exists. Read/write String.
DatabaseSort | When set to True, manual repositioning of items in a PivotTable field is allowed. Returns True, if the field has no manually positioned items. Read/write Boolean.
DataRange | Returns a Range object as shown in the following table. Read-only.
DataType | Returns a XlPivotFieldDataType value that represents the type of data in the PivotTable field.
DisplayAsCaption | This property is used to display member properties of PivotFields as captions. Read-only.
DisplayAsTooltip | This property is used to specify whether or not a specific member property PivotField is displayed in tooltips. Read/write Boolean.
DisplayInReport | This property is used to specify whether the specified member property PivotField is displayed in the PivotTable or not. Read/write Boolean.
DragToColumn | True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.
DragToData | True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean
DragToHide | True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.
DragToPage | True if the field can be dragged to the page position. The default value is True. Read/write Boolean.
DragToRow | True if the field can be dragged to the row position. The default value is True. Read/write Boolean.
DrilledDown | True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.
EnableItemSelection | When set to False, disables the ability to use the field dropdown in the user interface. The default value is True. Read/write Boolean.
EnableMultiplePageItems | Used for specifying whether or not check boxes are present in the filter drop-down list for fields in the page area. Read/write Boolean.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
Function | Returns or sets the function used to summarize the PivotTable field (data fields only). Read/write XlConsolidationFunction.
GroupLevel | Returns the placement of the specified field within a group of fields (if the field is a member of a grouped set of fields). Read-only.
Hidden | This property is used to hide the individual levels of an OLAP hierarchy. Read/write Boolean.
HiddenItems | Returns an object that represents either a single hidden PivotTable item (a PivotItem object) or a collection of all the hidden items (a PivotItems object) in the specified field. Read-only.
HiddenItemsList | Returns or sets a Variant specifying an array of strings that are hidden items for a PivotTable field. Read/write.
IncludeNewItemsInFilter | Allows developers to specify whether excluded or included items should be tracked when manual filtering is applied to the PivotField. Read/write Boolean.
IsCalculated | True if the PivotTable field is a calculated field or item. Read-only Boolean.
IsMemberProperty | Returns True when the PivotField contains member properties. Read-only Boolean.
LabelRange | Returns a Range object that represents the cell (or cells) that contain the field label. Read-only
LayoutBlankLine | True if a blank row is inserted after the specified row field in a PivotTable report. The default value is False. Read/write Boolean.
LayoutCompactRow | Specifies whether or not a PivotField is compacted (items of multiple PivotFields are displayed in a single column) when rows are selected. Read/write Boolean.
LayoutForm | Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.
LayoutPageBreak | True if a page break is inserted after each field. The default value is False. Read/write Boolean.
LayoutSubtotalLocation | Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.
MemberPropertyCaption | Setting the MemberPropertyCaption property controls which member property is used as caption for a given level. Read/write Boolean.
MemoryUsed | Returns the amount of memory currently being used by the object, in bytes. Read-only Long.
Name | Returns or sets a String value representing the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
Orientation | Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.
Parent | Returns the parent object for the specified object. Read-only.
ParentField | Returns a PivotField object that represents the PivotTable field that's the group parent of the specified object. The field must be grouped and must have a parent field. Read-only.
ParentItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group parents in the specified field. The specified field must be a group parent of another field. Read-only.
PivotFilters | Returns or sets the PivotFilters for the specified PivotField object. Read-only.
Position | Returns or sets a Variant value that represents the position of the field (first, second, third, and so on) among all the fields in its orientation (Rows, Columns, Pages, Data).
PropertyOrder | Valid only for PivotTable fields that are member property fields. Returns a Long indicating the display position of the member property within the cube field to which it belongs. Read/write.
PropertyParentField | Returns a PivotField object representing the field to which the properties in this field pertain.
RepeatLabels | Returns or sets whether item labels are repeated in the PivotTable for the specified PivotField. Read/write
ServerBased | True if the data source for the specified PivotTable report is external and only the items matching the page field selection are retrieved. Read/write Boolean.
ShowAllItems | True if all items in the PivotTable report are displayed, even if they don't contain summary data. The default value is False. Read/write Boolean.
ShowDetail | Gets or sets whether the specified PivotField is showing detail. Read/write Boolean.
ShowingInAxis | Indicates if the PivotField is currently visible in the PivotTable or not. Read-only.
SourceCaption | The SourceCaption property is applicable only for OLAP PivotTables, and returns the original caption from the OLAP server for a PivotField. Read-only.
SourceName | Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
SubtotalName | Returns or sets the text string label displayed in the subtotal column or row heading in the specified PivotTable report. The default value is the string "Subtotal". Read/write String.
Subtotals | Returns or sets subtotals displayed with the specified field. Valid only for nondata fields. Read/write Variant.
TotalLevels | Returns the total number of fields in the current field group. If the field isn't grouped, or if the data source is OLAP-based, TotalLevels returns the value 1. Read-only Long.
UseMemberPropertyAsCaption | This property is used to control whether member property captions are used for PivotItem captions of the PivotField. Read/write Boolean.
Value | Returns or sets a String value that represents the name of the specified field in the PivotTable report.
VisibleItems | Returns an object that represents either a single visible PivotTable item (a PivotItem object) or a collection of all the visible items (a PivotItems object) in the specified field. Read-only.
VisibleItemsList | Returns or sets a Variant specifying an array of strings that represent included items in a manual filter applied to a PivotField. Read/write.


PivotField Properties (Excel)

 Copy code hover
[image]

PivotField Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
AllItemsVisible | Used to retrieve a Boolean value that indicates whether or not any manual filtering is applied to the PivotField. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShowCount | Returns the number of top or bottom items that are automatically shown in the specified PivotTable field. Read-only Long.
AutoShowField | Returns the name of the data field used to determine the top or bottom items that are automatically shown in the specified PivotTable field. Read-only String.
AutoShowRange | Returns xlTop if the top items are shown automatically in the specified PivotTable field; returns xlBottom if the bottom items are shown. Read-only Long.
AutoShowType | Returns xlAutomatic if AutoShow is enabled for the specified PivotTable field; returns xlManual if AutoShow is disabled. Read-only Long.
AutoSortCustomSubtotal | Returns the name of the custom subtotal used to sort the specified PivotTable field automatically. Read-only.
AutoSortField | Returns the name of the data field used to sort the specified PivotTable field automatically. Read-only String.
AutoSortOrder | Returns the order used to sort the specified PivotTable field automatically. Can be one of the constants of XlSortOrder. Read-only Long.
AutoSortPivotLine | Returns the name of the PivotLine used to sort the specified PivotTable field automatically. Read-only.
BaseField | Returns or sets the base field for a custom calculation. This property is valid only for data fields. Read/write Variant.
BaseItem | Returns or sets the item in the base field for a custom calculation. Valid only for data fields. Read/write Variant.
Calculation | Returns or sets a XlPivotFieldCalculation value that represents the type of calculation performed by the specified field. This property is valid only for data fields.
Caption | Returns a String value that represents the label text for the pivot field.
ChildField | Returns a PivotField object that represents the child field for the specified field (if the field is grouped and has a child field). Read-only.
ChildItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeField | Returns the CubeField object from which the specified PivotTable field is descended. Read-only.
CurrentPage | Returns or sets the current page showing for the page field (valid only for page fields). Read/write PivotItem.
CurrentPageList | Returns or sets an array of strings corresponding to the list of items included in a multiple-item page field of a PivotTable report. Read/write Variant.
CurrentPageName | Returns or sets the currently displayed page of the specified PivotTable report. The name of the page appears in the page field. Note that this property works only if the currently displayed page already exists. Read/write String.
DatabaseSort | When set to True, manual repositioning of items in a PivotTable field is allowed. Returns True, if the field has no manually positioned items. Read/write Boolean.
DataRange | Returns a Range object as shown in the following table. Read-only.
DataType | Returns a XlPivotFieldDataType value that represents the type of data in the PivotTable field.
DisplayAsCaption | This property is used to display member properties of PivotFields as captions. Read-only.
DisplayAsTooltip | This property is used to specify whether or not a specific member property PivotField is displayed in tooltips. Read/write Boolean.
DisplayInReport | This property is used to specify whether the specified member property PivotField is displayed in the PivotTable or not. Read/write Boolean.
DragToColumn | True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.
DragToData | True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean
DragToHide | True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.
DragToPage | True if the field can be dragged to the page position. The default value is True. Read/write Boolean.
DragToRow | True if the field can be dragged to the row position. The default value is True. Read/write Boolean.
DrilledDown | True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.
EnableItemSelection | When set to False, disables the ability to use the field dropdown in the user interface. The default value is True. Read/write Boolean.
EnableMultiplePageItems | Used for specifying whether or not check boxes are present in the filter drop-down list for fields in the page area. Read/write Boolean.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
Function | Returns or sets the function used to summarize the PivotTable field (data fields only). Read/write XlConsolidationFunction.
GroupLevel | Returns the placement of the specified field within a group of fields (if the field is a member of a grouped set of fields). Read-only.
Hidden | This property is used to hide the individual levels of an OLAP hierarchy. Read/write Boolean.
HiddenItems | Returns an object that represents either a single hidden PivotTable item (a PivotItem object) or a collection of all the hidden items (a PivotItems object) in the specified field. Read-only.
HiddenItemsList | Returns or sets a Variant specifying an array of strings that are hidden items for a PivotTable field. Read/write.
IncludeNewItemsInFilter | Allows developers to specify whether excluded or included items should be tracked when manual filtering is applied to the PivotField. Read/write Boolean.
IsCalculated | True if the PivotTable field is a calculated field or item. Read-only Boolean.
IsMemberProperty | Returns True when the PivotField contains member properties. Read-only Boolean.
LabelRange | Returns a Range object that represents the cell (or cells) that contain the field label. Read-only
LayoutBlankLine | True if a blank row is inserted after the specified row field in a PivotTable report. The default value is False. Read/write Boolean.
LayoutCompactRow | Specifies whether or not a PivotField is compacted (items of multiple PivotFields are displayed in a single column) when rows are selected. Read/write Boolean.
LayoutForm | Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.
LayoutPageBreak | True if a page break is inserted after each field. The default value is False. Read/write Boolean.
LayoutSubtotalLocation | Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.
MemberPropertyCaption | Setting the MemberPropertyCaption property controls which member property is used as caption for a given level. Read/write Boolean.
MemoryUsed | Returns the amount of memory currently being used by the object, in bytes. Read-only Long.
Name | Returns or sets a String value representing the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
Orientation | Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.
Parent | Returns the parent object for the specified object. Read-only.
ParentField | Returns a PivotField object that represents the PivotTable field that's the group parent of the specified object. The field must be grouped and must have a parent field. Read-only.
ParentItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group parents in the specified field. The specified field must be a group parent of another field. Read-only.
PivotFilters | Returns or sets the PivotFilters for the specified PivotField object. Read-only.
Position | Returns or sets a Variant value that represents the position of the field (first, second, third, and so on) among all the fields in its orientation (Rows, Columns, Pages, Data).
PropertyOrder | Valid only for PivotTable fields that are member property fields. Returns a Long indicating the display position of the member property within the cube field to which it belongs. Read/write.
PropertyParentField | Returns a PivotField object representing the field to which the properties in this field pertain.
RepeatLabels | Returns or sets whether item labels are repeated in the PivotTable for the specified PivotField. Read/write
ServerBased | True if the data source for the specified PivotTable report is external and only the items matching the page field selection are retrieved. Read/write Boolean.
ShowAllItems | True if all items in the PivotTable report are displayed, even if they don't contain summary data. The default value is False. Read/write Boolean.
ShowDetail | Gets or sets whether the specified PivotField is showing detail. Read/write Boolean.
ShowingInAxis | Indicates if the PivotField is currently visible in the PivotTable or not. Read-only.
SourceCaption | The SourceCaption property is applicable only for OLAP PivotTables, and returns the original caption from the OLAP server for a PivotField. Read-only.
SourceName | Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
SubtotalName | Returns or sets the text string label displayed in the subtotal column or row heading in the specified PivotTable report. The default value is the string "Subtotal". Read/write String.
Subtotals | Returns or sets subtotals displayed with the specified field. Valid only for nondata fields. Read/write Variant.
TotalLevels | Returns the total number of fields in the current field group. If the field isn't grouped, or if the data source is OLAP-based, TotalLevels returns the value 1. Read-only Long.
UseMemberPropertyAsCaption | This property is used to control whether member property captions are used for PivotItem captions of the PivotField. Read/write Boolean.
Value | Returns or sets a String value that represents the name of the specified field in the PivotTable report.
VisibleItems | Returns an object that represents either a single visible PivotTable item (a PivotItem object) or a collection of all the visible items (a PivotItems object) in the specified field. Read-only.
VisibleItemsList | Returns or sets a Variant specifying an array of strings that represent included items in a manual filter applied to a PivotField. Read/write.


PivotField.AllItemsVisible Property (Excel)

 Copy code hover
[image]

PivotField.AllItemsVisible Property (Excel)
See also Send feedback

Published: July 16, 2012

Used to retrieve a Boolean value that indicates whether or not any manual filtering is applied to the PivotField. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .AllItemsVisible

expression A variable that represents a PivotField object.

Remarks

This property provides a simple way to easily check whether manual filtering is applied to a PivotField or CubeField.

For OLAP PivotTables, this property is available only for the CubeField object. Trying to get or set it on the PivotField object in OLAP PivotTables will return a run-time error.

For PivotTables, this property is available for the PivotField object.

The default value is True. This property is automatically set to True when no manual filtering is applied (independent of whether the IncludeNewItemsInFilter property is True or False). It is automatically set to False when any manual filtering is applied (independent of whether the IncludeNewItemsInFilter property is True or False).

This property directly reflects the state of the Select All check box in the filter drop-down lislt for the PivotField or CubeField.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Application Property (Excel)

 Copy code hover
[image]

PivotField.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotField object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoShowCount Property (Excel)

 Copy code hover
[image]

PivotField.AutoShowCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of top or bottom items that are automatically shown in the specified PivotTable field. Read-only Long.

Syntax

expression .AutoShowCount

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoShow parameters for the Salesman field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("salesman")
 If .AutoShowType = xlAutomatic Then
 r = .AutoShowRange
 If r = xlTop Then
 rn = "top"
 Else
 rn = "bottom"
 End If
 MsgBox "PivotTable report is showing " & rn & " " & _
 .AutoShowCount & " items in " & .Name & _
 " field by " & .AutoShowField
 Else
 MsgBox "PivotTable report is not using AutoShow for this field"
 End If
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoShowField Property (Excel)

 Copy code hover
[image]

PivotField.AutoShowField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the data field used to determine the top or bottom items that are automatically shown in the specified PivotTable field. Read-only String.

Syntax

expression .AutoShowField

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoShow parameters for the Salesman field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("salesman")
 If .AutoShowType = xlAutomatic Then
 r = .AutoShowRange
 If r = xlTop Then
 rn = "top"
 Else
 rn = "bottom"
 End If
 MsgBox "PivotTable report is showing " & rn & " " & _
 .AutoShowCount & " items in " & .Name & _
 " field by " & .AutoShowField
 Else
 MsgBox "PivotTable report is not using AutoShow for this field"
 End If
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoShowRange Property (Excel)

 Copy code hover
[image]

PivotField.AutoShowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns xlTop if the top items are shown automatically in the specified PivotTable field; returns xlBottom if the bottom items are shown. Read-only Long.

Syntax

expression .AutoShowRange

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoShow parameters for the Salesman field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("salesman")
 If .AutoShowType = xlAutomatic Then
 r = .AutoShowRange
 If r = xlTop Then
 rn = "top"
 Else
 rn = "bottom"
 End If
 MsgBox "PivotTable report is showing " & rn & " " & _
 .AutoShowCount & " items in " & .Name & _
 " field by " & .AutoShowField
 Else
 MsgBox "PivotTable report is not using AutoShow for this field"
 End If
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoShowType Property (Excel)

 Copy code hover
[image]

PivotField.AutoShowType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns xlAutomatic if AutoShow is enabled for the specified PivotTable field; returns xlManual if AutoShow is disabled. Read-only Long.

Syntax

expression .AutoShowType

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoShow parameters for the Salesman field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("salesman")
 If .AutoShowType = xlAutomatic Then
 r = .AutoShowRange
 If r = xlTop Then
 rn = "top"
 Else
 rn = "bottom"
 End If
 MsgBox "PivotTable report is showing " & rn & " " & _
 .AutoShowCount & " items in " & .Name & _
 " field by " & .AutoShowField
 Else
 MsgBox "PivotTable report is not using AutoShow for this field"
 End If
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoSortCustomSubtotal Property (Excel)

 Copy code hover
[image]

PivotField.AutoSortCustomSubtotal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the custom subtotal used to sort the specified PivotTable field automatically. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoSortCustomSubtotal

expression A variable that represents a PivotField object.

Remarks

The default value is 1 (Automatic). When the AutoSortCustomSubtotal property is set to 1 (Automatic), the data is sorted by the regular subtotals. The AutoSortCustomSubtotal property can have one of the index values listed in the following table.

1 | Automatic
2 | Sum
3 | Count
4 | Average
5 | Max
6 | Min
7 | Product
8 | Count Nums
9 | StdDev
10 | StdDevp
11 | Var
12 | Varp

Sorting is supported only by custom subtotals that are actually displayed in the PivotTable, so trying to set AutoSortCustomSubtotal to a value representing a custom subtotal not in the PivotTable view will return a run-time error.

If sorting is applied based on a custom subtotal, and that subtotal is removed from the PivotTable, the AutoSortCustomSubtotal property will automatically be set to the default value (1).

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoSortField Property (Excel)

 Copy code hover
[image]

PivotField.AutoSortField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the data field used to sort the specified PivotTable field automatically. Read-only String.

Syntax

expression .AutoSortField

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoSort parameters for the Product field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("product")
 Select Case .AutoSortOrder
 Case xlManual
 aso = "manual"
 Case xlAscending
 aso = "ascending"
 Case xlDescending
 aso = "descending"
 End Select
 MsgBox " sorted in " & aso & _
 " order by " & .AutoSortField
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoSortOrder Property (Excel)

 Copy code hover
[image]

PivotField.AutoSortOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the order used to sort the specified PivotTable field automatically. Can be one of the constants of XlSortOrder. Read-only Long.

Syntax

expression .AutoSortOrder

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoSort parameters for the Product field.

VBA Copy code Copy code
With Worksheets(1).PivotTables(1).PivotFields("product")
 Select Case .AutoSortOrder
 Case xlManual
 aso = "manual"
 Case xlAscending
 aso = "ascending"
 Case xlDescending
 aso = "descending"
 End Select
 MsgBox " sorted in " & aso & _
 " order by " & .AutoSortField
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoSortPivotLine Property (Excel)

 Copy code hover
[image]

PivotField.AutoSortPivotLine Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the PivotLine used to sort the specified PivotTable field automatically. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoSortPivotLine

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.BaseField Property (Excel)

 Copy code hover
[image]

PivotField.BaseField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the base field for a custom calculation. This property is valid only for data fields. Read/write Variant.

Syntax

expression .BaseField

expression A variable that represents a PivotField object.

Remarks

This property is not available for OLAP data sources.

Example

This example sets the data field in the PivotTable report on Sheet1 to calculate the difference from the base field, sets the base field to the field named "ORDER_DATE," and then sets the base item to the item named "5/16/89."

VBA Copy code Copy code
With Worksheets("Sheet1").Range("A3").PivotField
 .Calculation = xlDifferenceFrom
 .BaseField = "ORDER_DATE"
 .BaseItem = "5/16/89"
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.BaseItem Property (Excel)

 Copy code hover
[image]

PivotField.BaseItem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the item in the base field for a custom calculation. Valid only for data fields. Read/write Variant.

Syntax

expression .BaseItem

expression A variable that represents a PivotField object.

Remarks

This property is not available for OLAP data sources.

Example

This example sets the data field in the PivotTable report on Sheet1 to calculate the difference from the base field, sets the base field to the field named "ORDER_DATE," and then sets the base item to the item named "5/16/89."

VBA Copy code Copy code
With Worksheets("Sheet1").Range("A3").PivotField
 .Calculation = xlDifferenceFrom
 .BaseField = "ORDER_DATE"
 .BaseItem = "5/16/89"
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Calculation Property (Excel)

 Copy code hover
[image]

PivotField.Calculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPivotFieldCalculation value that represents the type of calculation performed by the specified field. This property is valid only for data fields.

Syntax

expression .Calculation

expression A variable that represents a PivotField object.

Example

This example sets the data field in the PivotTable report on Sheet1 to calculate the difference from the base field, sets the base field to the field named "ORDER_DATE," and then sets the base item to the item named "5/16/89."

VBA Copy code Copy code
With Worksheets("Sheet1").Range("A3").PivotField
    .Calculation = xlDifferenceFrom
    .BaseField = "ORDER_DATE"
    .BaseItem = "5/16/89"
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Caption Property (Excel)

 Copy code hover
[image]

PivotField.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the label text for the pivot field.

Syntax

expression .Caption

expression A variable that represents a PivotField object.

Remarks

The following table shows example values of the Caption property and related properties, given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (Same as the SQL property value; read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) | Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") | expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index names shown in the following table.

Name (OLAP data source) | Name (non-OLAP data source)
[Europe].[France].[Paris] | Paris

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ChildField Property (Excel)

 Copy code hover
[image]

PivotField.ChildField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that represents the child field for the specified field (if the field is grouped and has a child field). Read-only.

Syntax

expression .ChildField

expression A variable that represents a PivotField object.

Remarks

If the specified field has no child field, this property causes an error.

This property is not available for OLAP data sources.

Example

This example displays the name of the child field for the field named "REGION2."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
MsgBox "The name of the child field is " & _
 pvtTable.PivotFields("REGION2").ChildField.Name

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ChildItems Property (Excel)

 Copy code hover
[image]

PivotField.ChildItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.

Syntax

expression .ChildItems(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The item name or number (can be an array to specify more than one item).

Remarks

This property is not available for OLAP data sources.

Example

This example adds the names of all the child items of the item named "vegetables" to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtItem In _
 pvtTable.PivotFields("product")
 .PivotItems("vegetables").ChildItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtItem.Name
Next pvtItem

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Creator Property (Excel)

 Copy code hover
[image]

PivotField.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotField object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.CubeField Property (Excel)

 Copy code hover
[image]

PivotField.CubeField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the CubeField object from which the specified PivotTable field is descended. Read-only.

Syntax

expression .CubeField

expression A variable that represents a PivotField object.

Example

This example creates a list of the cube field names for all the hierarchy fields in the first Online Analytical Processing (OLAP) -based PivotTable report on the first worksheet. This example assumes a PivotTable report exists in the first worksheet.

VBA Copy code Copy code
Sub UseCubeField()

 Dim objNewSheet As Worksheet
 Set objNewSheet = Worksheets.Add
 objNewSheet.Activate
 intRow = 1

 For Each objPF in _
 Worksheets(1).PivotTables(1).PivotFields
 If objPF.CubeField.CubeFieldType = xlHierarchy Then
 objNewSheet.Cells(intRow, 1).Value = objPF.Name
 intRow = intRow + 1
 End If
 Next objPF

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.CurrentPage Property (Excel)

 Copy code hover
[image]

PivotField.CurrentPage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the current page showing for the page field (valid only for page fields). Read/write PivotItem.

Syntax

expression .CurrentPage

expression A variable that represents a PivotField object.

Example

This example returns the current page name for the PivotTable report on Sheet1 in the string variable strPgName.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
strPgName = pvtTable.PivotFields("Country").CurrentPage.Name

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.CurrentPageList Property (Excel)

 Copy code hover
[image]

PivotField.CurrentPageList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an array of strings corresponding to the list of items included in a multiple-item page field of a PivotTable report. Read/write Variant.

Syntax

expression .CurrentPageList

expression A variable that represents a PivotField object.

Remarks

To avoid run-time errors, the data source must be an OLAP source, the field chosen must currently be in the Page position, and the EnableMultiplePageItems property must be set to True.

Example

This example sets the page field to list the "Food" items of the PivotTable report. It assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseCurrentPageList()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields("[Product]")

 ' To avoid run-time errors set the following property to True.
 pvtTable.CubeFields("[Product]").EnableMultiplePageItems = True

 ' Set the page list to "Food".
 pvtField.CurrentPageList = "[Product].[All Products].[Food]"

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.CurrentPageName Property (Excel)

 Copy code hover
[image]

PivotField.CurrentPageName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the currently displayed page of the specified PivotTable report. The name of the page appears in the page field. Note that this property works only if the currently displayed page already exists. Read/write String.

Syntax

expression .CurrentPageName

expression A variable that represents a PivotField object.

Remarks

This property applies to PivotTables that are connected to an OLAP data source. Attempting to return or set this property with a PivotTable that is not connected to an OLAP data source will result in a run-time error.

Example

This example sets the name of the currently displayed page of the first PivotTable report on the active worksheet to "USA."

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("[Customers]").CurrentPageName = _
 "[Customers].[All Customers].[USA]"

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DatabaseSort Property (Excel)

 Copy code hover
[image]

PivotField.DatabaseSort Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True, manual repositioning of items in a PivotTable field is allowed. Returns True, if the field has no manually positioned items. Read/write Boolean.

Syntax

expression .DatabaseSort

expression A variable that represents a PivotField object.

Remarks

The DatabaseSort property returns False if the data source is not an Online Analytical Processing (OLAP) data source.

This property returns True if the data source is OLAP and neither custom ordering nor automatic sorting has been applied to the field.

Setting the DatabaseSort property to True, for an OLAP PivotTable, will remove any custom ordering or automatic sort applied to the field (in other words, the PivotTable reverts to the default behavior when the connection was made).

Setting the DatabaseSort property to False will cause the sort order to be the current order of the items, if no automatic sort is applied.

Setting the DatabaseSort property to either True or False causes an Update.

Setting the DatabaseSort property to True for a non-OLAP source or an OLAP data field causes a run-time error.

Example

The following example determines if the data source is an OLAP data source and notifies the user. This example assumes an OLAP PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseDatabaseSort()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields("[Product].[Product Family]")

 ' Determine source type for the PivotTable report.
 If pvtField.DatabaseSort = True Then
 MsgBox "The source is OLAP; you can manually reorder items."
 Else
 MsgBox "The data source might not be OLAP."
 End If

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DataRange Property (Excel)

 Copy code hover
[image]

PivotField.DataRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object as shown in the following table. Read-only.

Syntax

expression .DataRange

expression A variable that represents a PivotField object.

Remarks

Object | Data range
Data field | Data contained in the field
Row, column, or page field | Items in the field
Item | Data qualified by the item

Example

This example selects the PivotTable items in the field named "REGION."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Worksheets("Sheet1").Activate
pvtTable.PivotFields("REGION").DataRange.Select

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DataType Property (Excel)

 Copy code hover
[image]

PivotField.DataType Property (Excel)
See also Send feedback

Returns a XlPivotFieldDataType value that represents the type of data in the PivotTable field.

Syntax

expression .DataType

expression A variable that represents a PivotField object.

Example

This example displays the data type of the field named "ORDER_DATE."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Select Case pvtTable.PivotFields("ORDER_DATE").DataType
 Case Is = xlText
 MsgBox "The field contains text data"
 Case Is = xlNumber
 MsgBox "The field contains numeric data"
 Case Is = xlDate
 MsgBox "The field contains date data"
End Select

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DisplayAsCaption Property (Excel)

 Copy code hover
[image]

PivotField.DisplayAsCaption Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to display member properties of PivotFields as captions. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayAsCaption

expression A variable that represents a PivotField object.

Remarks

This property returns True when a given member property is used as a caption and False when a member property PivotField is not used as caption. Trying to use this property for PivotFields that are not member properties will return a run-time error.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DisplayAsTooltip Property (Excel)

 Copy code hover
[image]

PivotField.DisplayAsTooltip Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to specify whether or not a specific member property PivotField is displayed in tooltips. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayAsTooltip

expression A variable that represents a PivotField object.

Remarks

Trying to get or set these properties for PivotFields that are not member properties will return a run-time error.

A given member property is displayed in tooltips when the DisplayAsTooltip property is set to True, and not displayed in tooltips when it is set to False. The default value is True.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DisplayInReport Property (Excel)

 Copy code hover
[image]

PivotField.DisplayInReport Property (Excel)
See also Send feedback

This property is used to specify whether the specified member property PivotField is displayed in the PivotTable or not. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayInReport

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DragToColumn Property (Excel)

 Copy code hover
[image]

PivotField.DragToColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified field can be dragged to the column position. The default value is True. Read/write Boolean.

Syntax

expression .DragToColumn

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, the value is False for measure fields.

Example

This example prevents the Year field in the first PivotTable report on worksheet one from being dragged to the column position.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").DragToColumn = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DragToData Property (Excel)

 Copy code hover
[image]

PivotField.DragToData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified field can be dragged to the data position. The default value is True. Read/write Boolean

Syntax

expression .DragToData

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, the value is False for measure fields.

Example

This example prevents the Year field from being dragged to the data position in the first PivotTable report on the first worksheet.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").DragToData = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DragToHide Property (Excel)

 Copy code hover
[image]

PivotField.DragToHide Property (Excel)
See also Send feedback

True if the field can be hidden by being dragged off the PivotTable report. The default value is True. Read/write Boolean.

Syntax

expression .DragToHide

expression A variable that represents a PivotField object.

Example

This example prevents the Year field in the first PivotTable report on worksheet one from being dragged off the report.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").DragToHide = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DragToPage Property (Excel)

 Copy code hover
[image]

PivotField.DragToPage Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the field can be dragged to the page position. The default value is True. Read/write Boolean.

Syntax

expression .DragToPage

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, the value is False for measure fields.

Example

This example prevents the Year field in the PivotTable report on worksheet one from being dragged to the page position.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").DragToPage = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DragToRow Property (Excel)

 Copy code hover
[image]

PivotField.DragToRow Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the field can be dragged to the row position. The default value is True. Read/write Boolean.

Syntax

expression .DragToRow

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, the value is False for measure fields.

Example

This example prevents the Year field in the first PivotTable report on worksheet one from being dragged to the row position.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").DragToRow = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DrilledDown Property (Excel)

 Copy code hover
[image]

PivotField.DrilledDown Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.

Syntax

expression .DrilledDown

expression A variable that represents a PivotField object.

Remarks

You can use this property only for OLAP data sources.

You cannot set this property if the field or item is hidden.

Example

This example sets the flags to "not drilled" for all items in the state field in the third PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable3") _
 .PivotFields("state").DrilledDown = False

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.EnableItemSelection Property (Excel)

 Copy code hover
[image]

PivotField.EnableItemSelection Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to False, disables the ability to use the field dropdown in the user interface. The default value is True. Read/write Boolean.

Syntax

expression .EnableItemSelection

expression A variable that represents a PivotField object.

Remarks

A run-time error will occur if the OLAP PivotTable field is not the highest level for the hierarchy.

Example

This example determines the setting for selecting items using the field dropdown and enables the feature, if necessary. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseEnableItemSelection()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.RowFields(1)

 ' Determine setting for property and enable if necessary.
 If pvtField.EnableItemSelection = False Then
 pvtField.EnableItemSelection = True
 MsgBox "Item selection enabled for fields."
 Else
 MsgBox "Item selection is already enabled for fields."
 End If

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.EnableMultiplePageItems Property (Excel)

 Copy code hover
[image]

PivotField.EnableMultiplePageItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Used for specifying whether or not check boxes are present in the filter drop-down list for fields in the page area. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableMultiplePageItems

expression A variable that represents a PivotField object.

Remarks

The existing property value is retained for OLAP.

Note Note

In Excel 2007 or later, if you create pre-Excel 2007 OLAP PivotTables (PivotTable.Version < 3) with the SubtotalHiddenPageItems property of the PivotTable object and the EnableMultiplePageItems property of the PivotField object set to True, changing the state of the check boxes in the filter drop-down menu of the page area will have no effect. In this case, the filter will always be set to All, including the unchecked (hidden) items.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Formula Property (Excel)

 Copy code hover
[image]

PivotField.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.

Syntax

expression .Formula

expression A variable that represents a PivotField object.

Remarks

This property is not available for OLAP data sources.

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Function Property (Excel)

 Copy code hover
[image]

PivotField.Function Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the function used to summarize the PivotTable field (data fields only). Read/write XlConsolidationFunction.

Syntax

expression .Function

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, this property is read-only and always returns xlUnknown. For other data sources, this property cannot be set to xlUnknown.

Example

This example sets the Sum of 1994 field in the first PivotTable report on the active sheet to use the SUM function.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("Sum of 1994").Function = xlSum

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.GroupLevel Property (Excel)

 Copy code hover
[image]

PivotField.GroupLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the placement of the specified field within a group of fields (if the field is a member of a grouped set of fields). Read-only.

Syntax

expression .GroupLevel

expression A variable that represents a PivotField object.

Remarks

This property is not available for OLAP data sources.

The highest-level parent field (leftmost parent field) is level one, its child is level two, and so on.

Example

This example displays a message box if the field that contains the active cell is the highest-level parent field.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
If ActiveCell.PivotField.GroupLevel = 1 Then
 MsgBox "This is the highest-level parent field."
End If

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Hidden Property (Excel)

 Copy code hover
[image]

PivotField.Hidden Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to hide the individual levels of an OLAP hierarchy. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Hidden

expression A variable that represents a PivotField object.

Remarks

Returns True for hidden levels and False for visible (non-hidden) levels.

This property is applicable only to levels of OLAP hierarchies.

For relational data sources and OLAP attributes, this property is always False. Trying to set it to True for an attribute or a relational field will return a run-time error. It is not possible to set this property to True for a level if all other levels of the same hierarchy already have this setting set to True. At least one level of a hierarchy has to have this property set to False. Attempting to do this will return a run-time error.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.HiddenItems Property (Excel)

 Copy code hover
[image]

PivotField.HiddenItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single hidden PivotTable item (a PivotItem object) or a collection of all the hidden items (a PivotItems object) in the specified field. Read-only.

Syntax

expression .HiddenItems(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number or name of the item to be returned (can be an array to specify more than one item).

Remarks

For OLAP data sources, this property always returns an empty collection.

Example

This example adds the names of all the hidden items in the field named "product" to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtItem In pvtTable.PivotFields("product").HiddenItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtItem.Name
Next pvtItem

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.HiddenItemsList Property (Excel)

 Copy code hover
[image]

PivotField.HiddenItemsList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant specifying an array of strings that are hidden items for a PivotTable field. Read/write.

Syntax

expression .HiddenItemsList

expression A variable that represents a PivotField object.

Remarks

The HiddenItemsList property is only valid for Online Analytical Processing (OLAP) data sources; using this property on non-OLAP data sources will return a run-time error.

Example

The example sets the item list so that only certain items are displayed. It assumes an OLAP PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseHiddenItemsList()

 ActiveSheet.PivotTables(1).PivotFields(1).HiddenItemsList = _
 Array("[Product].[All Products].[Food]", _
 "[Product].[All Products].[Drink]")

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.IncludeNewItemsInFilter Property (Excel)

 Copy code hover
[image]

PivotField.IncludeNewItemsInFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows developers to specify whether excluded or included items should be tracked when manual filtering is applied to the PivotField. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IncludeNewItemsInFilter

expression A variable that represents a PivotField object.

Remarks

The default value for this property is False.

When manual filtering is applied, developers can set the IncludeNewItemsInFilter property to True to track excluded items. They can set the property to False to track included items. If new items are added to the source data after the IncludeNewItemsInFilter property is set to True, the new items appear in the PivotTable after the next refresh operation because they are not in the collection of items that Excel is tracking.

For OLAP hierarchies this setting is set on the CubeField object, and trying to set it on PivotFields that are part of a hierarchy will fail (with a run-time error). You can get this setting from the PivotFields that are part of a hierarchy and it will return the same as the corresponding CubeField.IncludeNewItemsInFilter property.

Toggling this setting will clear the following collections: HiddenItemsList, HiddenItems, VisibleItemsList, and VisibleItems. When IncludeNewItemsInFilter is set to False, the HiddenItemsList and HiddenItems collections are empty and items cannot be added to them. A run-time error is returned when attempting to add items. When IncludeNewItemsInFilter is set to True, the VisibleItemsList and VisibleItems collections are empty and items cannot be added to them. A run-time error is returned when attempting to add items.

In PivotTables, this setting is set on the PivotField object. Toggling this setting will not change the filter state.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.IsCalculated Property (Excel)

 Copy code hover
[image]

PivotField.IsCalculated Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable field is a calculated field or item. Read-only Boolean.

Syntax

expression .IsCalculated

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, this property always returns False.

Example

This example disables the PivotTable Field dialog box if the specified PivotTable report contains any calculated fields.

VBA Copy code Copy code
set pt = Worksheets(1).PivotTables("Pivot1")
For Each fld in pt.PivotFields
 If fld.IsCalculated Then pt.EnableFieldDialog = False
Next

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.IsMemberProperty Property (Excel)

 Copy code hover
[image]

PivotField.IsMemberProperty Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True when the PivotField contains member properties. Read-only Boolean.

Syntax

expression .IsMemberProperty

expression A variable that represents a PivotField object.

Remarks

This property will return a run-time error if an Online Analytical Processing (OLAP) data source is not used.

Example

This example determines if the PivotTable field contains member properties and notifies the user. It assumes that a PivotTable exists on the active worksheet and that it is connected to an OLAP data source.

VBA Copy code Copy code
Sub CheckForMembers()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields(1)

 ' Determine if member properties exist and notify user.
 If pvtField.IsMemberProperty = True Then
 MsgBox "The PivotField contains member properties."
 Else
 MsgBox "The PivotField does not contain member properties."
 End If

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LabelRange Property (Excel)

 Copy code hover
[image]

PivotField.LabelRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell (or cells) that contain the field label. Read-only

Syntax

expression .LabelRange

expression A variable that represents a PivotField object.

Example

This example selects the field button for the field named "ORDER_DATE."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Set pvtField = pvtTable.PivotFields("ORDER_DATE")
Worksheets("Sheet1").Activate
pvtField.LabelRange.Select

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LayoutBlankLine Property (Excel)

 Copy code hover
[image]

PivotField.LayoutBlankLine Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a blank row is inserted after the specified row field in a PivotTable report. The default value is False. Read/write Boolean.

Syntax

expression .LayoutBlankLine

expression A variable that represents a PivotField object.

Remarks

You can set this property for any PivotTable field; however, the blank row appears only if the specified field is a row field other than the innermost (lowest-level) row field. For non-OLAP data sources, the value of this property doesn't change when the field is rearranged or added to the PivotTable report.

You cannot enter data in the blank row in the PivotTable report.

Example

This example adds a blank line after the state field in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutBlankLine = True
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LayoutCompactRow Property (Excel)

 Copy code hover
[image]

PivotField.LayoutCompactRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether or not a PivotField is compacted (items of multiple PivotFields are displayed in a single column) when rows are selected. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .LayoutCompactRow

expression A variable that represents a PivotField object.

Remarks

Setting this property to True (default) will have no immediate visual effect in the PivotTable if the LayoutForm property is set to xlTabular, but it can be set independently.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LayoutForm Property (Excel)

 Copy code hover
[image]

PivotField.LayoutForm Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.

Syntax

expression .LayoutForm

expression A variable that represents a PivotField object.

Remarks

XlLayoutFormType can be one of these XlLayoutFormType constants.

xlTabular. Default.

xlOutline. The LayoutSubtotalLocation property specifies where the subtotal appears in the PivotTable report.

You can set this property for any PivotTable field; however, the formatting appears only if the specified field is a row field other than the innermost (lowest-level) row field. For non-OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or removed from the PivotTable report.

Example

This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutForm = xlOutline
 .LayoutSubtotalLocation = xlTop
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LayoutPageBreak Property (Excel)

 Copy code hover
[image]

PivotField.LayoutPageBreak Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a page break is inserted after each field. The default value is False. Read/write Boolean.

Syntax

expression .LayoutPageBreak

expression A variable that represents a PivotField object.

Remarks

Although you can set this property for any PivotTable field, the print option appears only if the specified field is a row field other than the innermost (lowest-level) row field. For non-OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or removed from the PivotTable report.

Example

This example adds a page break after the state field in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutPageBreak = True
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.LayoutSubtotalLocation Property (Excel)

 Copy code hover
[image]

PivotField.LayoutSubtotalLocation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the PivotTable field subtotals in relation to (either above or below) the specified field. Read/write XlSubtototalLocationType.

Syntax

expression .LayoutSubtotalLocation

expression A variable that represents a PivotField object.

Remarks

You can set this property for any PivotTable field in outline format; however, the formatting appears only if the specified field is a row field other than the innermost (lowest level) row field. For non- OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or from removed from the report.

The LayoutForm property determines whether the report appears in table format or in outline format.

Example

This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

VBA Copy code Copy code
With ActiveSheet.PivotTables("PivotTable1") _
 .PivotFields("state")
 .LayoutForm = xlOutline
 .LayoutSubtotalLocation = xlAtTop
End With

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.MemberPropertyCaption Property (Excel)

 Copy code hover
[image]

PivotField.MemberPropertyCaption Property (Excel)
See also Send feedback

Published: July 16, 2012

Setting the MemberPropertyCaption property controls which member property is used as caption for a given level. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .MemberPropertyCaption

expression A variable that represents a PivotField object.

Remarks

Note Note

This setting has a visual effect only when UseMemberPropertyAsCaption is set to True for the PivotField.

When MemberPropertyCaption is set, the setting is remembered while toggling the UseMemberPropertyAsCaption property.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.MemoryUsed Property (Excel)

 Copy code hover
[image]

PivotField.MemoryUsed Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the amount of memory currently being used by the object, in bytes. Read-only Long.

Syntax

expression .MemoryUsed

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the number of bytes that Microsoft Excel is currently using.

VBA Copy code Copy code
MsgBox "Microsoft Excel is currently using " & _
 Application.MemoryUsed & " bytes"

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Name Property (Excel)

 Copy code hover
[image]

PivotField.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.NumberFormat Property (Excel)

 Copy code hover
[image]

PivotField.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a PivotField object.

Remarks

You can set the NumberFormat property only for a data field.

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Orientation Property (Excel)

 Copy code hover
[image]

PivotField.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPivotFieldOrientation value that represents the location of the field in the specified PivotTable report.

Syntax

expression .Orientation

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, setting this property for one field in a hierarchy sets the orientation for the other fields in the same hierarchy. Dimension fields can only be oriented in the row, column, and page field areas of the PivotTable report. Measure fields can only be oriented in the data area. Setting a hierarchy or data field to xlHidden removes the hierarchy or field from the PivotTable report.

Example

This example displays the orientation for the ORDER_DATE field.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Set pvtField = pvtTable.PivotFields("ORDER_DATE")
Select Case pvtField.Orientation
 Case xlHidden
 MsgBox "Hidden field"
 Case xlRowField
 MsgBox "Row field"
 Case xlColumnField
 MsgBox "Column field"
 Case xlPageField
 MsgBox "Page field"
 Case xlDataField
 MsgBox "Data field"
End Select

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Parent Property (Excel)

 Copy code hover
[image]

PivotField.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ParentField Property (Excel)

 Copy code hover
[image]

PivotField.ParentField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that represents the PivotTable field that's the group parent of the specified object. The field must be grouped and must have a parent field. Read-only.

Syntax

expression .ParentField

expression A variable that represents a PivotField object.

Example

This example displays the name of the field that's the group parent of the field that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active field is a child of the field " & _
 ActiveCell.PivotField.ParentField.Name

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ParentItems Property (Excel)

 Copy code hover
[image]

PivotField.ParentItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group parents in the specified field. The specified field must be a group parent of another field. Read-only.

Syntax

expression .ParentItems(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number or name of the item to be returned (can be an array to specify more than one item).

Remarks

This property isn't available for OLAP data sources.

Example

This example creates a list containing the names of all the items that are group parents in the field named "product".

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtItem In pvtTable.PivotFields("product").ParentItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtItem.Name
Next pvtItem

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.PivotFilters Property (Excel)

 Copy code hover
[image]

PivotField.PivotFilters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the PivotFilters for the specified PivotField object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotFilters

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Position Property (Excel)

 Copy code hover
[image]

PivotField.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the position of the field (first, second, third, and so on) among all the fields in its orientation (Rows, Columns, Pages, Data).

Syntax

expression .Position

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.PropertyOrder Property (Excel)

 Copy code hover
[image]

PivotField.PropertyOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Valid only for PivotTable fields that are member property fields. Returns a Long indicating the display position of the member property within the cube field to which it belongs. Read/write.

Syntax

expression .PropertyOrder

expression A variable that represents a PivotField object.

Remarks

Setting this property will rearrange the order of the properties for this cube field. This property is one-based. The allowable range is from one to the maximum number of member property fields being displayed for the hierarchy.

If the IsMemberProperty property is False, using the PropertyOrder property will create a run-time error.

Example

This example determines if there are member properties in the fourth field and, if there are, displays the position of the member properties. Depending on the findings, Excel notifies the user. This example assumes that a PivotTable exists on the active worksheet and that it is based on an Online Analytical Processing (OLAP) data source.

VBA Copy code Copy code
Sub CheckPropertyOrder()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields(4)

 ' Check for member properties and notify user.
 If pvtField.IsMemberProperty = False Then
 MsgBox "No member properties present."
 Else
 MsgBox "The property order of the members is: " & _
 pvtField.PropertyOrder
 End If

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.PropertyParentField Property (Excel)

 Copy code hover
[image]

PivotField.PropertyParentField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object representing the field to which the properties in this field pertain.

Syntax

expression .PropertyParentField

expression A variable that represents a PivotField object.

Remarks

Valid only for fields that are member property fields.

If the IsMemberProperty property is False, using the PropertyParentField property will return a run-time error.

Example

This example determines if there are member properties in the fourth field and, if there are, which fields the properties pertain to. Depending on the findings, Excel notifies the user. This example assumes that a PivotTable exists on the active worksheet and that it is based on an Online Analytical Processing (OLAP) data source.

VBA Copy code Copy code
Sub CheckParentField()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields(4)

 ' Check for member properties and notify user.
 If pvtField.IsMemberProperty = False Then
 MsgBox "No member properties present."
 Else
 MsgBox "The parent field of the members is: " & _
 pvtField.PropertyParentField
 End If

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.RepeatLabels Property (Excel)

 Copy code hover
[image]

PivotField.RepeatLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether item labels are repeated in the PivotTable for the specified PivotField. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .RepeatLabels

expression A variable that represents a PivotField object.

Return Value

Boolean

Remarks

True if item labels are repeated for the specified PivotField; otherwise False.

The setting of the RepeatLabels property corresponds to the Repeat item labels check box on the Layout & Print tab of the Field Settings dialog box for a field in a PivotTable.

To specify whether to repeat item labels for all PivotFields in a PivotTable in a single operation, use the RepeatAllLabels method.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ServerBased Property (Excel)

 Copy code hover
[image]

PivotField.ServerBased Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data source for the specified PivotTable report is external and only the items matching the page field selection are retrieved. Read/write Boolean.

Syntax

expression .ServerBased

expression A variable that represents a PivotField object.

Remarks

This property doesn't apply to OLAP data sources and is always False.

When this property is True, only records in the database that match the selected page field item are retrieved. From then on, whenever the user changes the page field selection, the newly selected page field item is passed to the query as a parameter, and the cache is refreshed.

This property cannot be set if any of the following conditions are true:

  • The field is grouped.

  • The data source isn't external.

  • The cache is shared by two or more PivotTable reports.

  • The field is a data type that cannot be server based (a memo field or an OLE object).

Example

This example lists all the server-based page fields.

VBA Copy code Copy code
For Each fld in ActiveSheet.PivotTables(1).PageFields
 If fld.ServerBased = True Then
 r = r + 1
 Worksheets(2).Cells(r, 1).Value = fld.Name
 End If
Next

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ShowAllItems Property (Excel)

 Copy code hover
[image]

PivotField.ShowAllItems Property (Excel)
See also Send feedback

Published: July 16, 2012

True if all items in the PivotTable report are displayed, even if they don't contain summary data. The default value is False. Read/write Boolean.

Syntax

expression .ShowAllItems

expression A variable that represents a PivotField object.

Remarks

For OLAP data sources, the value is always False.

Example

This example displays all rows for the Month field in the first PivotTable report on worksheet one, including months for which there's no data.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Month").ShowAllItems = True

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ShowDetail Property (Excel)

 Copy code hover
[image]

PivotField.ShowDetail Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets whether the specified PivotField is showing detail. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowDetail

expression An expression that returns a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ShowingInAxis Property (Excel)

 Copy code hover
[image]

PivotField.ShowingInAxis Property (Excel)
See also Send feedback

Published: July 16, 2012

Indicates if the PivotField is currently visible in the PivotTable or not. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowingInAxis

expression A variable that represents a PivotField object.

Remarks

The property returns True if the PivotField is currently visible and returns False if the PivotField is currently not visible. The visibility of the PivotField is determined by whether or not the PivotField caption is visible in the PivotTable in tabular (non-compact) form.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.SourceCaption Property (Excel)

 Copy code hover
[image]

PivotField.SourceCaption Property (Excel)
See also Send feedback

Published: July 16, 2012

The SourceCaption property is applicable only for OLAP PivotTables, and returns the original caption from the OLAP server for a PivotField. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SourceCaption

expression A variable that represents a PivotField object.

Remarks

You can use the PivotField.Name or the PivotField.SourceName for non-OLAP PivotTables.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.SourceName Property (Excel)

 Copy code hover
[image]

PivotField.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.

Syntax

expression .SourceName

expression A variable that represents a PivotField object.

Remarks

The value of this property might be different from the current item name if the user renamed the item after creating the PivotTable report.

The following table shows example values of the SourceName property and related properties, given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (same as SQL property value, read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) | Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") | expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index names, as shown in the following table.

Name (OLAP data source) | Name (non-OLAP data source)
[Europe].[France].[Paris] | Paris

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.StandardFormula Property (Excel)

 Copy code hover
[image]

PivotField.StandardFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.

Syntax

expression .StandardFormula

expression A variable that represents a PivotField object.

Remarks

The StandardFormula property primarily affects item names with date or number formatting. It provides a way to specify or query a formula for a given calculated item.

The StandardFormula property is "international-friendly" whereas the Formula property is not.

Example

This example adds 10 to the Decimals field and displays it as a calculated item in the data field. The example assumes that a PivotTable exists on the active worksheet and that a field titled "Decimals" exists in the data table.

VBA Copy code Copy code
Sub UseStandardFomula()

 Dim pvtTable As PivotTable
 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Change calculated field of decimals by adding '10'.
 pvtTable.CalculatedFields.Item(1).StandardFormula = "Decimals + 10"

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.SubtotalName Property (Excel)

 Copy code hover
[image]

PivotField.SubtotalName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text string label displayed in the subtotal column or row heading in the specified PivotTable report. The default value is the string "Subtotal". Read/write String.

Syntax

expression .SubtotalName

expression A variable that represents a PivotField object.

Example

This example sets the subtotal label to "Regional Subtotal" (instead of the default string "Subtotal") in the state field in the second PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable2") _
 .PivotFields("state").SubtotalName = "Regional Subtotal"

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Subtotals Property (Excel)

 Copy code hover
[image]

PivotField.Subtotals Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets subtotals displayed with the specified field. Valid only for nondata fields. Read/write Variant.

Syntax

expression .Subtotals(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | A subtotal index, as shown in the following table. If this argument is omitted, the Subtotals method returns an array that contains a Boolean value for each subtotal.

Remarks

If an index is True, the field shows that subtotal. If index 1 (Automatic) is True, all other values are set to False.

Index | Meaning
1 | Automatic
2 | Sum
3 | Count
4 | Average
5 | Max
6 | Min
7 | Product
8 | Count Nums
9 | StdDev
10 | StdDevp
11 | Var
12 | Varp

For OLAP data sources, Index can only return or be set to 1 (Automatic). The returned array always contains True or False for the first array element, and it contains False for all other elements. An array of element values that are all False indicates that there are no subtotals.

Example

This example sets the field that contains the active cell to show Sum subtotals.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.PivotField.Subtotals(2) = True

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.TotalLevels Property (Excel)

 Copy code hover
[image]

PivotField.TotalLevels Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the total number of fields in the current field group. If the field isn't grouped, or if the data source is OLAP-based, TotalLevels returns the value 1. Read-only Long.

Syntax

expression .TotalLevels

expression A variable that represents a PivotField object.

Remarks

All fields in a set of grouped fields have the same TotalLevels value.

Example

This example displays the total number of fields in the group that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "This group has " & _
 ActiveCell.PivotField.TotalLevels & " levels

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.UseMemberPropertyAsCaption Property (Excel)

 Copy code hover
[image]

PivotField.UseMemberPropertyAsCaption Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to control whether member property captions are used for PivotItem captions of the PivotField. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .UseMemberPropertyAsCaption

expression A variable that represents a PivotField object.

Remarks

If UseMemberPropertyAsCaption is set to True for a PivotField, then MemberPropertyCaption specifies which member property caption to display. If none is specified, the first member property of that PivotField (in data source order) will be displayed as the caption for items of that PivotField.

If UseMemberPropertyAsCaption is set to False, then the regular PivotItem captions are used for the PivotField.

If you try to set UseMemberPropertyAsCaption to True for a PivotField with no member properties, a run-time error is returned. For PivotFields with no member properties, the property will always be False.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Value Property (Excel)

 Copy code hover
[image]

PivotField.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the specified field in the PivotTable report.

Syntax

expression .Value

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.VisibleItems Property (Excel)

 Copy code hover
[image]

PivotField.VisibleItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single visible PivotTable item (a PivotItem object) or a collection of all the visible items (a PivotItems object) in the specified field. Read-only.

Syntax

expression .VisibleItems(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number or name of the item to be returned (can be an array to specify more than one item).

Remarks

For OLAP data sources, this property is read-only and always returns True. There are no hidden items.

Example

This example adds the names of all visible items in the field named "Product" to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtItem In pvtTable.PivotFields("Product").VisibleItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtItem.Name
Next

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.VisibleItemsList Property (Excel)

 Copy code hover
[image]

PivotField.VisibleItemsList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant specifying an array of strings that represent included items in a manual filter applied to a PivotField. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .VisibleItemsList

expression A variable that represents a PivotField object.

Remarks

This property is applicable to OLAP PivotTables only.

Example

This example shows manual, inclusive filtering in an OLAP PivotTable.

Copy code Copy code
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Customer].[Customer Geography] & _
.[Country]").VisibleItemsList = Array("[Customer].[Customer Geography].[Country].&[Australia]")
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Customer].[Customer Geography] & _
.[State-Province]").VisibleItemsList = Array("")
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Customer].[Customer Geography] & _
.[City]").VisibleItemsList = Array("")
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Customer].[Customer Geography] & _
.[Postal Code]").VisibleItemsList = Array("")
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Customer].[Customer Geography] & _
.[Full Name]").VisibleItemsList = Array("")

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField Methods (Excel)

 Copy code hover
[image]

PivotField Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddPageItem | Adds an additional item to a multiple item page field.
AutoShow | Displays the number of top or bottom items for a row, page, or column field in the specified PivotTable report.
AutoSort | Establishes automatic field-sorting rules for PivotTable reports.
CalculatedItems | Returns a CalculatedItems collection that represents all the calculated items in the specified PivotTable report. Read-only.
ClearAllFilters | Calling this method deletes all filters currently applied to the PivotField. This includes deleting all filters from the PivotFilters collection of the PivotField and removing any manual filtering applied to the PivotField as well. If the PivotField is in the Report Filter area, the item selected will be set to the default item.
ClearLabelFilters | This method deletes all label filters or all date filters in the PivotFilters collection of the PivotField.
ClearManualFilter | Provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList and VisibleItemsList collections in OLAP PivotTables.
ClearValueFilters | Calling this method deletes all value filters in the PivotFilters collection of the PivotField.
Delete | Deletes the object.
DrillTo | The DrillTo method supports drilling to a specified PivotField from another PivotField.
PivotItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the visible and hidden items (a PivotItems object) in the specified field. Read-only.


PivotField.AddPageItem Method (Excel)

 Copy code hover
[image]

PivotField.AddPageItem Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds an additional item to a multiple item page field.

Syntax

expression .AddPageItem(Item, ClearList)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | String | Source name of a PivotItem object, corresponding to the specific Online Analytical Processing (OLAP) member unique name.
ClearList | Optional | Variant | If False (default), adds a page item to the existing list. If True, deletes all current items and adds Item.

Remarks

To avoid run-time errors, the data source must be an OLAP source, the field chosen must currently be in the page position, and the EnableMultiplePageItems property must be set to True.

Example

In this example, Microsoft Excel adds a page item with a source name titled "[Product].[All Products].[Food].[Eggs]". This example assumes an OLAP PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseAddPageItem()

 ' The source is an OLAP database and you can manually reorder items.
 ActiveSheet.PivotTables(1).CubeFields("[Product]"). _
 EnableMultiplePageItems = True

 ' Add the page item titled "[Product].[All Products].[Food].[Eggs]".
 ActiveSheet.PivotTables(1).PivotFields("[Product]").AddPageItem ( _
 "[Product].[All Products].[Food].[Eggs]")

End Sub

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoShow Method (Excel)

 Copy code hover
[image]

PivotField.AutoShow Method (Excel)
See also Send feedback

Displays the number of top or bottom items for a row, page, or column field in the specified PivotTable report.

Syntax

expression .AutoShow(Type, Range, Count, Field)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Long | Use xlAutomatic to cause the specified PivotTable report to show the items that match the specified criteria. Use xlManual to disable this feature.
Range | Required | Long | The location at which to start showing items. Can be either of the following constants: xlTop or xlBottom.
Count | Required | Long | The number of items to be shown.
Field | Required | String | The name of the base data field. You must specify the unique name (as returned from the SourceName property), and not the displayed name.

Example

This example shows only the top two companies, based on the sum of sales:

VBA Copy code Copy code
ActiveSheet.PivotTables("Pivot1").PivotFields("Company") _
 .AutoShow xlAutomatic, xlTop, 2, "Sum of Sales"

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.AutoSort Method (Excel)

 Copy code hover
[image]

PivotField.AutoSort Method (Excel)
See also Send feedback

Published: July 16, 2012

Establishes automatic field-sorting rules for PivotTable reports.

Syntax

expression .AutoSort(Order, Field, PivotLine, CustomSubtotal)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Order | Required | Long | One of the constants of XlSortOrder specifying the sort order.
Field | Required | String | The name of the sort key field. You must specify the unique name (as returned from the SourceName property), and not the displayed name.
PivotLine | Optional | Variant | A line on a column or row in a PivotTable report.
CustomSubtotal | Optional | Variant | The custom subtotal field.

Example

This example sorts the Company field in descending order, based on the sum of sales.

VBA Copy code Copy code
ActiveSheet.PivotTables(1).PivotField("Company") _
 .AutoSort xlDescending, "Sum of Sales"

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.CalculatedItems Method (Excel)

 Copy code hover
[image]

PivotField.CalculatedItems Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CalculatedItems collection that represents all the calculated items in the specified PivotTable report. Read-only.

Syntax

expression .CalculatedItems

expression A variable that represents a PivotField object.

Return Value

CalculatedItems

Remarks

For OLAP data sources, this method returns a zero-length collection.

Example

This example creates a list of calculated items and their formulas.

VBA Copy code Copy code
Set pt = Worksheets(1).PivotTables(1)
For Each ci In pt.PivotFields("Sales").CalculatedItems
 r = r + 1
 With Worksheets(2)
 .Cells(r, 1).Value = ci.Name
 .Cells(r, 2).Value = ci.Formula
 End With
Next

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ClearAllFilters Method (Excel)

 Copy code hover
[image]

PivotField.ClearAllFilters Method (Excel)
See also Send feedback

Published: July 16, 2012

Calling this method deletes all filters currently applied to the PivotField. This includes deleting all filters from the PivotFilters collection of the PivotField and removing any manual filtering applied to the PivotField as well. If the PivotField is in the Report Filter area, the item selected will be set to the default item.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearAllFilters

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ClearLabelFilters Method (Excel)

 Copy code hover
[image]

PivotField.ClearLabelFilters Method (Excel)
See also Send feedback

Published: July 16, 2012

This method deletes all label filters or all date filters in the PivotFilters collection of the PivotField.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearLabelFilters

expression A variable that represents a PivotField object.

Remarks

The following table lists the different label filter types that will be deleted by this method.

xlCaptionEquals

xlCaptionDoesNotEqual

xlCaptionIsGreaterThan

xlCaptionIsGreaterThanOrEqualTo

xlCaptionIsLessThan

xlCaptionIsLessThanOrEqualTo

xlCaptionBeginsWith

xlCaptionDoesNotBeginWith

xlCaptionEndsWith

xlCaptionDoesNotEndWith

xlCaptionContains

xlCaptionDoesNotContain

xlCaptionIsBetween

xlCaptionIsNotBetween

The following table lists the different date filter types that will be deleted by this method.

xlSpecificDate

xlNotSpecificDate

xlBefore

xlBeforeOrEqualTo

xlAfter

xlAfterOrEqualTo

xlDateBetween

xlDateNotBetween

xlDateToday

xlDateYesterday

xlDateTomorrow

xlDateThisWeek

xlDateLastWeek

xlDateNextWeek

xlDateThisMonth

xlDateLastMonth

xlDateNextMonth

xlDateThisQuarter

xlDateLastQuarter

xlDateNextQuarter

xlDateThisYear

xlDateLastYear

xlDateNextYear

xlYearToDate

xlAllDatesInPeriodQuarter1

xlAllDatesInPeriodQuarter2

xlAllDatesInPeriodQuarter3

xlAllDatesInPeriodQuarter4

xlAllDatesInPeriodJanuary

xlAllDatesInPeriodFebruary

xlAllDatesInPeriodMarch

xlAllDatesInPeriodApril

xlAllDatesInPeriodMay

xlAllDatesInPeriodJune

xlAllDatesInPeriodJuly

xlAllDatesInPeriodAugust

xlAllDatesInPeriodSeptember

xlAllDatesInPeriodOctober

xlAllDatesInPeriodNovember

xlAllDatesInPeriodDecember

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ClearManualFilter Method (Excel)

 Copy code hover
[image]

PivotField.ClearManualFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

Provides an easy way to set the Visible property to True for all items of a PivotField in PivotTables, and to empty the HiddenItemsList and VisibleItemsList collections in OLAP PivotTables.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearManualFilter

expression A variable that represents a PivotField object.

Remarks

This method is available for the PivotField object in PivotTables and for the CubeField object in the OLAP PivotTables. Calling it for a PivotField in an OLAP PivotTable will return a run-time error.

After calling this method, the following collections are empty: HiddenItemsList, HiddenItems, VisibleItemsList, and VisibleItems.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.ClearValueFilters Method (Excel)

 Copy code hover
[image]

PivotField.ClearValueFilters Method (Excel)
See also Send feedback

Published: July 16, 2012

Calling this method deletes all value filters in the PivotFilters collection of the PivotField.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearValueFilters

expression A variable that represents a PivotField object.

Remarks

The following table lists the different value filter types that will be deleted by this method.

xlTopCount

xlBottomCount

xlTopPercent

xlBottomPercent

xlTopSum

xlBottomSum

xlValueEquals

xlValueDoesNotEqual

xlValueIsGreaterThan

xlValueIsGreaterThanOrEqualTo

xlValueIsLessThan

xlValueIsLessThanOrEqualTo

xlValueIsBetween

xlValueIsNotBetween

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.Delete Method (Excel)

 Copy code hover
[image]

PivotField.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a PivotField object.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.DrillTo Method (Excel)

 Copy code hover
[image]

PivotField.DrillTo Method (Excel)
See also Send feedback

Published: July 16, 2012

The DrillTo method supports drilling to a specified PivotField from another PivotField.

Version Information

Version Added: Excel 2007

Syntax

expression .DrillTo(PivotFieldName)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
PivotFieldName | Required | String | The name of the PivotField to drill to.

Remarks

This operation can only be performed on fields that are actually on the PivotTable. So either a hierarchy containing the requested PivotField has to be in rows or columns of the PivotTable, or the attribute/relational field has to be in rows or columns of the PivotTable placed next to at least one other attribute/relational field. Also, the field being drilled to has to be in the same hierarchy or attribute chain. If these conditions are not met, a run-time error occurs.

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotField.PivotItems Method (Excel)

 Copy code hover
[image]

PivotField.PivotItems Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the visible and hidden items (a PivotItems object) in the specified field. Read-only.

Syntax

expression .PivotItems(Index)

expression A variable that represents a PivotField object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the item to be returned.

Return Value

Variant

Remarks

For OLAP data sources, the collection is indexed by the unique name (the name returned by the SourceName property), not by the display name.

Example

This example adds the names of all items in the field named "product" to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtitem In pvtTable.PivotFields("product").PivotItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtitem.Name
Next

See also

Concepts

PivotField Object

Other resources

PivotField Object Members


PivotFields Object (Excel)

 Copy code hover
[image]

PivotFields Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the PivotField objects in a PivotTable report.

Remarks

In some cases, it may be easier to use one of the properties that returns a subset of the PivotTable fields. The following accessor methods are available:

  • ColumnFields property

  • DataFields property

  • HiddenFields property

  • PageFields property

  • RowFields property

  • VisibleFields property

Example

Use the PivotFields method of the PivotTable object to return the PivotFields collection. The following example enumerates the field names in the first PivotTable report on Sheet3.

VBA Copy code Copy code
With Worksheets("sheet3").PivotTables(1)
 For i = 1 To .PivotFields.Count
 MsgBox .PivotFields(i).Name
 Next
End With

Use PivotFields(index), where index is the field name or index number, to return a single PivotField object. The following example makes the Year field a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").Orientation = xlRowField

See also

Concepts

Excel Object Model Reference

Other resources

PivotFields Object Members


PivotFields Members (Excel)

 Copy code hover
[image]

PivotFields Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the PivotField objects in a PivotTable report.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotFields Properties (Excel)

 Copy code hover
[image]

PivotFields Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotFields.Application Property (Excel)

 Copy code hover
[image]

PivotFields.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotFields object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotFields Object

Other resources

PivotFields Object Members


PivotFields.Count Property (Excel)

 Copy code hover
[image]

PivotFields.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotFields object.

See also

Concepts

PivotFields Object

Other resources

PivotFields Object Members


PivotFields.Creator Property (Excel)

 Copy code hover
[image]

PivotFields.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotFields object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotFields Object

Other resources

PivotFields Object Members


PivotFields.Parent Property (Excel)

 Copy code hover
[image]

PivotFields.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotFields object.

See also

Concepts

PivotFields Object

Other resources

PivotFields Object Members


PivotFields Methods (Excel)

 Copy code hover
[image]

PivotFields Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


PivotFields.Item Method (Excel)

 Copy code hover
[image]

PivotFields.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

An Object value that represents an object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example makes the Year field a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields.Item("year").Orientation = xlRowField

See also

Concepts

PivotFields Object

Other resources

PivotFields Object Members


PivotFilter Object (Excel)

 Copy code hover
[image]

PivotFilter Object (Excel)
See also Send feedback

Published: July 16, 2012

A PivotFilter is applied to a PivotField object.

Version Information

Version Added: Excel 2007

Remarks

Developers have the option of naming filters for reference since the index is not reliable. The DataField property specifies the PivotField to base a value filter on.

See also

Concepts

Excel Object Model Reference

Other resources

PivotFilter Object Members


PivotFilter Members (Excel)

 Copy code hover
[image]

PivotFilter Members (Excel)
Send feedback

Published: July 16, 2012

A PivotFilter is applied to a PivotField object.

Methods

Name | Description
Delete | Deletes the filter and removes it from the filter collections of the PivotField and the PivotTable.

Properties

Name | Description
Active | Returns whether the specified PivotFilter is active. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataCubeField | This property is applicable only to OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write CubeField.
DataField | This property is applicable only to non-OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write PivotField.
Description | Provides an optional description for the PivotFilter object. Read-only String.
FilterType | Specifies the type of filter to be applied. Read-only xlPivotFilterType.
IsMemberPropertyFilter | Specifies whether the label filter is based on the PivotItem captions of a member property of the field or on the PivotItem captions of the PivotField itself. Read-only Boolean.
MemberPropertyField | This property specifies the member property PivotField on which the label filter is based. Read/write PivotField.
Name | This property provides the option of naming filters for reference. You cannot rely on the index value for accurate reference because this value can change.
Order | Specifies the evaluation order of the filter among all Value filters applied to the entire PivotTable. Read/write Integer.
Parent | Returns the parent object for the specified PivotFilter object. Read-only.
PivotField | Specifies the PivotField to which the filter is applied. Read-only.
Value1 | This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.
Value2 | This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.
WholeDayFilter | Sets or gets the filtering semantics for date filters. Boolean. Read/Write


PivotFilter Properties (Excel)

 Copy code hover
[image]

PivotFilter Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | Returns whether the specified PivotFilter is active. Read-only Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataCubeField | This property is applicable only to OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write CubeField.
DataField | This property is applicable only to non-OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write PivotField.
Description | Provides an optional description for the PivotFilter object. Read-only String.
FilterType | Specifies the type of filter to be applied. Read-only xlPivotFilterType.
IsMemberPropertyFilter | Specifies whether the label filter is based on the PivotItem captions of a member property of the field or on the PivotItem captions of the PivotField itself. Read-only Boolean.
MemberPropertyField | This property specifies the member property PivotField on which the label filter is based. Read/write PivotField.
Name | This property provides the option of naming filters for reference. You cannot rely on the index value for accurate reference because this value can change.
Order | Specifies the evaluation order of the filter among all Value filters applied to the entire PivotTable. Read/write Integer.
Parent | Returns the parent object for the specified PivotFilter object. Read-only.
PivotField | Specifies the PivotField to which the filter is applied. Read-only.
Value1 | This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.
Value2 | This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.
WholeDayFilter | Sets or gets the filtering semantics for date filters. Boolean. Read/Write


PivotFilter.Active Property (Excel)

 Copy code hover
[image]

PivotFilter.Active Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the specified PivotFilter is active. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Active

expression A variable that represents a PivotFilter object.

Remarks

This property returns True when the PivotField of the filter is in the PivotTable and the filter is evaluated when the PivotTable is updated. It returns False when the PivotField of the filter is not in the PivotTable and has no effect on the PivotTable calculation.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Application Property (Excel)

 Copy code hover
[image]

PivotFilter.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotFilter object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Creator Property (Excel)

 Copy code hover
[image]

PivotFilter.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotFilter object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.DataCubeField Property (Excel)

 Copy code hover
[image]

PivotFilter.DataCubeField Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is applicable only to OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write CubeField.

Version Information

Version Added: Excel 2007

Syntax

expression .DataCubeField

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.DataField Property (Excel)

 Copy code hover
[image]

PivotFilter.DataField Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is applicable only to non-OLAP PivotTables and provides the Value field (PivotField in the Values area) being filtered by for a value filter. Read/write PivotField.

Version Information

Version Added: Excel 2007

Syntax

expression .DataField

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Description Property (Excel)

 Copy code hover
[image]

PivotFilter.Description Property (Excel)
See also Send feedback

Published: July 16, 2012

Provides an optional description for the PivotFilter object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Description

expression A variable that represents a PivotFilter object.

Remarks

The maximum length of the description string is 255 characters.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.FilterType Property (Excel)

 Copy code hover
[image]

PivotFilter.FilterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the type of filter to be applied. Read-only xlPivotFilterType.

Version Information

Version Added: Excel 2007

Syntax

expression .FilterType

expression A variable that represents a PivotFilter object.

Remarks

The following table shows the new filter types, the arguments that must be supplied, and the arguments that cannot be supplied (Unavailable) for each filter type.

xlPivotFilterType | DataField | DataCubeField (OLAP) | Value1 | Value2
xlTopCount | Required | Required | Required | Unavailable
xlBottomCount | Required | Required | Required | Unavailable
xlTopPercent | Required | Required | Required | Unavailable
xlBottomPercent | Required | Required | Required | Unavailable
xlTopSum | Required | Required | Required | Unavailable
xlBottomSum | Required | Required | Required | Unavailable
xlCaptionEquals | Unavailable | Unavailable | Required | Unavailable
xlCaptionDoesNotEqual | Unavailable | Unavailable | Required | Unavailable
xlCaptionIsGreaterThan | Unavailable | Unavailable | Required | Unavailable
xlCaptionIsGreaterThanOrEqualTo | Unavailable | Unavailable | Required | Unavailable
xlCaptionIsLessThan | Unavailable | Unavailable | Required | Unavailable
xlCaptionIsLessThanOrEqualTo | Unavailable | Unavailable | Required | Unavailable
xlCaptionBeginsWith | Unavailable | Unavailable | Required | Unavailable
xlCaptionDoesNotBeginWith | Unavailable | Unavailable | Required | Unavailable
xlCaptionEndsWith | Unavailable | Unavailable | Required | Unavailable
xlCaptionDoesNotEndWith | Unavailable | Unavailable | Required | Unavailable
xlCaptionContains | Unavailable | Unavailable | Required | Unavailable
xlCaptionDoesNotContain | Unavailable | Unavailable | Required | Unavailable
xlCaptionIsBetween | Unavailable | Unavailable | Required | Required
xlCaptionIsNotBetween | Unavailable | Unavailable | Required | Required
xlValueEquals | Required | Required | Required | Unavailable
xlValueDoesNotEqual | Required | Required | Required | Unavailable
xlValueIsGreaterThan | Required | Required | Required | Unavailable
xlValueIsGreaterThanOrEqualTo | Required | Required | Required | Unavailable
xlValueIsLessThan | Required | Required | Required | Unavailable
xlValueIsLessThanOrEqualTo | Required | Required | Required | Unavailable
xlValueIsBetween | Required | Required | Required | Required
xlValueIsNotBetween | Required | Required | Required | Required
xlSpecificDate | Unavailable | Unavailable | Required | Unavailable
xlNotSpecificDate | Unavailable | Unavailable | Required | Unavailable
xlBefore | Unavailable | Unavailable | Required | Unavailable
xlBeforeOrEqualTo | Unavailable | Unavailable | Required | Unavailable
xlAfter | Unavailable | Unavailable | Required | Unavailable
xlAfterOrEqualTo | Unavailable | Unavailable | Required | Unavailable
xlBetween | Unavailable | Unavailable | Required | Unavailable
xlNotBetween | Unavailable | Unavailable | Required | Unavailable
xlFilterToday | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterYesterday | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterTomorrow | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterThisWeek | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterLastWeek | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterNextWeek | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterThisMonth | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterLastMonth | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterNextMonth | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterThisQuarter | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterLastQuarter | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterNextQuarter | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterThisYear | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterLastYear | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterNextYear | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterYearToDate | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodQuarter1 | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodQuarter2 | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodQuarter3 | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodQuarter4 | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodJanuary | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodFebruary | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodMarch | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodApril | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodMay | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodJune | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodJuly | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodAugust | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodSeptember | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodOctober | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodNovember | Unavailable | Unavailable | Unavailable | Unavailable
xlFilterAllDatesInPeriodDecember | Unavailable | Unavailable | Unavailable | Unavailable

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.IsMemberPropertyFilter Property (Excel)

 Copy code hover
[image]

PivotFilter.IsMemberPropertyFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether the label filter is based on the PivotItem captions of a member property of the field or on the PivotItem captions of the PivotField itself. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .IsMemberPropertyFilter

expression A variable that represents a PivotFilter object.

Remarks

The default value of this property is False.

Returns True if the label filter is based on PivotItem captions of a member property of the PivotField; or returns False if the filter is based on the PivotItem captions of the PivotField. This property is valid only for Label filters and only for OLAP PivotFields that have at least one member property.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.MemberPropertyField Property (Excel)

 Copy code hover
[image]

PivotFilter.MemberPropertyField Property (Excel)
See also Send feedback

Published: July 16, 2012

This property specifies the member property PivotField on which the label filter is based. Read/write PivotField.

Version Information

Version Added: Excel 2007

Syntax

expression .MemberPropertyField

expression A variable that represents a PivotFilter object.

Remarks

This property is valid only for Label filters and for OLAP PivotFields that have at least one member property.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Name Property (Excel)

 Copy code hover
[image]

PivotFilter.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

This property provides the option of naming filters for reference. You cannot rely on the index value for accurate reference because this value can change.

Version Information

Version Added: Excel 2007

Syntax

expression .Name

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Order Property (Excel)

 Copy code hover
[image]

PivotFilter.Order Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the evaluation order of the filter among all Value filters applied to the entire PivotTable. Read/write Integer.

Version Information

Version Added: Excel 2007

Syntax

expression .Order

expression A variable that represents a PivotFilter object.

Remarks

This property is valid only for Value and Top n type PivotFilters. A run-time error is returned if an attempt is made to set or get this property for Label and Date filters. 1 represents the first filter evaluated, 2 represents the next filter evaluated, and so on, until the nth value is reached. -1 represents an inactive filter.

If the EvaluationOrder property is not specified when a new filter is added, it will be set to N+1 (where N is the current highest EvaluationOrder number in the filter collection).

The property can be specified in the Add method or it can be set later for a field by changing the property.

Increasing the evaluation order for a field will decrease the evaluation order of the field previously holding that evaluation order value—and all fields in between the two fields—by one. Setting the evaluation order to the same as before will have no effect. Decreasing the evaluation order for a field will increase the evaluation order of the field previously holding that evaluation order value—and all fields in between the two fields—by one.

The order of PivotFilters in the collection is the same as the order in which they are evaluated. So developers can change the order in which a PivotField is evaluated. When a PivotField (non-OLAP PivotTables) or a CubeField (OLAP PivotTables) is removed from the PivotTables collection, this property is set to -1 for a Value or a Top n filter applied to the field. Adding the field back again will set the EvaluationOrder property to N+1 for a Value or Top n filter applied if a value is not explicitly specified.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Parent Property (Excel)

 Copy code hover
[image]

PivotFilter.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotFilter object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.PivotField Property (Excel)

 Copy code hover
[image]

PivotFilter.PivotField Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the PivotField to which the filter is applied. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotField

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Value1 Property (Excel)

 Copy code hover
[image]

PivotFilter.Value1 Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Value1

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.Value2 Property (Excel)

 Copy code hover
[image]

PivotFilter.Value2 Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is a user-supplied parameter to define a filter for a PivotField. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .Value2

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter.WholeDayFilter Property (Excel)

 Copy code hover
[image]

PivotFilter.WholeDayFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or gets the filtering semantics for date filters. Boolean. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .WholeDayFilter

expression A variable that represents a PivotFilter Object (Excel) object.

Remarks

The following describes the results for previous and current property settings:

  • False (Microsoft Office2010 behavior): Any time can be specified; dates are precise points in time (midnight of the specified date). Filtering date ranges start or end at midnight.

  • True (Microsoft Office 2013 behavior): This behavior is enforced for Timeline controls. Only whole dates are specified; dates include all times-of-day until and not including the next day at midnight.

For a Timeline, always returns True; returns a run-time error when setting to this to False.

For a non-date filter, any access returns a run-time error.

Property value

BOOL

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilter Methods (Excel)

 Copy code hover
[image]

PivotFilter Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the filter and removes it from the filter collections of the PivotField and the PivotTable.


PivotFilter.Delete Method (Excel)

 Copy code hover
[image]

PivotFilter.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the filter and removes it from the filter collections of the PivotField and the PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a PivotFilter object.

See also

Concepts

PivotFilter Object

Other resources

PivotFilter Object Members


PivotFilters Object (Excel)

 Copy code hover
[image]

PivotFilters Object (Excel)
See also Send feedback

Published: July 16, 2012

The PivotFilters object is a collection of PivotFilter objects.

Version Information

Version Added: Excel 2007

Remarks

The PivotFilters collection contains properties and methods to add new filters, count the number of existing filters in the collection, and reference specific PivotFilter objects.

Example

In the following example, a new PivotFilter is added to the PivotField at the currently active cell.

Copy code Copy code
ActiveCell.PivotField.PivotFilters.Add FilterType := xlThisWeek

See also

Concepts

Excel Object Model Reference

Other resources

PivotFilters Object Members


PivotFilters Members (Excel)

 Copy code hover
[image]

PivotFilters Members (Excel)
Send feedback

Published: July 16, 2012

The PivotFilters object is a collection of PivotFilter objects.

Methods

Name | Description
Add2 | Adds new filters to the PivotFilters collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotFilters collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a specific element of the PivotFilters collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotFilters object. Read-only.


PivotFilters Properties (Excel)

 Copy code hover
[image]

PivotFilters Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotFilters collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a specific element of the PivotFilters collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotFilters object. Read-only.


PivotFilters.Application Property (Excel)

 Copy code hover
[image]

PivotFilters.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotFilters object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFilters.Count Property (Excel)

 Copy code hover
[image]

PivotFilters.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the PivotFilters collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a PivotFilters object.

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFilters.Creator Property (Excel)

 Copy code hover
[image]

PivotFilters.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotFilters object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFilters.Item Property (Excel)

 Copy code hover
[image]

PivotFilters.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a specific element of the PivotFilters collection object by its position in the collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a PivotFilters object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies the position of an element of the collection.

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFilters.Parent Property (Excel)

 Copy code hover
[image]

PivotFilters.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotFilters object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotFilters object.

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFilters Methods (Excel)

 Copy code hover
[image]

PivotFilters Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add2 | Adds new filters to the PivotFilters collection.


PivotFilters.Add2 Method (Excel)

 Copy code hover
[image]

PivotFilters.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds new filters to the PivotFilters collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Add2(Type, DataField, Value1, Value2, Order, Name, Description, MemberPropertyField, WholeDayFilter)

expression A variable that represents a PivotFilters object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlPivotFilterType | Requires an XlPivotFilterType type of filter.
DataField | Optional | Variant | The field to which the filter is attached.
Value1 | Optional | Variant | Filter value 1.
Value2 | Optional | Variant | Filter value 2.
Order | Optional | Variant | Order in which the data should be filtered.
Name | Optional | Variant | Name of the filter.
Description | Optional | Variant | A brief description of the filter.
MemberPropertyField | Optional | Variant | Specifies the member property field on which the label filter is based.
WholeDayFilter | Optional | Variant | Specifies a filter based on days.

Return Value

PivotFilter

Example

Following are some examples of how to use the Add function correctly.

Copy code Copy code
ActiveCell.PivotField.PivotFilters.Add FilterType := xlThisWeek

ActiveCell.PivotField.PivotFilters.Add FilterType := xlTopCount DataField := MyPivotField2 Value1 := 10

ActiveCell.PivotField.PivotFilters.Add FilterType := xlCaptionIsNotBetween Value1 := "A" Value2 := "G"

ActiveCell.PivotField.PivotFilters.Add FilterType := xlValueIsGreaterThanOrEqualTo DataField := MyPivotField2 Value1 := 10000

The following example returns a run-time error because the data type of Value1 is invalid.

Copy code Copy code
ActiveCell.PivotField.PivotFilters.Add FilterType := xlValueIsGreaterThanOrEqualTo DataField := MyPivotField2 Value1 := "Allan"

See also

Concepts

PivotFilters Object

Other resources

PivotFilters Object Members


PivotFormula Object (Excel)

 Copy code hover
[image]

PivotFormula Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a formula used to calculate results in a PivotTable report.

Remarks

This object and its associated properties and methods aren't available for OLAP data sources because calculated fields and items aren't supported.

Example

Use PivotFormulas(index), where index is the formula number or string on the left side of the formula, to return the PivotFormula object. The following example changes the index number for formula one in the first PivotTable report on the first worksheet so that this formula will be solved after formula two.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotFormulas(1).Index = 2

See also

Concepts

Excel Object Model Reference

Other resources

PivotFormula Object Members


PivotFormula Members (Excel)

 Copy code hover
[image]

PivotFormula Members (Excel)
Send feedback

Published: July 16, 2012

Represents a formula used to calculate results in a PivotTable report.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
Index | Returns or sets a Long value that represents the index number of the PivotFormula object within the PivotFormulas collection.
Parent | Returns the parent object for the specified object. Read-only.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
Value | Returns or sets a String value that represents the name of the specified formula in the PivotTable formula.


PivotFormula Properties (Excel)

 Copy code hover
[image]

PivotFormula Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
Index | Returns or sets a Long value that represents the index number of the PivotFormula object within the PivotFormulas collection.
Parent | Returns the parent object for the specified object. Read-only.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
Value | Returns or sets a String value that represents the name of the specified formula in the PivotTable formula.


PivotFormula.Application Property (Excel)

 Copy code hover
[image]

PivotFormula.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotFormula object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.Creator Property (Excel)

 Copy code hover
[image]

PivotFormula.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotFormula object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.Formula Property (Excel)

 Copy code hover
[image]

PivotFormula.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.

Syntax

expression .Formula

expression A variable that represents a PivotFormula object.

Remarks

This property is not available for OLAP data sources.

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.Index Property (Excel)

 Copy code hover
[image]

PivotFormula.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the index number of the PivotFormula object within the PivotFormulas collection.

Syntax

expression .Index

expression A variable that represents a PivotFormula object.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.Parent Property (Excel)

 Copy code hover
[image]

PivotFormula.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotFormula object.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.StandardFormula Property (Excel)

 Copy code hover
[image]

PivotFormula.StandardFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.

Syntax

expression .StandardFormula

expression A variable that represents a PivotFormula object.

Remarks

The StandardFormula property primarily affects item names with date or number formatting. It provides a way to specify or query a formula for a given calculated item.

The StandardFormula property is "international-friendly" whereas the Formula property is not.

Example

This example adds 10 to the Decimals field and displays it as a calculated item in the data field. The example assumes that a PivotTable exists on the active worksheet and that a field titled "Decimals" exists in the data table.

VBA Copy code Copy code
Sub UseStandardFomula()

 Dim pvtTable As PivotTable
 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Change calculated field of decimals by adding '10'.
 pvtTable.CalculatedFields.Item(1).StandardFormula = "Decimals + 10"

End Sub

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula.Value Property (Excel)

 Copy code hover
[image]

PivotFormula.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the specified formula in the PivotTable formula.

Syntax

expression .Value

expression A variable that represents a PivotFormula object.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormula Methods (Excel)

 Copy code hover
[image]

PivotFormula Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


PivotFormula.Delete Method (Excel)

 Copy code hover
[image]

PivotFormula.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a PivotFormula object.

See also

Concepts

PivotFormula Object

Other resources

PivotFormula Object Members


PivotFormulas Object (Excel)

 Copy code hover
[image]

PivotFormulas Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of formulas for a PivotTable report. Each formula is represented by a PivotFormula object.

Remarks

This object and its associated properties and methods aren't available for OLAP data sources because calculated fields and items aren't supported.

Example

Use the PivotFormulas property to return the PivotFormulas collection. The following example creates a list of PivotTable formulas for the first PivotTable report on the active worksheet.

VBA Copy code Copy code
For Each pf in ActiveSheet.PivotTables(1).PivotFormulas
 Cells(r, 1).Value = pf.Formula
 r = r + 1
Next

See also

Concepts

Excel Object Model Reference

Other resources

PivotFormulas Object Members


PivotFormulas Members (Excel)

 Copy code hover
[image]

PivotFormulas Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of formulas for a PivotTable report. Each formula is represented by a PivotFormula object.

Methods

Name | Description
Add | Creates a new PivotTable formula.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotFormulas Properties (Excel)

 Copy code hover
[image]

PivotFormulas Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotFormulas.Application Property (Excel)

 Copy code hover
[image]

PivotFormulas.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotFormulas object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotFormulas.Count Property (Excel)

 Copy code hover
[image]

PivotFormulas.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotFormulas object.

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotFormulas.Creator Property (Excel)

 Copy code hover
[image]

PivotFormulas.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotFormulas object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotFormulas.Parent Property (Excel)

 Copy code hover
[image]

PivotFormulas.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotFormulas object.

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotFormulas Methods (Excel)

 Copy code hover
[image]

PivotFormulas Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new PivotTable formula.
Item | Returns a single object from a collection.


PivotFormulas.Add Method (Excel)

 Copy code hover
[image]

PivotFormulas.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new PivotTable formula.

Syntax

expression .Add(Formula, UseStandardFormula)

expression A variable that represents a PivotFormulas object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Required | String | The new PivotTable formula.
UseStandardFormula | Optional | Variant | A standard PivotTable formula.

Return Value

A PivotFormula object that represents the new PivotTable formula.

Example

This example creates a new PivotTable formula for the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotFormulas _
 .Add "Year['1998'] Apples = (Year['1997'] Apples) * 2"

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotFormulas.Item Method (Excel)

 Copy code hover
[image]

PivotFormulas.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotFormulas object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotFormula object contained by the collection.

Example

This example displays the first formula for PivotTable one on worksheet one.

VBA Copy code Copy code
MsgBox Worksheets(1).PivotTables(1).PivotFormulas.Item(1).Formula

See also

Concepts

PivotFormulas Object

Other resources

PivotFormulas Object Members


PivotItem Object (Excel)

 Copy code hover
[image]

PivotItem Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an item in a PivotTable field.

Remarks

The items are the individual data entries in a field category. The PivotItem object is a member of the PivotItems collection. The PivotItems collection contains all the items in a PivotField object.

Example

Use PivotItems(index), where index is the item index number or name, to return a single PivotItem object. The following example hides all entries in the first PivotTable report on Sheet3 that contain "1998" in the Year field.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").PivotItems("1998").Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

PivotItem Object Members


PivotItem Members (Excel)

 Copy code hover
[image]

PivotItem Members (Excel)
Send feedback

Published: July 16, 2012

Represents an item in a PivotTable field.

Methods

Name | Description
Delete | Deletes the object.
DrillTo | The DrillTo method supports drilling to a specified PivotField from a PivotItem.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the label text for the pivot item.
ChildItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataRange | Returns a Range object as shown in the following table. Read-only.
DrilledDown | True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
IsCalculated | True if the PivotTable item is a calculated field or item. Read-only Boolean.
LabelRange | Returns a Range object that represents all the cells in the PivotTable report that contain the item. Read-only.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
ParentItem | Returns a PivotItem object that represents the parent PivotTable item in the parent PivotField object (the field must be grouped so that it has a parent). Read-only.
ParentShowDetail | True if the specified item is showing because one of its parents is showing detail. False if the specified item isn't showing because one of its parents is hiding detail. This property is available only if the item is grouped. Read-only Boolean.
Position | Returns or sets a Long value that represents the position of the item in its field, if the item is currently showing.
RecordCount | Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.
ShowDetail | True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.
SourceName | Returns a Variant value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
SourceNameStandard | Returns a String that represents the PivotTable items' source name in standard English (United States) format settings. Read-only.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
Value | Returns or sets a String value that represents the name of the specified item in the PivotTable field.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


PivotItem Properties (Excel)

 Copy code hover
[image]

PivotItem Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Caption | Returns a String value that represents the label text for the pivot item.
ChildItems | Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataRange | Returns a Range object as shown in the following table. Read-only.
DrilledDown | True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
IsCalculated | True if the PivotTable item is a calculated field or item. Read-only Boolean.
LabelRange | Returns a Range object that represents all the cells in the PivotTable report that contain the item. Read-only.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
ParentItem | Returns a PivotItem object that represents the parent PivotTable item in the parent PivotField object (the field must be grouped so that it has a parent). Read-only.
ParentShowDetail | True if the specified item is showing because one of its parents is showing detail. False if the specified item isn't showing because one of its parents is hiding detail. This property is available only if the item is grouped. Read-only Boolean.
Position | Returns or sets a Long value that represents the position of the item in its field, if the item is currently showing.
RecordCount | Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.
ShowDetail | True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.
SourceName | Returns a Variant value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.
SourceNameStandard | Returns a String that represents the PivotTable items' source name in standard English (United States) format settings. Read-only.
StandardFormula | Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.
Value | Returns or sets a String value that represents the name of the specified item in the PivotTable field.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.


PivotItem.Application Property (Excel)

 Copy code hover
[image]

PivotItem.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotItem object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Caption Property (Excel)

 Copy code hover
[image]

PivotItem.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the label text for the pivot item.

Syntax

expression .Caption

expression A variable that represents a PivotItem object.

Remarks

The following table shows example values of the Caption property and related properties, given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (Same as the SQL property value; read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) | Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") | expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index names shown in the following table.

Name (OLAP data source) | Name (non-OLAP data source)
[Europe].[France].[Paris] | Paris

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.ChildItems Property (Excel)

 Copy code hover
[image]

PivotItem.ChildItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable item (a PivotItem object) or a collection of all the items (a PivotItems object) that are group children in the specified field, or children of the specified item. Read-only.

Syntax

expression .ChildItems(Index)

expression A variable that represents a PivotItem object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The item name or number (can be an array to specify more than one item).

Remarks

This property is not available for OLAP data sources.

Example

This example adds the names of all the child items of the item named "vegetables" to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtItem In _
 pvtTable.PivotFields("product")
 .PivotItems("vegetables").ChildItems
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtItem.Name
Next pvtItem

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Creator Property (Excel)

 Copy code hover
[image]

PivotItem.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotItem object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.DataRange Property (Excel)

 Copy code hover
[image]

PivotItem.DataRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object as shown in the following table. Read-only.

Syntax

expression .DataRange

expression A variable that represents a PivotItem object.

Remarks

Object | Data range
Data field | Data contained in the field
Row, column, or page field | Items in the field
Item | Data qualified by the item

Example

This example selects the PivotTable items in the field named "REGION."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Worksheets("Sheet1").Activate
pvtTable.PivotFields("REGION").DataRange.Select

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.DrilledDown Property (Excel)

 Copy code hover
[image]

PivotItem.DrilledDown Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the flag for the specified PivotTable field or PivotTable item is set to "drilled" (expanded, or visible). Read/write Boolean.

Syntax

expression .DrilledDown

expression A variable that represents a PivotItem object.

Remarks

You can use this property only for OLAP data sources.

You cannot set this property if the field or item is hidden.

Example

This example sets the flags to "not drilled" for all items in the state field in the third PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable3") _
 .PivotFields("state").DrilledDown = False

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Formula Property (Excel)

 Copy code hover
[image]

PivotItem.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.

Syntax

expression .Formula

expression A variable that represents a PivotItem object.

Remarks

This property is not available for OLAP data sources.

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.IsCalculated Property (Excel)

 Copy code hover
[image]

PivotItem.IsCalculated Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable item is a calculated field or item. Read-only Boolean.

Syntax

expression .IsCalculated

expression A variable that represents a PivotItem object.

Remarks

For OLAP data sources, this property always returns False.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.LabelRange Property (Excel)

 Copy code hover
[image]

PivotItem.LabelRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells in the PivotTable report that contain the item. Read-only.

Syntax

expression .LabelRange

expression A variable that represents a PivotItem object.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Name Property (Excel)

 Copy code hover
[image]

PivotItem.Name Property (Excel)
See also Send feedback

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a PivotItem object.

Remarks

The following table shows example values of the Name property and related properties given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (Same as SQL property value, read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) | Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") | expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index name as shown in the following table.

Name (OLAP data source) | Name (non-OLAP data source)
[Europe].[France].[Paris] | Paris

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Parent Property (Excel)

 Copy code hover
[image]

PivotItem.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotItem object.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.ParentItem Property (Excel)

 Copy code hover
[image]

PivotItem.ParentItem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotItem object that represents the parent PivotTable item in the parent PivotField object (the field must be grouped so that it has a parent). Read-only.

Syntax

expression .ParentItem

expression A variable that represents a PivotItem object.

Remarks

This property isn't available for OLAP data sources.

Example

This example displays the name of the parent item for the item that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "This item is a subitem of " & _
 ActiveCell.PivotItem.ParentItem.Name

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.ParentShowDetail Property (Excel)

 Copy code hover
[image]

PivotItem.ParentShowDetail Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified item is showing because one of its parents is showing detail. False if the specified item isn't showing because one of its parents is hiding detail. This property is available only if the item is grouped. Read-only Boolean.

Syntax

expression .ParentShowDetail

expression A variable that represents a PivotItem object.

Remarks

This property isn't available for OLAP data sources.

Example

This example displays a message if the item that contains the active cell is visible because its parent item is showing detail.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set pvtItem = ActiveCell.PivotItem
If pvtItem.ParentShowDetail = True Then
 MsgBox "Parent item is showing detail"
End If

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Position Property (Excel)

 Copy code hover
[image]

PivotItem.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the position of the item in its field, if the item is currently showing.

Syntax

expression .Position

expression A variable that represents a PivotItem object.

Example

This example displays the position number of the PivotTable item that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active item is in position number " & _
 ActiveCell.PivotItem.Position

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.RecordCount Property (Excel)

 Copy code hover
[image]

PivotItem.RecordCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of records in the PivotTable cache or the number of cache records that contain the specified item. Read-only Long.

Syntax

expression .RecordCount

expression A variable that represents a PivotItem object.

Remarks

This property reflects the transient state of the cache at the time that it's queried. The cache can change between queries.

Example

This example displays the number of cache records that contain "Kiwi" in the "Products" field.

VBA Copy code Copy code
MsgBox Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Product").PivotItems("Kiwi").RecordCount

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.ShowDetail Property (Excel)

 Copy code hover
[image]

PivotItem.ShowDetail Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.

Syntax

expression .ShowDetail

expression A variable that represents a PivotItem object.

Remarks

This property isn't available for OLAP data sources.

If the specified range isn't in a PivotTable report, the following statements are true:

  • The range must be in a single summary row or column.

  • This property returns False if any of the children of the row or column are hidden.

  • Setting this property to True is equivalent to unhiding all the children of the summary row or column.

  • Setting this property to False is equivalent to hiding all the children of the summary row or column.

If the specified range is in a PivotTable report, it's possible to set this property for more than one cell at a time if the range is contiguous. This property can be returned only if the range is a single cell.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.SourceName Property (Excel)

 Copy code hover
[image]

PivotItem.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the specified object's name as it appears in the original source data for the specified PivotTable report.

Syntax

expression .SourceName

expression A variable that represents a PivotItem object.

Remarks

The value of this property might be different from the current item name if the user renamed the item after creating the PivotTable report.

The following table shows example values of the SourceName property and related properties, given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (same as SQL property value, read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) | Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") | expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index names, as shown in the following table.

Name (OLAP data source) | Name (non-OLAP data source)
[Europe].[France].[Paris] | Paris

Example

This example displays the original name (the name from the source database) of the item that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.PivotTables(1).PivotSelect "1998", xlDataAndLabel
MsgBox "The original item name is " & _
 ActiveCell.PivotItem.SourceName

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.SourceNameStandard Property (Excel)

 Copy code hover
[image]

PivotItem.SourceNameStandard Property (Excel)
See also Send feedback

Returns a String that represents the PivotTable items' source name in standard English (United States) format settings. Read-only.

Syntax

expression .SourceNameStandard

expression A variable that represents a PivotItem object.

Remarks

This property is used when an item has a localized version and its SourceNameStandard property value differs from the SourceName property value, such as with date formatting.

Example

This example displays the source name for the sixth item on the fifth field of the active PivotTable. The example assumes that a PivotTable exists on the active worksheet and that the data source contains at least five fields and six items per field.

VBA Copy code Copy code
Sub CheckSourceNameStandard()

 Dim pvtTable As PivotTable
 Dim pvtField As PivotField
 Dim pvtItem As PivotItem

 Set pvtTable = ActiveSheet.PivotTables(1)
 Set pvtField = pvtTable.PivotFields(5)
 Set pvtItem = pvtField.PivotItems(6)

 ' Display source name.
 MsgBox "The source name is: " & pvtItem.SourceNameStandard

End Sub

See also

Concepts

SlicerItem Object
PivotItem Object

Other resources

SlicerItem Object Members
PivotItem Object Members


PivotItem.StandardFormula Property (Excel)

 Copy code hover
[image]

PivotItem.StandardFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String specifying formulas with standard English (United States) formatting. Read/write.

Syntax

expression .StandardFormula

expression A variable that represents a PivotItem object.

Remarks

The StandardFormula property primarily affects item names with date or number formatting. It provides a way to specify or query a formula for a given calculated item.

The StandardFormula property is "international-friendly" whereas the Formula property is not.

Example

This example adds 10 to the Decimals field and displays it as a calculated item in the data field. The example assumes that a PivotTable exists on the active worksheet and that a field titled "Decimals" exists in the data table.

VBA Copy code Copy code
Sub UseStandardFomula()

 Dim pvtTable As PivotTable
 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Change calculated field of decimals by adding '10'.
 pvtTable.CalculatedFields.Item(1).StandardFormula = "Decimals + 10"

End Sub

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Value Property (Excel)

 Copy code hover
[image]

PivotItem.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the specified item in the PivotTable field.

Syntax

expression .Value

expression A variable that represents a PivotItem object.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.Visible Property (Excel)

 Copy code hover
[image]

PivotItem.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a PivotItem object.

Remarks

The Visible property for a PivotTable item is True if the item is currently visible in the table.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem Methods (Excel)

 Copy code hover
[image]

PivotItem Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
DrillTo | The DrillTo method supports drilling to a specified PivotField from a PivotItem.


PivotItem.Delete Method (Excel)

 Copy code hover
[image]

PivotItem.Delete Method (Excel)
See also Send feedback

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a PivotItem object.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItem.DrillTo Method (Excel)

 Copy code hover
[image]

PivotItem.DrillTo Method (Excel)
See also Send feedback

Published: July 16, 2012

The DrillTo method supports drilling to a specified PivotField from a PivotItem.

Version Information

Version Added: Excel 2007

Syntax

expression .DrillTo(PivotItemName)

expression A variable that represents a PivotItem object.

Parameters

Name | Required/Optional | Data Type | Description
PivotItemName | Required | String | The name of the PivotItem to drill to.

Remarks

For OLAP data sources, the PivotField being drilled to has to be in the same hierarchy as the PivotItem being drilled or, if multiple attribute hierarchies are placed next to each other on rows or columns, the PivotField being drilled to has to be one of the attribute hierarchies that are next to each other; no user hierarchies can be placed in between the PivotField of the PivotItem being drilled and the PivotField being drilled to. If these conditions are not met, a run-time error is returned.

See also

Concepts

PivotItem Object

Other resources

PivotItem Object Members


PivotItemList Object (Excel)

 Copy code hover
[image]

PivotItemList Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the PivotItem objects in the specified PivotTable.

Remarks

Each PivotItem represents an item in a PivotTable field.

Use the RowItems or ColumnItems property of the PivotCell object to return a PivotItemList collection.

Example

Once a PivotItemList collection is returned, you can use the Item method to identify a particular PivotItem list. The following example displays the PivotItem list associated with cell B5 to the user. This example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckPivotItemList()

 ' Identify contents associated with PivotItemList.
 MsgBox "Contents associated with cell B5: " & _
 Application.Range("B5").PivotCell.RowItems.Item(1)

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

PivotItemList Object Members


PivotItemList Members (Excel)

 Copy code hover
[image]

PivotItemList Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the PivotItem objects in the specified PivotTable.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotItemList Properties (Excel)

 Copy code hover
[image]

PivotItemList Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotItemList.Application Property (Excel)

 Copy code hover
[image]

PivotItemList.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotItemList object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotItemList Object

Other resources

PivotItemList Object Members


PivotItemList.Count Property (Excel)

 Copy code hover
[image]

PivotItemList.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotItemList object.

See also

Concepts

PivotItemList Object

Other resources

PivotItemList Object Members


PivotItemList.Creator Property (Excel)

 Copy code hover
[image]

PivotItemList.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotItemList object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotItemList Object

Other resources

PivotItemList Object Members


PivotItemList.Parent Property (Excel)

 Copy code hover
[image]

PivotItemList.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotItemList object.

See also

Concepts

PivotItemList Object

Other resources

PivotItemList Object Members


PivotItemList Methods (Excel)

 Copy code hover
[image]

PivotItemList Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


PivotItemList.Item Method (Excel)

 Copy code hover
[image]

PivotItemList.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotItemList object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotItem object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example hides calculated item one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotFields("year") _
 .CalculatedItems.Item(1).Visible = False

See also

Concepts

PivotItemList Object

Other resources

PivotItemList Object Members


PivotItems Object (Excel)

 Copy code hover
[image]

PivotItems Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the PivotItem objects in a PivotTable field.

Remarks

The items are the individual data entries in a field category.

Example

Use the PivotItems method to return the PivotItems collection. The following example creates an enumerated list of field names and the items contained in those fields for the first PivotTable report on Sheet4.

VBA Copy code Copy code
Worksheets("sheet4").Activate
With Worksheets("sheet3").PivotTables(1)
 c = 1
 For i = 1 To .PivotFields.Count
 r = 1
 Cells(r, c) = .PivotFields(i).Name
 r = r + 1
 For x = 1 To .PivotFields(i).PivotItems.Count
 Cells(r, c) = .PivotFields(i).PivotItems(x).Name
 r = r + 1
 Next
 c = c + 1
 Next
End With

Use PivotItems(index), where index is the item index number or name, to return a single PivotItem object. The following example hides all entries in the first PivotTable report on Sheet3 that contain "1998" in the Year field.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").PivotItems("1998").Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

PivotItems Object Members


PivotItems Members (Excel)

 Copy code hover
[image]

PivotItems Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the PivotItem objects in a PivotTable field.

Methods

Name | Description
Add | Creates a new PivotTable item.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotItems Properties (Excel)

 Copy code hover
[image]

PivotItems Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotItems.Application Property (Excel)

 Copy code hover
[image]

PivotItems.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotItems object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotItems.Count Property (Excel)

 Copy code hover
[image]

PivotItems.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotItems object.

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotItems.Creator Property (Excel)

 Copy code hover
[image]

PivotItems.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotItems object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotItems.Parent Property (Excel)

 Copy code hover
[image]

PivotItems.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotItems object.

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotItems Methods (Excel)

 Copy code hover
[image]

PivotItems Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new PivotTable item.
Item | Returns a single object from a collection.


PivotItems.Add Method (Excel)

 Copy code hover
[image]

PivotItems.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new PivotTable item.

Syntax

expression .Add(Name)

expression A variable that represents a PivotItems object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the new PivotTable item.

Example

This example creates a new PivotTable item in the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotItems("Year").Add "1998"

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotItems.Item Method (Excel)

 Copy code hover
[image]

PivotItems.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

An Object value that represents an object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example hides the 1998 item in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").PivotItems.Item("1998").Visible = False

See also

Concepts

PivotItems Object

Other resources

PivotItems Object Members


PivotLayout Object (Excel)

 Copy code hover
[image]

PivotLayout Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the placement of fields in a PivotChart report.

Example

Use the PivotLayout property to return a PivotLayout object. The following example creates a list of PivotTable field names used in the first PivotChart report.

VBA Copy code Copy code
Sub ListFieldNames

 Dim objNewSheet As Worksheet
 Dim intRow As Integer
 Dim objPF As PivotField

 Set objNewSheet = Worksheets.Add

 intRow = 1

 For Each objPF In _
 Charts("Chart1").PivotLayout.PivotFields

 objNewSheet.Cells(intRow, 1).Value = objPF.Caption

 intRow = intRow + 1

 Next objPF

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

PivotLayout Object Members


PivotLayout Members (Excel)

 Copy code hover
[image]

PivotLayout Members (Excel)
Send feedback

Published: July 16, 2012

Represents the placement of fields in a PivotChart report.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
PivotTable | Returns a PivotTable object that represents the PivotTable report associated with the PivotChart report.


PivotLayout Properties (Excel)

 Copy code hover
[image]

PivotLayout Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
PivotTable | Returns a PivotTable object that represents the PivotTable report associated with the PivotChart report.


PivotLayout.Application Property (Excel)

 Copy code hover
[image]

PivotLayout.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotLayout object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotLayout Object

Other resources

PivotLayout Object Members


PivotLayout.Creator Property (Excel)

 Copy code hover
[image]

PivotLayout.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotLayout object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotLayout Object

Other resources

PivotLayout Object Members


PivotLayout.Parent Property (Excel)

 Copy code hover
[image]

PivotLayout.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotLayout object.

See also

Concepts

PivotLayout Object

Other resources

PivotLayout Object Members


PivotLayout.PivotTable Property (Excel)

 Copy code hover
[image]

PivotLayout.PivotTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotTable object that represents the PivotTable report associated with the PivotChart report.

Syntax

expression .PivotTable

expression A variable that represents a PivotLayout object.

Example

This example sets the current page for the PivotTable report on Sheet1 to the page named "Canada."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.PivotFields("Country").CurrentPage = "Canada"

This example determines the PivotTable report associated with the Sales chart on the active worksheet, and then it sets the page named "Oregon" as the current page for the PivotTable report.

VBA Copy code Copy code
Set objPT = _
 ActiveSheet.Charts("Sales").PivotLayout.PivotTable
objPT.PivotFields("State").CurrentPageName = "Oregon"

See also

Concepts

PivotLayout Object

Other resources

PivotLayout Object Members


PivotLine Object (Excel)

 Copy code hover
[image]

PivotLine Object (Excel)
See also Send feedback

Published: July 16, 2012

A PivotLine object is a line of rows or columns in an Excel PivotTable.

Version Information

Version Added: Excel 2007

Remarks

PivotLines contain only visible items, so collapsed children of items and items in hidden levels are not present in the PivotLine collection.

PivotLines always have a PivotItem in all positions. This means that the PivotLines representing subtotals in the PivotTable contain fewer PivotItems than regular PivotLines.

See also

Concepts

Excel Object Model Reference

Other resources

PivotLine Object Members


PivotLine Members (Excel)

 Copy code hover
[image]

PivotLine Members (Excel)
Send feedback

Published: July 16, 2012

A PivotLine object is a line of rows or columns in an Excel PivotTable.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
LineType | Returns an XlPivotLineType constant that indicates the type of PivotLine. Read-only.
Parent | Returns the parent object for the specified PivotLine object. Read-only.
PivotLineCells | Returns a collection of PivotCell objects in a PivotLine. Read-only.
PivotLineCellsFull | Retrieves all of the PivotLine cells including those that are hidden in compact form. Read-only
Position | Returns or sets the position of the PivotLine object. Read-only.


PivotLine Properties (Excel)

 Copy code hover
[image]

PivotLine Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
LineType | Returns an XlPivotLineType constant that indicates the type of PivotLine. Read-only.
Parent | Returns the parent object for the specified PivotLine object. Read-only.
PivotLineCells | Returns a collection of PivotCell objects in a PivotLine. Read-only.
PivotLineCellsFull | Retrieves all of the PivotLine cells including those that are hidden in compact form. Read-only
Position | Returns or sets the position of the PivotLine object. Read-only.


PivotLine.Application Property (Excel)

 Copy code hover
[image]

PivotLine.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotLine object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.Creator Property (Excel)

 Copy code hover
[image]

PivotLine.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotLine object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.LineType Property (Excel)

 Copy code hover
[image]

PivotLine.LineType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlPivotLineType constant that indicates the type of PivotLine. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .LineType

expression A variable that represents a PivotLine object.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.Parent Property (Excel)

 Copy code hover
[image]

PivotLine.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotLine object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotLine object.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.PivotLineCells Property (Excel)

 Copy code hover
[image]

PivotLine.PivotLineCells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a collection of PivotCell objects in a PivotLine. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotLineCells

expression A variable that represents a PivotLine object.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.PivotLineCellsFull Property (Excel)

 Copy code hover
[image]

PivotLine.PivotLineCellsFull Property (Excel)
See also Send feedback

Published: July 16, 2012

Retrieves all of the PivotLine cells including those that are hidden in compact form. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .PivotLineCellsFull

expression A variable that represents a PivotLine object.

Property value

PIVOTLINECELLS

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLine.Position Property (Excel)

 Copy code hover
[image]

PivotLine.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the PivotLine object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents a PivotLine object.

See also

Concepts

PivotLine Object

Other resources

PivotLine Object Members


PivotLineCells Object (Excel)

 Copy code hover
[image]

PivotLineCells Object (Excel)
See also Send feedback

Published: July 16, 2012

Collection of PivotCell objects for a specific PivotLine.

Version Information

Version Added: Excel 2007

Remarks

Use the PivotLineCells(index) method to return or specify the location of a specific PivotCell object in the collection. You can also specify a PivotField object or the PivotField name to return a single PivotCell object.

See also

Concepts

Excel Object Model Reference

Other resources

PivotLineCells Object Members


PivotLineCells Members (Excel)

 Copy code hover
[image]

PivotLineCells Members (Excel)
Send feedback

Published: July 16, 2012

Collection of PivotCell objects for a specific PivotLine.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotLineCells collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Full | When True, all of the PivotLineCells in the PivotLine (including those that are hidden in compact form) are retrieved. Boolean Read-only
Item | Returns a specific element of the PivotLineCells collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotLineCells object. Read-only.


PivotLineCells Properties (Excel)

 Copy code hover
[image]

PivotLineCells Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotLineCells collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Full | When True, all of the PivotLineCells in the PivotLine (including those that are hidden in compact form) are retrieved. Boolean Read-only
Item | Returns a specific element of the PivotLineCells collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotLineCells object. Read-only.


PivotLineCells.Application Property (Excel)

 Copy code hover
[image]

PivotLineCells.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotLineCells object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLineCells.Count Property (Excel)

 Copy code hover
[image]

PivotLineCells.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the PivotLineCells collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a PivotLineCells object.

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLineCells.Creator Property (Excel)

 Copy code hover
[image]

PivotLineCells.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotLineCells object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLineCells.Full Property (Excel)

 Copy code hover
[image]

PivotLineCells.Full Property (Excel)
See also Send feedback

Published: July 16, 2012

When True, all of the PivotLineCells in the PivotLine (including those that are hidden in compact form) are retrieved. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Full

expression A variable that represents a PivotLineCells object.

Property value

BOOL

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLineCells.Item Property (Excel)

 Copy code hover
[image]

PivotLineCells.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a specific element of the PivotLineCells collection object by its position in the collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a PivotLineCells object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies the position of an element of the collection.

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLineCells.Parent Property (Excel)

 Copy code hover
[image]

PivotLineCells.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotLineCells object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotLineCells object.

See also

Concepts

PivotLineCells Object

Other resources

PivotLineCells Object Members


PivotLines Object (Excel)

 Copy code hover
[image]

PivotLines Object (Excel)
See also Send feedback

Published: July 16, 2012

The PivotLines object is a collection of lines in a PivotTable, containing all lines on rows or columns of the pivot. Each line is a set of PivotCells.

Version Information

Version Added: Excel 2007

See also

Concepts

Excel Object Model Reference

Other resources

PivotLines Object Members


PivotLines Members (Excel)

 Copy code hover
[image]

PivotLines Members (Excel)
Send feedback

Published: July 16, 2012

The PivotLines object is a collection of lines in a PivotTable, containing all lines on rows or columns of the pivot. Each line is a set of PivotCells.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotLines collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a specific element of the PivotLines collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotLines object. Read-only.


PivotLines Properties (Excel)

 Copy code hover
[image]

PivotLines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of items in the PivotLines collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a specific element of the PivotLines collection object by its position in the collection. Read-only.
Parent | Returns the parent object for the specified PivotLines object. Read-only.


PivotLines.Application Property (Excel)

 Copy code hover
[image]

PivotLines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a PivotLines object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

PivotLines Object

Other resources

PivotLines Object Members


PivotLines.Count Property (Excel)

 Copy code hover
[image]

PivotLines.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the PivotLines collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a PivotLines object.

See also

Concepts

PivotLines Object

Other resources

PivotLines Object Members


PivotLines.Creator Property (Excel)

 Copy code hover
[image]

PivotLines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotLines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotLines Object

Other resources

PivotLines Object Members


PivotLines.Item Property (Excel)

 Copy code hover
[image]

PivotLines.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a specific element of the PivotLines collection object by its position in the collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a PivotLines object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies the position of an element of the collection.

See also

Concepts

PivotLines Object

Other resources

PivotLines Object Members


PivotLines.Parent Property (Excel)

 Copy code hover
[image]

PivotLines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified PivotLines object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a PivotLines object.

See also

Concepts

PivotLines Object

Other resources

PivotLines Object Members


PivotTable Object (Excel)

 Copy code hover
[image]

PivotTable Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a PivotTable report on a worksheet.

Remarks

The PivotTable object is a member of the PivotTables collection. The PivotTables collection contains all the PivotTable objects on a single worksheet.

Because PivotTable report programming can be complex, it's generally easiest to record PivotTable report actions and then revise the recorded code.

Example

Use PivotTables(index), where index is the PivotTable index number or name, to return a single PivotTable object. The following example makes the field named year a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("Sheet3").PivotTables(1) _
 .PivotFields("Year").Orientation = xlRowField

See also

Concepts

Excel Object Model Reference

Other resources

PivotTable Object Members


PivotTable Members (Excel)

 Copy code hover
[image]

PivotTable Members (Excel)
Send feedback

Published: July 16, 2012

Represents a PivotTable report on a worksheet.

Methods

Name | Description
AddDataField | Adds a data field to a PivotTable report. Returns a PivotField object that represents the new data field.
AddFields | Adds row, column, and page fields to a PivotTable report or PivotChart report.
AllocateChanges | Performs a writeback operation for all edited cells in a PivotTable report based on an OLAP data source.
CalculatedFields | Returns a CalculatedFields collection that represents all the calculated fields in the specified PivotTable report. Read-only.
ChangeConnection | Changes the connection of the specified PivotTable.
ChangePivotCache | Changes the PivotCache of the specified PivotTable.
ClearAllFilters | The ClearAllFilters method deletes all filters currently applied to the PivotTable. This includes deleting all filters in the PivotFilters collection of the PivotTable object, removing any manual filtering applied and setting all PivotFields in the Report Filter area to the default item.
ClearTable | The ClearTable method is used for clearing a PivotTable. Clearing PivotTables includes removing all the fields and deleting all filtering and sorting applied to the PivotTables. This method resets the PivotTable to the state it had right after it was created, before any fields were added to it.
CommitChanges | Performs a commit operation on the data source of a PivotTable report based on an OLAP data source.
ConvertToFormulas | The ConvertToFormulas method is new in Microsoft Office Excel 2007 and is used for converting a PivotTable to cube formulas. Read/write Boolean.
CreateCubeFile | Creates a cube file from a PivotTable report connected to an Online Analytical Processing (OLAP) data source.
DiscardChanges | Discards all changes in the edited cells of a PivotTable report based on an OLAP data source.
DrillDown | Enables you to drill down into the data within an OLAP or PowerPivot based cube hierarchy.
DrillTo | Enables you to drill to a location within an OLAP or PowerPivot based cube hierarchy.
DrillUp | Enables you to drill up into the data within an OLAP or PowerPivot based cube hierarchy.
GetData | Returns the value for the a data filed in a PivotTable.
GetPivotData | Returns a Range object with information about a data item in a PivotTable report.
ListFormulas | Creates a list of calculated PivotTable items and fields on a separate worksheet.
PivotCache | Returns a PivotCache object that represents the cache for the specified PivotTable report. Read-only.
PivotFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of both the visible and hidden fields (a PivotFields object) in the PivotTable report. Read-only.
PivotSelect | Selects part of a PivotTable report.
PivotTableWizard | Creates and returns a PivotTable object. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.
PivotValueCell | Retrieve the PivotValueCell Object (Excel) object for a given PivotTable provided certain row and column indices.
RefreshDataSourceValues | Retrieves the current values from the data source for all edited cells in a PivotTable report that is in writeback mode.
RefreshTable | Refreshes the PivotTable report from the source data. Returns True if it's successful.
RepeatAllLabels | Specifies whether to repeat item labels for all PivotFields in the specified PivotTable.
RowAxisLayout | This method is used for simultaneously setting layout options for all existing PivotFields.
ShowPages | Creates a new PivotTable report for each item in the page field. Each new report is created on a new worksheet.
SubtotalLocation | This method changes the subtotal location for all existing PivotFields. Changing the subtotal location has an immediate visual effect only for fields in outline form, but it will be set for fields in tabular form as well.
Update | Updates the PivotTable report.

Properties

Name | Description
ActiveFilters | Indicates the currently active filter in the specified PivotTable. Read-only.
Allocation | Returns or sets whether to run an UPDATE CUBE statement for each cell is edited, or only when the user chooses to calculate changes when performing what-if analysis on a PivotTable based on an OLAP data source. Read/write
AllocationMethod | Returns or sets what method to use to allocate values when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllocationValue | Returns or sets what value to allocate when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllocationWeightExpression | Returns or sets the MDX weight expression to use when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllowMultipleFilters | Sets or retrieves a value that indicates whether a PivotField can have multiple filters applied to it at the same time. Read/write Boolean.
AlternativeText | Returns or sets the descriptive (alternative) text string for the specified PivotTable. Read/write
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CacheIndex | Returns or sets the index number of the PivotTable cache. Read/write Long.
CalculatedMembers | Returns a CalculatedMembers collection representing all the calculated members and calculated measures for an OLAP PivotTable.
CalculatedMembersInFilters | Returns or sets whether to evaluate calculated members from OLAP servers in filters. Read/write
ChangeList | Returns the PivotTableChangeList collection that represents the list of changes that have been made to the specified PivotTable based on an OLAP data source. Read-only
ColumnFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as column fields. Read-only.
ColumnGrand | True if the PivotTable report shows grand totals for columns. Read/write Boolean.
ColumnRange | Returns a Range object that represents the range that contains the column area in the PivotTable report. Read-only.
CompactLayoutColumnHeader | Specifies the caption that is displayed in the column header of a PivotTable when in compact row layout form. Read/write String.
CompactLayoutRowHeader | Specifies the caption that is displayed in the row header of a PivotTable when in compact row layout form. Read/write String.
CompactRowIndent | Returns or sets the indent increment for PivotItems when compact row layout form is turned on. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeFields | Returns the CubeFields collection. Each CubeField object contains the properties of the cube field element. Read-only.
DataBodyRange | Returns a Range object that represents the range of values in a PivotTable. Read-only.
DataFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as data fields. Read-only.
DataLabelRange | Returns a Range object that represents the range that contains the labels for the data fields in the PivotTable report. Read-only.
DataPivotField | Returns a PivotField object that represents all the data fields in a PivotTable. Read-only.
DisplayContextTooltips | Controls whether or not tooltips are displayed for PivotTable cells. Read/write Boolean.
DisplayEmptyColumn | Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the value axis. The OLAP provider will not return empty columns in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.
DisplayEmptyRow | Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the category axis. The OLAP provider will not return empty rows in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.
DisplayErrorString | True if the PivotTable report displays a custom error string in cells that contain errors. The default value is False. Read/write Boolean.
DisplayFieldCaptions | Controls whether or not filter buttons and PivotField captions for rows and columns are displayed in the grid. Read/write.
DisplayImmediateItems | Returns or sets a Boolean that indicates whether items in the row and column areas are visible when the data area of the PivotTable is empty. Set this property to False to hide the items in the row and column areas when the data area of the PivotTable is empty. The default value is True.
DisplayMemberPropertyTooltips | Controls whether or not to display member properties in tooltips. Read/write Boolean.
DisplayNullString | True if the PivotTable report displays a custom string in cells that contain null values. The default value is True. Read/write Boolean.
EnableDataValueEditing | True to disable the alert for when the user overwrites values in the data area of the PivotTable. True also allows the user to change data values that previously could not be changed. The default value is False. Read/write Boolean.
EnableDrilldown | True if drilldown is enabled. The default value is True. Read/write Boolean.
EnableFieldDialog | True if the PivotTable Field dialog box is available when the user double-clicks the PivotTable field. The default value is True. Read/write Boolean.
EnableFieldList | False to disable the ability to display the field list for the PivotTable. If the field list was already being displayed it disappears. The default value is True. Read/write Boolean.
EnableWizard | True if the PivotTable Wizard is available. The default value is True. Read/write Boolean.
EnableWriteback | Returns or sets whether writing back to the data source is enabled for the specified PivotTable. The default value is False. Read/write.
ErrorString | Returns or sets a String value that represents the string displayed in cells that contain errors when the DisplayErrorString property is True.
FieldListSortAscending | Controls the sort order of fields in the PivotTable Field List. When this property is set to True, the fields are sorted in ascending order. When it is set to False, the fields are sorted in data source order. Read/write.
GrandTotalName | Returns or sets the text string label that is displayed in the grand total column or row heading in the specified PivotTable report. The default value is the string "Grand Total". Read/write String.
HasAutoFormat |
Hidden | Checks whether the PivotTable exists at the worksheet level. Boolean. Read-only
HiddenFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently not shown as row, column, page, or data fields. Read-only.
InGridDropZones | This property is used to toggle in-grid drop zones for a PivotTable object. In some cases, it also affects the layout of the PivotTable. Read/write Boolean.
InnerDetail | Returns or sets the name of the field that will be shown as detail when the ShowDetail property is True for the innermost row or column field. Read/write String.
LayoutRowDefault | This property specifies the layout settings for PivotFields when they are added to the PivotTable for the first time. Read/write xlLayoutRowType.
Location | Gets or sets a String that represents the top-left cell in the body of the specified PivotTable. Read/write.
ManualUpdate | True if the PivotTable report is recalculated only at the user's request. The default value is False. Read/write Boolean.
MDX | Returns a String indicating the Multidimensional Expression (MDX) that would be sent to the provider to populate the current PivotTable view. Read-only.
MergeLabels | True if the specified PivotTable report's outer-row item, column item, subtotal, and grand total labels use merged cells. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
NullString | Returns or sets the string displayed in cells that contain null values when the DisplayNullString property is True. The default value is an empty string (""). Read/write String.
PageFieldOrder | Returns or sets the order in which page fields are added to the PivotTable report's layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default constant is xlDownThenOver. Read/write Long.
PageFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as page fields. Read-only.
PageFieldStyle | Returns or sets the style used in the bound page field area. The default value is a null string (no style is applied by default). Read/write String.
PageFieldWrapCount | Returns or sets the number of page fields in each column or row in the PivotTable report. Read/write Long.
PageRange | Returns a Range object that represents the range that contains the page area in the PivotTable report. Read-only.
PageRangeCells | Returns a Range object that represents only the cells in the specified PivotTable report that contain the page fields and item drop-down lists.
Parent | Returns the parent object for the specified object. Read-only.
PivotChart | Returns a Shape Object (Excel) object that represents the standalone PivotChart for the specified hidden PivotTable report. Read-only.
PivotColumnAxis | Returns a PivotAxis object representing the entire column axis. Read-only PivotAxis.
PivotFormulas | Returns a PivotFormulas object that represents the collection of formulas for the specified PivotTable report. Read-only.
PivotRowAxis | Returns a PivotAxis object representing the entire row axis. Read-only PivotAxis.
PivotSelection | Returns or sets the PivotTable selection in standard PivotTable report selection format. Read/write String.
PivotSelectionStandard | Returns or sets a String indicating the PivotTable selection in standard PivotTable report format using English (United States) settings. Read/write.
PreserveFormatting | True if formatting is preserved when the report is refreshed or recalculated by operations such as pivoting, sorting, or changing page field items.For query tables, this property is True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.
PrintDrillIndicators | Specifies whether or not drill indicators are printed with the PivotTable. Read/write Boolean.
PrintTitles | True if the print titles for the worksheet are set based on the PivotTable report. False if the print titles for the worksheet are used. The default value is False. Read/write Boolean.
RefreshDate | Returns the date on which the PivotTable report was last refreshed. Read-only Date.
RefreshName | Returns the name of the person who last refreshed the PivotTable report data. Read-only String.
RepeatItemsOnEachPrintedPage | True if row, column, and item labels appear on the first row of each page when the specified PivotTable report is printed. False if labels are printed only on the first page. The default value is True. Read/write Boolean.
RowFields | Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as row fields. Read-only.
RowGrand | True if the PivotTable report shows grand totals for rows. Read/write Boolean.
RowRange | Returns a Range object that represents the range including the row area on the PivotTable report. Read-only.
SaveData | True if data for the PivotTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.
SelectionMode | Returns or sets the PivotTable report structured selection mode. Read/write XlPTSelectionMode.
ShowDrillIndicators | The ShowDrillIndicators property is used for toggling the display of drill indicators in the PivotTable. Read/write Boolean.
ShowPageMultipleItemLabel | When set to True (default), "(Multiple Items)" will appear in the PivotTable cell on the worksheet whenever items are hidden and an aggregate of non-hidden items is shown in the PivotTable view. Read/write Boolean.
ShowTableStyleColumnHeaders | The ShowTableStyleColumnHeaders property is set to True if the coulmn headers should be displayed in the PivotTable. Read/write Boolean.
ShowTableStyleColumnStripes | The ShowTableStyleColumnStripes property displays banded columns in which even columns are formatted differently from odd columns. This makes PivotTables easier to read. Read/write Boolean.
ShowTableStyleLastColumn |
ShowTableStyleRowHeaders | The ShowTableStyleRowHeaders property is set to True if the row headers should be displayed in the PivotTable. Read/write Boolean.
ShowTableStyleRowStripes | The ShowTableStyleRowStripes property displays banded rows in which even rows are formatted differently from odd rows. This makes PivotTables easier to read. Read/write Boolean.
ShowValuesRow | Returns or sets whether the values row is displayed. Read/write
Slicers | Returns the Slicers collection for the specified PivotTable. Read-only
SmallGrid | True if Microsoft Excel uses a grid that's two cells wide and two cells deep for a newly created PivotTable report. False if Excel uses a blank stencil outline. Read/write Boolean.
SortUsingCustomLists | The SortUsingCustomLists property controls whether custom lists are used for sorting items of fields, both initially when the PivotField is initialized and the PivotItems are ordered by their captions; and later when the user applies a sort. Read/write Boolean.
SourceData | Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.
SubtotalHiddenPageItems | True if hidden page field items in the PivotTable report are included in row and column subtotals, block totals, and grand totals. The default value is False. Read/write Boolean.
Summary | Returns or sets the description associated with the alternative text string for the specified PivotTable. Read/write
TableRange1 | Returns a Range object that represents the range containing the entire PivotTable report, but doesn't include page fields. Read-only.
TableRange2 | Returns a Range object that represents the range containing the entire PivotTable report, including page fields. Read-only.
TableStyle2 | The TableStyle2 property specifies the PivotTable style currently applied to the PivotTable. Read/write.
Tag | Returns or sets a string saved with the PivotTable report. Read/write String.
TotalsAnnotation | True if an asterisk (*) is displayed next to each subtotal and grand total value in the specified PivotTable report if the report is based on an OLAP data source. The default value is True. Read/write Boolean.
VacatedStyle | Returns or sets the style applied to cells vacated when the PivotTable report is refreshed. The default value is a null string (no style is applied by default). Read/write String.
Value | Returns or sets a String value that represents the name of the PivotTable report.
Version | Returns a XlPivotTableVersionList value that represents the Microsoft Excel version number.
ViewCalculatedMembers | When set to True (default), calculated members for Online Analytical Processing (OLAP) PivotTables can be viewed. Read/write Boolean.
VisibleFields | Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the visible fields (a PivotFields object). Visible fields are shown as row, column, page or data fields. Read-only.
VisualTotals | True (default) to enable Online Analytical Processing (OLAP) PivotTables to retotal after an item has been hidden from view. Read/write Boolean.
VisualTotalsForSets | Returns or sets whether to include filtered items in the totals of named sets for the specified PivotTable. Read/write


PivotTable Properties (Excel)

 Copy code hover
[image]

PivotTable Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveFilters | Indicates the currently active filter in the specified PivotTable. Read-only.
Allocation | Returns or sets whether to run an UPDATE CUBE statement for each cell is edited, or only when the user chooses to calculate changes when performing what-if analysis on a PivotTable based on an OLAP data source. Read/write
AllocationMethod | Returns or sets what method to use to allocate values when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllocationValue | Returns or sets what value to allocate when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllocationWeightExpression | Returns or sets the MDX weight expression to use when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write
AllowMultipleFilters | Sets or retrieves a value that indicates whether a PivotField can have multiple filters applied to it at the same time. Read/write Boolean.
AlternativeText | Returns or sets the descriptive (alternative) text string for the specified PivotTable. Read/write
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
CacheIndex | Returns or sets the index number of the PivotTable cache. Read/write Long.
CalculatedMembers | Returns a CalculatedMembers collection representing all the calculated members and calculated measures for an OLAP PivotTable.
CalculatedMembersInFilters | Returns or sets whether to evaluate calculated members from OLAP servers in filters. Read/write
ChangeList | Returns the PivotTableChangeList collection that represents the list of changes that have been made to the specified PivotTable based on an OLAP data source. Read-only
ColumnFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as column fields. Read-only.
ColumnGrand | True if the PivotTable report shows grand totals for columns. Read/write Boolean.
ColumnRange | Returns a Range object that represents the range that contains the column area in the PivotTable report. Read-only.
CompactLayoutColumnHeader | Specifies the caption that is displayed in the column header of a PivotTable when in compact row layout form. Read/write String.
CompactLayoutRowHeader | Specifies the caption that is displayed in the row header of a PivotTable when in compact row layout form. Read/write String.
CompactRowIndent | Returns or sets the indent increment for PivotItems when compact row layout form is turned on. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CubeFields | Returns the CubeFields collection. Each CubeField object contains the properties of the cube field element. Read-only.
DataBodyRange | Returns a Range object that represents the range of values in a PivotTable. Read-only.
DataFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as data fields. Read-only.
DataLabelRange | Returns a Range object that represents the range that contains the labels for the data fields in the PivotTable report. Read-only.
DataPivotField | Returns a PivotField object that represents all the data fields in a PivotTable. Read-only.
DisplayContextTooltips | Controls whether or not tooltips are displayed for PivotTable cells. Read/write Boolean.
DisplayEmptyColumn | Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the value axis. The OLAP provider will not return empty columns in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.
DisplayEmptyRow | Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the category axis. The OLAP provider will not return empty rows in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.
DisplayErrorString | True if the PivotTable report displays a custom error string in cells that contain errors. The default value is False. Read/write Boolean.
DisplayFieldCaptions | Controls whether or not filter buttons and PivotField captions for rows and columns are displayed in the grid. Read/write.
DisplayImmediateItems | Returns or sets a Boolean that indicates whether items in the row and column areas are visible when the data area of the PivotTable is empty. Set this property to False to hide the items in the row and column areas when the data area of the PivotTable is empty. The default value is True.
DisplayMemberPropertyTooltips | Controls whether or not to display member properties in tooltips. Read/write Boolean.
DisplayNullString | True if the PivotTable report displays a custom string in cells that contain null values. The default value is True. Read/write Boolean.
EnableDataValueEditing | True to disable the alert for when the user overwrites values in the data area of the PivotTable. True also allows the user to change data values that previously could not be changed. The default value is False. Read/write Boolean.
EnableDrilldown | True if drilldown is enabled. The default value is True. Read/write Boolean.
EnableFieldDialog | True if the PivotTable Field dialog box is available when the user double-clicks the PivotTable field. The default value is True. Read/write Boolean.
EnableFieldList | False to disable the ability to display the field list for the PivotTable. If the field list was already being displayed it disappears. The default value is True. Read/write Boolean.
EnableWizard | True if the PivotTable Wizard is available. The default value is True. Read/write Boolean.
EnableWriteback | Returns or sets whether writing back to the data source is enabled for the specified PivotTable. The default value is False. Read/write.
ErrorString | Returns or sets a String value that represents the string displayed in cells that contain errors when the DisplayErrorString property is True.
FieldListSortAscending | Controls the sort order of fields in the PivotTable Field List. When this property is set to True, the fields are sorted in ascending order. When it is set to False, the fields are sorted in data source order. Read/write.
GrandTotalName | Returns or sets the text string label that is displayed in the grand total column or row heading in the specified PivotTable report. The default value is the string "Grand Total". Read/write String.
HasAutoFormat |
Hidden | Checks whether the PivotTable exists at the worksheet level. Boolean. Read-only
HiddenFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently not shown as row, column, page, or data fields. Read-only.
InGridDropZones | This property is used to toggle in-grid drop zones for a PivotTable object. In some cases, it also affects the layout of the PivotTable. Read/write Boolean.
InnerDetail | Returns or sets the name of the field that will be shown as detail when the ShowDetail property is True for the innermost row or column field. Read/write String.
LayoutRowDefault | This property specifies the layout settings for PivotFields when they are added to the PivotTable for the first time. Read/write xlLayoutRowType.
Location | Gets or sets a String that represents the top-left cell in the body of the specified PivotTable. Read/write.
ManualUpdate | True if the PivotTable report is recalculated only at the user's request. The default value is False. Read/write Boolean.
MDX | Returns a String indicating the Multidimensional Expression (MDX) that would be sent to the provider to populate the current PivotTable view. Read-only.
MergeLabels | True if the specified PivotTable report's outer-row item, column item, subtotal, and grand total labels use merged cells. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
NullString | Returns or sets the string displayed in cells that contain null values when the DisplayNullString property is True. The default value is an empty string (""). Read/write String.
PageFieldOrder | Returns or sets the order in which page fields are added to the PivotTable report's layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default constant is xlDownThenOver. Read/write Long.
PageFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as page fields. Read-only.
PageFieldStyle | Returns or sets the style used in the bound page field area. The default value is a null string (no style is applied by default). Read/write String.
PageFieldWrapCount | Returns or sets the number of page fields in each column or row in the PivotTable report. Read/write Long.
PageRange | Returns a Range object that represents the range that contains the page area in the PivotTable report. Read-only.
PageRangeCells | Returns a Range object that represents only the cells in the specified PivotTable report that contain the page fields and item drop-down lists.
Parent | Returns the parent object for the specified object. Read-only.
PivotChart | Returns a Shape Object (Excel) object that represents the standalone PivotChart for the specified hidden PivotTable report. Read-only.
PivotColumnAxis | Returns a PivotAxis object representing the entire column axis. Read-only PivotAxis.
PivotFormulas | Returns a PivotFormulas object that represents the collection of formulas for the specified PivotTable report. Read-only.
PivotRowAxis | Returns a PivotAxis object representing the entire row axis. Read-only PivotAxis.
PivotSelection | Returns or sets the PivotTable selection in standard PivotTable report selection format. Read/write String.
PivotSelectionStandard | Returns or sets a String indicating the PivotTable selection in standard PivotTable report format using English (United States) settings. Read/write.
PreserveFormatting | True if formatting is preserved when the report is refreshed or recalculated by operations such as pivoting, sorting, or changing page field items.For query tables, this property is True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.
PrintDrillIndicators | Specifies whether or not drill indicators are printed with the PivotTable. Read/write Boolean.
PrintTitles | True if the print titles for the worksheet are set based on the PivotTable report. False if the print titles for the worksheet are used. The default value is False. Read/write Boolean.
RefreshDate | Returns the date on which the PivotTable report was last refreshed. Read-only Date.
RefreshName | Returns the name of the person who last refreshed the PivotTable report data. Read-only String.
RepeatItemsOnEachPrintedPage | True if row, column, and item labels appear on the first row of each page when the specified PivotTable report is printed. False if labels are printed only on the first page. The default value is True. Read/write Boolean.
RowFields | Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as row fields. Read-only.
RowGrand | True if the PivotTable report shows grand totals for rows. Read/write Boolean.
RowRange | Returns a Range object that represents the range including the row area on the PivotTable report. Read-only.
SaveData | True if data for the PivotTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.
SelectionMode | Returns or sets the PivotTable report structured selection mode. Read/write XlPTSelectionMode.
ShowDrillIndicators | The ShowDrillIndicators property is used for toggling the display of drill indicators in the PivotTable. Read/write Boolean.
ShowPageMultipleItemLabel | When set to True (default), "(Multiple Items)" will appear in the PivotTable cell on the worksheet whenever items are hidden and an aggregate of non-hidden items is shown in the PivotTable view. Read/write Boolean.
ShowTableStyleColumnHeaders | The ShowTableStyleColumnHeaders property is set to True if the coulmn headers should be displayed in the PivotTable. Read/write Boolean.
ShowTableStyleColumnStripes | The ShowTableStyleColumnStripes property displays banded columns in which even columns are formatted differently from odd columns. This makes PivotTables easier to read. Read/write Boolean.
ShowTableStyleLastColumn |
ShowTableStyleRowHeaders | The ShowTableStyleRowHeaders property is set to True if the row headers should be displayed in the PivotTable. Read/write Boolean.
ShowTableStyleRowStripes | The ShowTableStyleRowStripes property displays banded rows in which even rows are formatted differently from odd rows. This makes PivotTables easier to read. Read/write Boolean.
ShowValuesRow | Returns or sets whether the values row is displayed. Read/write
Slicers | Returns the Slicers collection for the specified PivotTable. Read-only
SmallGrid | True if Microsoft Excel uses a grid that's two cells wide and two cells deep for a newly created PivotTable report. False if Excel uses a blank stencil outline. Read/write Boolean.
SortUsingCustomLists | The SortUsingCustomLists property controls whether custom lists are used for sorting items of fields, both initially when the PivotField is initialized and the PivotItems are ordered by their captions; and later when the user applies a sort. Read/write Boolean.
SourceData | Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.
SubtotalHiddenPageItems | True if hidden page field items in the PivotTable report are included in row and column subtotals, block totals, and grand totals. The default value is False. Read/write Boolean.
Summary | Returns or sets the description associated with the alternative text string for the specified PivotTable. Read/write
TableRange1 | Returns a Range object that represents the range containing the entire PivotTable report, but doesn't include page fields. Read-only.
TableRange2 | Returns a Range object that represents the range containing the entire PivotTable report, including page fields. Read-only.
TableStyle2 | The TableStyle2 property specifies the PivotTable style currently applied to the PivotTable. Read/write.
Tag | Returns or sets a string saved with the PivotTable report. Read/write String.
TotalsAnnotation | True if an asterisk (*) is displayed next to each subtotal and grand total value in the specified PivotTable report if the report is based on an OLAP data source. The default value is True. Read/write Boolean.
VacatedStyle | Returns or sets the style applied to cells vacated when the PivotTable report is refreshed. The default value is a null string (no style is applied by default). Read/write String.
Value | Returns or sets a String value that represents the name of the PivotTable report.
Version | Returns a XlPivotTableVersionList value that represents the Microsoft Excel version number.
ViewCalculatedMembers | When set to True (default), calculated members for Online Analytical Processing (OLAP) PivotTables can be viewed. Read/write Boolean.
VisibleFields | Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the visible fields (a PivotFields object). Visible fields are shown as row, column, page or data fields. Read-only.
VisualTotals | True (default) to enable Online Analytical Processing (OLAP) PivotTables to retotal after an item has been hidden from view. Read/write Boolean.
VisualTotalsForSets | Returns or sets whether to include filtered items in the totals of named sets for the specified PivotTable. Read/write


PivotTable.ActiveFilters Property (Excel)

 Copy code hover
[image]

PivotTable.ActiveFilters Property (Excel)
See also Send feedback

Published: July 16, 2012

Indicates the currently active filter in the specified PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ActiveFilters

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Allocation Property (Excel)

 Copy code hover
[image]

PivotTable.Allocation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to run an UPDATE CUBE statement for each cell is edited, or only when the user chooses to calculate changes when performing what-if analysis on a PivotTable based on an OLAP data source. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Allocation

expression A variable that represents a PivotTable object.

Return Value

XlAllocation

Remarks

The Allocation property corresponds to the Calculate with changes setting in the What-If Analysis Settings dialog box. The default setting is xlManualAllocation, which corresponds to the Manually (when selecting calculate PivotTable with changes) setting.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AllocationMethod Property (Excel)

 Copy code hover
[image]

PivotTable.AllocationMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets what method to use to allocate values when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationMethod

expression A variable that represents a PivotTable object.

Return Value

XlAllocationMethod

Remarks

The AllocationMethod property corresponds to the Allocation Method setting in the What-If Analysis Settings dialog box. The default setting is xlEqualAllocation, which corresponds to the Equal Allocation setting. If the AllocationMethod property is set to xlWeightedAllocation, which corresponds to the Weighted Allocation setting, you can optionally specify the weight expression to use by setting the AllocationWeightExpression property. If you do not specify a weight expression, a weight expression equivalent to <leaf cell value> / <existing value> is used.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AllocationValue Property (Excel)

 Copy code hover
[image]

PivotTable.AllocationValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets what value to allocate when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationValue

expression A variable that represents a PivotTable object.

Return Value

XlAllocationValue

Remarks

The AllocationValue property corresponds to the Value to Allocate setting in the What-If Analysis Settings dialog box. The default setting is xlAllocateValue, which corresponds to the The value entered divided by the number of allocations setting.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AllocationWeightExpression Property (Excel)

 Copy code hover
[image]

PivotTable.AllocationWeightExpression Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the MDX weight expression to use when performing what-if analysis on a PivotTable report based on an OLAP data source. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationWeightExpression

expression A variable that represents a PivotTable object.

Remarks

The AllocationWeightExpression property corresponds to the Weight Expression setting in the What-If Analysis Settings dialog box. Before the AllocationWeightExpression property can be set, you must set the AllocationMethod property to xlWeightedAllocation.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AllowMultipleFilters Property (Excel)

 Copy code hover
[image]

PivotTable.AllowMultipleFilters Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or retrieves a value that indicates whether a PivotField can have multiple filters applied to it at the same time. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AllowMultipleFilters

expression A variable that represents a PivotTable object.

Remarks

Default value is False.

When this property is set to True, multiple filters can be applied to single PivotFields. When it is set to False, applying a filter to a PivotField that is already filtered will remove the existing filter and apply the new one. Setting this property to False when the PivotTable has fields with more than one filter applied will silently remove all filters in the PivotTable without displaying any alert. However, there is an alert when this is done through the user interface.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AlternativeText Property (Excel)

 Copy code hover
[image]

PivotTable.AlternativeText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the descriptive (alternative) text string for the specified PivotTable. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AlternativeText

expression A variable that represents a PivotTable object.

Return Value

String

Remarks

The value of the AlternativeText property corresponds to the value in the Title box on the Alt Text tab of the PivotTable Options dialog box.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Application Property (Excel)

 Copy code hover
[image]

PivotTable.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotTable object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CacheIndex Property (Excel)

 Copy code hover
[image]

PivotTable.CacheIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the index number of the PivotTable cache. Read/write Long.

Syntax

expression .CacheIndex

expression A variable that represents a PivotTable object.

Remarks

If you set the CacheIndex property so that one PivotTable report uses the cache for a second PivotTable report, the first report's fields must be a valid subset of the fields in the second report.

Example

This example sets the cache for the PivotTable report named "Pivot1" to the cache of the PivotTable report named "Pivot2."

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").CacheIndex = _
 Worksheets(1).PivotTables("Pivot2").CacheIndex

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CalculatedMembers Property (Excel)

 Copy code hover
[image]

PivotTable.CalculatedMembers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CalculatedMembers collection representing all the calculated members and calculated measures for an OLAP PivotTable.

Syntax

expression .CalculatedMembers

expression A variable that represents a PivotTable object.

Remarks

This property is used for Online Analytical Processing (OLAP) sources; a non-OLAP source will return a run-time error.

Example

This example adds a set to the PivotTable. It assumes a PivotTable exists on the active worksheet that is connected to an OLAP data source which contains a field titled "[Product].[All Products]".

VBA Copy code Copy code
Sub UseCalculatedMember()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Add the calculated member.
 pvtTable.CalculatedMembers.Add Name:="[Beef]", _
 Formula:="'{[Product].[All Products].Children}'", _
 Type:=xlCalculatedSet

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CalculatedMembersInFilters Property (Excel)

 Copy code hover
[image]

PivotTable.CalculatedMembersInFilters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to evaluate calculated members from OLAP servers in filters. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .CalculatedMembersInFilters

expression A variable that represents a PivotTable object.

Return Value

Boolean

Remarks

True if calculated members are evaluated in filters; otherwise False.

The value of this property corresponds to the setting of the Evaluate calculated members from OLAP servers in filters check box on the Totals & Filters tab of the PivotTable Options dialog box for a PivotTable report based on an OLAP data source.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ChangeList Property (Excel)

 Copy code hover
[image]

PivotTable.ChangeList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotTableChangeList collection that represents the list of changes that have been made to the specified PivotTable based on an OLAP data source. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .ChangeList

expression A variable that represents a PivotTable object.

Return Value

PivotTableChangeList

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ColumnFields Property (Excel)

 Copy code hover
[image]

PivotTable.ColumnFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as column fields. Read-only.

Syntax

expression .ColumnFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The field name or number (can be an array to specify more than one field).

Example

This example adds the field names of the PivotTable report columns to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.ColumnFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ColumnGrand Property (Excel)

 Copy code hover
[image]

PivotTable.ColumnGrand Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable report shows grand totals for columns. Read/write Boolean.

Syntax

expression .ColumnGrand

expression A variable that represents a PivotTable object.

Example

This example sets the PivotTable report to show grand totals for columns.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.ColumnGrand = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ColumnRange Property (Excel)

 Copy code hover
[image]

PivotTable.ColumnRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range that contains the column area in the PivotTable report. Read-only.

Syntax

expression .ColumnRange

expression A variable that represents a PivotTable object.

Example

This example selects the column headers for the PivotTable report.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").Select
ActiveCell.PivotTable.ColumnRange.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CompactLayoutColumnHeader Property (Excel)

 Copy code hover
[image]

PivotTable.CompactLayoutColumnHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the caption that is displayed in the column header of a PivotTable when in compact row layout form. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .CompactLayoutColumnHeader

expression A variable that represents a PivotTable object.

Remarks

When the user customizes these captions in the grid, it is also reflected in these properties.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CompactLayoutRowHeader Property (Excel)

 Copy code hover
[image]

PivotTable.CompactLayoutRowHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the caption that is displayed in the row header of a PivotTable when in compact row layout form. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .CompactLayoutRowHeader

expression A variable that represents a PivotTable object.

Remarks

When the user customizes these captions in the grid, it is also reflected in these properties.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CompactRowIndent Property (Excel)

 Copy code hover
[image]

PivotTable.CompactRowIndent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the indent increment for PivotItems when compact row layout form is turned on. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .CompactRowIndent

expression A variable that represents a PivotTable object.

Remarks

The default value is 1. The valid values for this setting are 0 to the maximum indent specified in Microsoft Excel.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Creator Property (Excel)

 Copy code hover
[image]

PivotTable.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotTable object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CubeFields Property (Excel)

 Copy code hover
[image]

PivotTable.CubeFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the CubeFields collection. Each CubeField object contains the properties of the cube field element. Read-only.

Syntax

expression .CubeFields

expression A variable that represents a PivotTable object.

Example

This example creates a list of cube field names for the data fields in the first OLAP-based PivotTable report on Sheet1.

VBA Copy code Copy code
Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objCubeFld In Worksheets("Sheet1").PivotTables(1).CubeFields
 If objCubeFld.Orientation = xlDataField Then
 objNewSheet.Cells(intRow, 1).Value = objCubeFld.Name
 intRow = intRow + 1
 End If
Next objCubeFld

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DataBodyRange Property (Excel)

 Copy code hover
[image]

PivotTable.DataBodyRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of values in a PivotTable. Read-only.

Syntax

expression .DataBodyRange

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DataFields Property (Excel)

 Copy code hover
[image]

PivotTable.DataFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently shown as data fields. Read-only.

Syntax

expression .DataFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The field name or number (can be an array to specify more than one field).

Example

This example adds the names for the PivotTable data fields to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.DataFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DataLabelRange Property (Excel)

 Copy code hover
[image]

PivotTable.DataLabelRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range that contains the labels for the data fields in the PivotTable report. Read-only.

Syntax

expression .DataLabelRange

expression A variable that represents a PivotTable object.

Example

This example selects the data field labels in the PivotTable report.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").Select
ActiveCell.PivotTable.DataLabelRange.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DataPivotField Property (Excel)

 Copy code hover
[image]

PivotTable.DataPivotField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that represents all the data fields in a PivotTable. Read-only.

Syntax

expression .DataPivotField

expression A variable that represents a PivotTable object.

Example

This example moves the second PivotItem object to the first position. It assumes a PivotTable exists on the active worksheet and that the PivotTable contains data fields.

VBA Copy code Copy code
Sub UseDataPivotField()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Move second PivotItem to the first position in PivotTable.
 pvtTable.DataPivotField.PivotItems(2).Position = 1

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayContextTooltips Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayContextTooltips Property (Excel)
See also Send feedback

Controls whether or not tooltips are displayed for PivotTable cells. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayContextTooltips

expression A variable that represents a PivotTable object.

Remarks

If DisplayContextTooltips is set to False, contextual tooltips for PivotTable cells will not be displayed. If it is set to True, tooltips for PivotTable cells in the row, column, and data areas will be displayed.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayEmptyColumn Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayEmptyColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the value axis. The OLAP provider will not return empty columns in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.

Syntax

expression .DisplayEmptyColumn

expression A variable that represents a PivotTable object.

Remarks

The PivotTable must be connected to an Online Analytical Processing (OLAP) data source to avoid a run-time error.

Example

This example determines the display settings for empty columns in a PivotTable. It assumes a PivotTable connected to an OLAP data source exists on the active worksheet.

VBA Copy code Copy code
Sub CheckSetting()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine display setting for empty columns.
 If pvtTable.DisplayEmptyColumn = False Then
 MsgBox "Empty columns will not be displayed."
 Else
 MsgBox "Empty columns will be displayed."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayEmptyRow Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayEmptyRow Property (Excel)
See also Send feedback

Returns True when the non-empty MDX keyword is included in the query to the OLAP provider for the category axis. The OLAP provider will not return empty rows in the result set. Returns False when the non-empty keyword is omitted. Read/write Boolean.

Syntax

expression .DisplayEmptyRow

expression A variable that represents a PivotTable object.

Remarks

The PivotTable must be connected to an Online Analytical Processing (OLAP) data source to avoid a run-time error.

Example

This example determines the display settings for empty rows in a PivotTable. It assumes a PivotTable connected to an OLAP data source exists on the active worksheet.

VBA Copy code Copy code
Sub CheckSetting()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine display setting for empty rows.
 If pvtTable.DisplayEmptyRow = False Then
 MsgBox "Empty rows will not be displayed."
 Else
 MsgBox "Empty rows will be displayed."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayErrorString Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayErrorString Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable report displays a custom error string in cells that contain errors. The default value is False. Read/write Boolean.

Syntax

expression .DisplayErrorString

expression A variable that represents a PivotTable object.

Remarks

Use the ErrorString property to set the custom error string.

This property is particularly useful for suppressing divide-by-zero errors when calculated fields are pivoted.

Example

This example causes the PivotTable report to display a hyphen in cells that contain errors.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .ErrorString = "-"
 .DisplayErrorString = True
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayFieldCaptions Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayFieldCaptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls whether or not filter buttons and PivotField captions for rows and columns are displayed in the grid. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayFieldCaptions

expression A variable that represents a PivotTable object.

Remarks

The default value is True.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayImmediateItems Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayImmediateItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that indicates whether items in the row and column areas are visible when the data area of the PivotTable is empty. Set this property to False to hide the items in the row and column areas when the data area of the PivotTable is empty. The default value is True.

Syntax

expression .DisplayImmediateItems

expression A variable that represents a PivotTable object.

Example

This example determines how the PivotTable was created and notifies the user. It assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckItemsDisplayed()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine how the PivotTable was created.
 If pvtTable.DisplayImmediateItems = True Then
 MsgBox "Fields have been added to the row or column areas for the PivotTable report."
 Else
 MsgBox "The PivotTable was created by using object-model calls."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayMemberPropertyTooltips Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayMemberPropertyTooltips Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls whether or not to display member properties in tooltips. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayMemberPropertyTooltips

expression A variable that represents a PivotTable object.

Remarks

If DisplayMemberPropertyTooltips is set to False, no member properties will be displayed in tooltips. If it is set to True, member properties will be displayed in tooltips.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DisplayNullString Property (Excel)

 Copy code hover
[image]

PivotTable.DisplayNullString Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable report displays a custom string in cells that contain null values. The default value is True. Read/write Boolean.

Syntax

expression .DisplayNullString

expression A variable that represents a PivotTable object.

Remarks

Use the NullString property to set the custom null string.

Example

This example causes the PivotTable report to display "NA" in cells that contain null values.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .NullString = "NA"
 .DisplayNullString = True
End With

This example causes the PivotTable report to display 0 (zero) in cells that contain null values.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").DisplayNullString = False

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableDataValueEditing Property (Excel)

 Copy code hover
[image]

PivotTable.EnableDataValueEditing Property (Excel)
See also Send feedback

Published: July 16, 2012

True to disable the alert for when the user overwrites values in the data area of the PivotTable. True also allows the user to change data values that previously could not be changed. The default value is False. Read/write Boolean.

Syntax

expression .EnableDataValueEditing

expression A variable that represents a PivotTable object.

Remarks

Any editing performed on data values is lost upon refresh.

Example

This example determines the alert setting for overwriting values in the data area and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckAlertSetting()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine alert setting.
 If pvtTable.EnableDataValueEditing = False Then
 MsgBox "Alert is enabled."
 Else
 MsgBox "Alert is disabled."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableDrilldown Property (Excel)

 Copy code hover
[image]

PivotTable.EnableDrilldown Property (Excel)
See also Send feedback

Published: July 16, 2012

True if drilldown is enabled. The default value is True. Read/write Boolean.

Syntax

expression .EnableDrilldown

expression A variable that represents a PivotTable object.

Remarks

Setting this property for a PivotTable report sets it for all fields in that report.

For OLAP data sources, the value is always True.

Example

This example disables drilldown for all fields in the first PivotTable report on worksheet one/.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").EnableDrilldown = False

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableFieldDialog Property (Excel)

 Copy code hover
[image]

PivotTable.EnableFieldDialog Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable Field dialog box is available when the user double-clicks the PivotTable field. The default value is True. Read/write Boolean.

Syntax

expression .EnableFieldDialog

expression A variable that represents a PivotTable object.

Remarks

Setting this property for a PivotTable report sets it for all fields in that report.

Example

This example disables the PivotTable Field dialog box for the Year field.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotFields("Year").EnableFieldDialog = False

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableFieldList Property (Excel)

 Copy code hover
[image]

PivotTable.EnableFieldList Property (Excel)
See also Send feedback

Published: July 16, 2012

False to disable the ability to display the field list for the PivotTable. If the field list was already being displayed it disappears. The default value is True. Read/write Boolean.

Syntax

expression .EnableFieldList

expression A variable that represents a PivotTable object.

Example

This example determines the whether the field list for the PivotTable can be displayed or not and notifies the user. The example assumes that a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckFieldList()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine if field list can be displayed.
 If pvtTable.EnableFieldList = True Then
 MsgBox "The field list for the PivotTable can be displayed."
 Else
 MsgBox "The field list for the PivotTable cannot be displayed."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableWizard Property (Excel)

 Copy code hover
[image]

PivotTable.EnableWizard Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable Wizard is available. The default value is True. Read/write Boolean.

Syntax

expression .EnableWizard

expression A variable that represents a PivotTable object.

Remarks

When this property is set, the field wells aren't displayed on the worksheet.

Example

This example disables the PivotTable Wizard for the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").EnableWizard = False

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.EnableWriteback Property (Excel)

 Copy code hover
[image]

PivotTable.EnableWriteback Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether writing back to the data source is enabled for the specified PivotTable. The default value is False. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .EnableWriteback

expression A variable that represents a PivotTable object.

Return Value

Boolean

Remarks

For OLAP data sources, setting to the EnableWriteback property to True to enables writeback and disables the alert for when the user overwrites values in the data area of the PivotTable. For non-OLAP data sources, setting the EnableWriteback property to True enables write-back in code, and also allows the user to change data values that previously could not be changed.

The EnableWriteback and EnableDataValueEditing properties of the PivotTable object cannot be set to True at the same time.

If the EnableDataValueEditing property is set to True and then the EnableWriteback property is set to True, the EnableDataValueEditing property is set to False automatically, the PivotTable is refreshed, and any editing performed on data values is lost.

If the EnableWriteback property is set to True and then the EnableDataValueEditing property is set to True, the EnableWriteback property is set to False automatically, the PivotTable is not refreshed, and the data source values are restored.

For non-OLAP data sources, setting this property generates a run-time error.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ErrorString Property (Excel)

 Copy code hover
[image]

PivotTable.ErrorString Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the string displayed in cells that contain errors when the DisplayErrorString property is True.

Syntax

expression .ErrorString

expression A variable that represents a PivotTable object.

Remarks

The default value for this property is an empty string ("").

Example

This example displays a hyphen in cells in the specified PivotTable report that contain errors.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .ErrorString = "-"
 .DisplayErrorString = True
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.FieldListSortAscending Property (Excel)

 Copy code hover
[image]

PivotTable.FieldListSortAscending Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls the sort order of fields in the PivotTable Field List. When this property is set to True, the fields are sorted in ascending order. When it is set to False, the fields are sorted in data source order. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .FieldListSortAscending

expression A variable that represents a PivotTable object.

Remarks

Does not apply to PivotTables connected to OLAP data sources.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.GrandTotalName Property (Excel)

 Copy code hover
[image]

PivotTable.GrandTotalName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text string label that is displayed in the grand total column or row heading in the specified PivotTable report. The default value is the string "Grand Total". Read/write String.

Syntax

expression .GrandTotalName

expression A variable that represents a PivotTable object.

Example

This example sets the grand total heading label to "Regional Total" in the second PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable2").GrandTotalName = "Regional Total"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Hidden Property (Excel)

 Copy code hover
[image]

PivotTable.Hidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Checks whether the PivotTable exists at the worksheet level. Boolean. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Hidden

expression A variable that represents a PivotTable object.

Remarks

When the Hidden property is set to True, the PivotTable object is hidden from the worksheet level. When the property is set to False, the PivotTable exists on a worksheet.

Property value

BOOL

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.HiddenFields Property (Excel)

 Copy code hover
[image]

PivotTable.HiddenFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently not shown as row, column, page, or data fields. Read-only.

Syntax

expression .HiddenFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the field to be returned (can be an array to specify more than one field).

Remarks

For OLAP data sources, this property always returns an empty collection.

Example

This example adds the hidden field names to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.HiddenFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.InGridDropZones Property (Excel)

 Copy code hover
[image]

PivotTable.InGridDropZones Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to toggle in-grid drop zones for a PivotTable object. In some cases, it also affects the layout of the PivotTable. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .InGridDropZones

expression A variable that represents a PivotTable object.

Remarks

When the InGridDropZones property is set to True, there are in-grid drop zones. When the property is set to False, there are no in-grid drop zones. The PivotTable layout also changes with this property.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.InnerDetail Property (Excel)

 Copy code hover
[image]

PivotTable.InnerDetail Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the field that will be shown as detail when the ShowDetail property is True for the innermost row or column field. Read/write String.

Syntax

expression .InnerDetail

expression A variable that represents a PivotTable object.

Remarks

This property isn't available for OLAP data sources.

Example

This example displays the name of the field that will be shown as detail when the ShowDetail property is True for the innermost row field or column field.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
MsgBox pvtTable.InnerDetail

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.LayoutRowDefault Property (Excel)

 Copy code hover
[image]

PivotTable.LayoutRowDefault Property (Excel)
See also Send feedback

Published: July 16, 2012

This property specifies the layout settings for PivotFields when they are added to the PivotTable for the first time. Read/write xlLayoutRowType.

Version Information

Version Added: Excel 2007

Syntax

expression .LayoutRowDefault

expression A variable that represents a PivotTable object.

Remarks

xlLayoutRowType can be either xlCompactRow, xlTabularRow, or xlOutlineRow.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Location Property (Excel)

 Copy code hover
[image]

PivotTable.Location Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets a String that represents the top-left cell in the body of the specified PivotTable. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Location

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ManualUpdate Property (Excel)

 Copy code hover
[image]

PivotTable.ManualUpdate Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable report is recalculated only at the user's request. The default value is False. Read/write Boolean.

Syntax

expression .ManualUpdate

expression A variable that represents a PivotTable object.

Remarks

This property is set to False immediately after your program terminates and after you execute the statement in the Immediate window of the Microsoft Visual Basic Editor.

Example

This example causes the PivotTable report to be recalculated only at the user's request.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").ManualUpdate = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.MDX Property (Excel)

 Copy code hover
[image]

PivotTable.MDX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String indicating the Multidimensional Expression (MDX) that would be sent to the provider to populate the current PivotTable view. Read-only.

Syntax

expression .MDX

expression A variable that represents a PivotTable object.

Remarks

Querying this value for a non-Online Analytical Processing (OLAP) PivotTable, or when there is no PivotTable view (no data items), will return a run-time error.

Example

This example returns the MDX string for the PivotTable. It assumes that a PivotTable exists on the active worksheet.

Copy code Copy code
Sub CheckMDX()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 MsgBox "The MDX string for the PivotTable is: " & _
 pvtTable.MDX

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.MergeLabels Property (Excel)

 Copy code hover
[image]

PivotTable.MergeLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified PivotTable report's outer-row item, column item, subtotal, and grand total labels use merged cells. Read/write Boolean.

Syntax

expression .MergeLabels

expression A variable that represents a PivotTable object.

Example

This example causes the first PivotTable report on worksheet one to use merged-cell outer-row item, column item, subtotal, and grand total labels.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).MergeLabels = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Name Property (Excel)

 Copy code hover
[image]

PivotTable.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.NullString Property (Excel)

 Copy code hover
[image]

PivotTable.NullString Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the string displayed in cells that contain null values when the DisplayNullString property is True. The default value is an empty string (""). Read/write String.

Syntax

expression .NullString

expression A variable that represents a PivotTable object.

Example

This example causes the PivotTable report to display "NA" in cells that contain null values.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .NullString = "NA"
 .DisplayNullString = True
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageFieldOrder Property (Excel)

 Copy code hover
[image]

PivotTable.PageFieldOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the order in which page fields are added to the PivotTable report's layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default constant is xlDownThenOver. Read/write Long.

Syntax

expression .PageFieldOrder

expression A variable that represents a PivotTable object.

Example

This example causes the PivotTable report to draw three page fields in a row before starting a new row.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .PageFieldOrder = xlOverThenDown
 .PageFieldWrapCount = 3
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageFields Property (Excel)

 Copy code hover
[image]

PivotTable.PageFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as page fields. Read-only.

Syntax

expression .PageFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the field to be returned (can be an array to specify more than one field).

Remarks

A hierarchy can contain only one page field.

For a PivotTable report based on a PivotTable cache, the collection of PivotTable fields that's returned reflects what's currently in the cache.

Example

This example adds the page field names to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.PageFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageFieldStyle Property (Excel)

 Copy code hover
[image]

PivotTable.PageFieldStyle Property (Excel)
See also Send feedback

Returns or sets the style used in the bound page field area. The default value is a null string (no style is applied by default). Read/write String.

Syntax

expression .PageFieldStyle

expression A variable that represents a PivotTable object.

Remarks

This style is used as the default style for the background area, and it's applied before any user formatting. Cells vacated when a field is pivoted from the page field area to another location retain this style.

Example

This example sets the page field area of the first PivotTable report on worksheet one to the PurpleAndGold style.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PageFieldStyle = "PurpleAndGold"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageFieldWrapCount Property (Excel)

 Copy code hover
[image]

PivotTable.PageFieldWrapCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of page fields in each column or row in the PivotTable report. Read/write Long.

Syntax

expression .PageFieldWrapCount

expression A variable that represents a PivotTable object.

Example

This example causes the PivotTable report to draw three page fields in a row before starting a new row.

VBA Copy code Copy code
With Worksheets(1).PivotTables("Pivot1")
 .PageFieldOrder = xlOverThenDown
 .PageFieldWrapCount = 3
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageRange Property (Excel)

 Copy code hover
[image]

PivotTable.PageRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range that contains the page area in the PivotTable report. Read-only.

Syntax

expression .PageRange

expression A variable that represents a PivotTable object.

Example

This example selects the page headers in the PivotTable report.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").Select
ActiveCell.PivotTable.PageRange.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PageRangeCells Property (Excel)

 Copy code hover
[image]

PivotTable.PageRangeCells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents only the cells in the specified PivotTable report that contain the page fields and item drop-down lists.

Syntax

expression .PageRangeCells

expression A variable that represents a PivotTable object.

Example

This example selects only the cells in the PivotTable report that contain page fields and item drop-down lists.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PageRangeCells.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Parent Property (Excel)

 Copy code hover
[image]

PivotTable.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotChart Property (Excel)

 Copy code hover
[image]

PivotTable.PivotChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape Object (Excel) object that represents the standalone PivotChart for the specified hidden PivotTable report. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .PivotChart

expression A variable that represents a PivotTable Object (Excel) object.

Returns

Shape Object (Excel)

Property value

SHAPE

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotColumnAxis Property (Excel)

 Copy code hover
[image]

PivotTable.PivotColumnAxis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotAxis object representing the entire column axis. Read-only PivotAxis.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotColumnAxis

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotFormulas Property (Excel)

 Copy code hover
[image]

PivotTable.PivotFormulas Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotFormulas object that represents the collection of formulas for the specified PivotTable report. Read-only.

Syntax

expression .PivotFormulas

expression A variable that represents a PivotTable object.

Remarks

For OLAP data sources, this property returns an empty collection.

Example

VBA Copy code Copy code
For Each pf in ActiveSheet.PivotTables(1).PivotFormulas
 r = r + 1
 Cells(r, 1).Value = pf.Formula
Next

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotRowAxis Property (Excel)

 Copy code hover
[image]

PivotTable.PivotRowAxis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotAxis object representing the entire row axis. Read-only PivotAxis.

Version Information

Version Added: Excel 2007

Syntax

expression .PivotRowAxis

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotSelection Property (Excel)

 Copy code hover
[image]

PivotTable.PivotSelection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the PivotTable selection in standard PivotTable report selection format. Read/write String.

Syntax

expression .PivotSelection

expression A variable that represents a PivotTable object.

Remarks

Setting this property is equivalent to calling the PivotSelect method with the Mode argument set to xlDataAndLabel.

Example

This example selects the data and label for the salesperson named Bob in the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotSelection = "Salesman[Bob]"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotSelectionStandard Property (Excel)

 Copy code hover
[image]

PivotTable.PivotSelectionStandard Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the PivotTable selection in standard PivotTable report format using English (United States) settings. Read/write.

Syntax

expression .PivotSelectionStandard

expression A variable that represents a PivotTable object.

Remarks

The PivotSelectionStandard property is "international-friendly" whereas the PivotSelection method is not.

Example

This example selects a field titled "1.57" in the PivotTable and inserts a blank column field before it. The example assumes a PivotTable exists on the active worksheet that contains a column field titled "1.57".

VBA Copy code Copy code
Sub CheckPivotSelectionStandard()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 pvtTable.PivotSelectionStandard = "1.57"
 Selection.Insert

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PreserveFormatting Property (Excel)

 Copy code hover
[image]

PivotTable.PreserveFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if formatting is preserved when the report is refreshed or recalculated by operations such as pivoting, sorting, or changing page field items.For query tables, this property is True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.

Syntax

expression .PreserveFormatting

expression A variable that represents a PivotTable object.

Remarks

For database query tables, the default formatting setting is xlSimple.

The new AutoFormat style is applied to the query table when the table is refreshed. The AutoFormat is reset to None whenever PreserveFormatting is set to False. As a result, any AutoFormat that's set before PreserveFormatting is set to False and before the query table is refreshed doesn't take effect, and the resulting query table has no formatting applied to it.

Example

This example preserves the formatting of the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").PreserveFormatting = True

This example demonstrates how setting PreserveFormatting to False causes the AutoFormat to be set to xlRangeAutoFormatNone instead of the specified xlRangeAutoFormatColor1 format.

VBA Copy code Copy code
With Workbooks(1).Worksheets(1).QueryTables(1)
 .Range.AutoFormat = xlRangeAutoFormatColor1
 .PreserveFormatting = False
 .Refresh
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PrintDrillIndicators Property (Excel)

 Copy code hover
[image]

PivotTable.PrintDrillIndicators Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether or not drill indicators are printed with the PivotTable. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .PrintDrillIndicators

expression A variable that represents a PivotTable object.

Remarks

Returns True if drill indicators are printed with the PivotTable and returns False if drill indicators are not printed with the PivotTable.

When the ShowDrillIndicators property is set to False, the PrintDrillIndicators property has no effect. Drill indicators are not printed when they are not displayed in the PivotTable.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PrintTitles Property (Excel)

 Copy code hover
[image]

PivotTable.PrintTitles Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the print titles for the worksheet are set based on the PivotTable report. False if the print titles for the worksheet are used. The default value is False. Read/write Boolean.

Syntax

expression .PrintTitles

expression A variable that represents a PivotTable object.

Remarks

The row print titles are set to the rows that contain the PivotTable report's column field items. The column print titles are set to the columns that contain the row items.

Example

This example specifies that the print title set for the worksheet is printed when the fourth PivotTable report on the active worksheet is printed.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable4").PrintTitles = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RefreshDate Property (Excel)

 Copy code hover
[image]

PivotTable.RefreshDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the date on which the PivotTable report was last refreshed. Read-only Date.

Syntax

expression .RefreshDate

expression A variable that represents a PivotTable object.

Remarks

For OLAP data sources, this property is updated after each query.

Example

This example displays the date on which the PivotTable report was last refreshed.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
dateString = Format(pvtTable.RefreshDate, "Long Date")
MsgBox "The data was last refreshed on " & dateString

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RefreshName Property (Excel)

 Copy code hover
[image]

PivotTable.RefreshName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the person who last refreshed the PivotTable report data. Read-only String.

Syntax

expression .RefreshName

expression A variable that represents a PivotTable object.

Remarks

For OLAP data sources, this property is updated after each query.

Example

This example displays the name of the person who last refreshed the PivotTable report.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
MsgBox "The data was last refreshed by " & pvtTable.RefreshName

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RepeatItemsOnEachPrintedPage Property (Excel)

 Copy code hover
[image]

PivotTable.RepeatItemsOnEachPrintedPage Property (Excel)
See also Send feedback

Published: July 16, 2012

True if row, column, and item labels appear on the first row of each page when the specified PivotTable report is printed. False if labels are printed only on the first page. The default value is True. Read/write Boolean.

Syntax

expression .RepeatItemsOnEachPrintedPage

expression A variable that represents a PivotTable object.

Remarks

Microsoft Excel prints row and column labels in place of any print titles set for the worksheet. Use the PrintTitles property to determine whether print titles are set for the PivotTable report.

Example

This example sets Microsoft Excel to repeat the labels on each page when the fourth PivotTable report on the active worksheet is printed.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable4") _
 .RepeatItemsOnEachPrintedPage = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RowFields Property (Excel)

 Copy code hover
[image]

PivotTable.RowFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the fields (a PivotFields object) that are currently showing as row fields. Read-only.

Syntax

expression .RowFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the field to be returned (can be an array to specify more than one field).

Example

This example adds the PivotTable report's row field names to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.RowFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RowGrand Property (Excel)

 Copy code hover
[image]

PivotTable.RowGrand Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable report shows grand totals for rows. Read/write Boolean.

Syntax

expression .RowGrand

expression A variable that represents a PivotTable object.

Example

This example sets the PivotTable report to show grand totals for rows.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.RowGrand = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RowRange Property (Excel)

 Copy code hover
[image]

PivotTable.RowRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range including the row area on the PivotTable report. Read-only.

Syntax

expression .RowRange

expression A variable that represents a PivotTable object.

Example

This example selects the row headers on the PivotTable report.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").Select
ActiveCell.PivotTable.RowRange.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SaveData Property (Excel)

 Copy code hover
[image]

PivotTable.SaveData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data for the PivotTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.

Syntax

expression .SaveData

expression A variable that represents a PivotTable object.

Remarks

For OLAP data sources, this property is always set to False.

Example

This example sets the PivotTable report to save data with the workbook.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.SaveData = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SelectionMode Property (Excel)

 Copy code hover
[image]

PivotTable.SelectionMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the PivotTable report structured selection mode. Read/write XlPTSelectionMode.

Syntax

expression .SelectionMode

expression A variable that represents a PivotTable object.

Remarks

XlPTSelectionMode can be one of these XlPTSelectionMode constants.

xlBlanks

xlButton

xlDataAndLabel

xlDataOnly

xlFirstRow

xlLabelOnly

xlOrigin

If the PivotTable field isn't in outline form, specifying the sum of any of the constants and xlFirstRow is equivalent to specifying the constant alone.

Example

This example enables structured selection mode and then sets the first PivotTable report on worksheet one to allow only data to be selected.

VBA Copy code Copy code
Application.PivotTableSelection = True
Worksheets(1).PivotTables(1).SelectionMode = xlDataOnly

In this example, the PivotTable report is in outline form.

VBA Copy code Copy code
Application.PivotTableSelection = True
Worksheets(1).PivotTables(1).SelectionMode = _
 xlDataOnly + xlFirstRow

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowDrillIndicators Property (Excel)

 Copy code hover
[image]

PivotTable.ShowDrillIndicators Property (Excel)
See also Send feedback

Published: July 16, 2012

The ShowDrillIndicators property is used for toggling the display of drill indicators in the PivotTable. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowDrillIndicators

expression A variable that represents a PivotTable object.

Remarks

Returns True if drill indicators are displayed in the PivotTable and returns False if drill indicators are not displayed in the PivotTable.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowPageMultipleItemLabel Property (Excel)

 Copy code hover
[image]

PivotTable.ShowPageMultipleItemLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), "(Multiple Items)" will appear in the PivotTable cell on the worksheet whenever items are hidden and an aggregate of non-hidden items is shown in the PivotTable view. Read/write Boolean.

Syntax

expression .ShowPageMultipleItemLabel

expression A variable that represents a PivotTable object.

Example

This example determines if "(Multiple Items)" will be displayed in the PivotTable cell and notifies the user. The example assumes that a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub UseShowPageMultipleItemLabel()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine if multiple items are allowed.
 If pvtTable.ShowPageMultipleItemLabel = True Then
 MsgBox "The words 'Multiple Items' can be displayed."
 Else
 MsgBox "The words 'Multiple Items' cannot be displayed."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowTableStyleColumnHeaders Property (Excel)

 Copy code hover
[image]

PivotTable.ShowTableStyleColumnHeaders Property (Excel)
See also Send feedback

Published: July 16, 2012

The ShowTableStyleColumnHeaders property is set to True if the coulmn headers should be displayed in the PivotTable. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleColumnHeaders

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowTableStyleColumnStripes Property (Excel)

 Copy code hover
[image]

PivotTable.ShowTableStyleColumnStripes Property (Excel)
See also Send feedback

Published: July 16, 2012

The ShowTableStyleColumnStripes property displays banded columns in which even columns are formatted differently from odd columns. This makes PivotTables easier to read. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleColumnStripes

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowTableStyleRowHeaders Property (Excel)

 Copy code hover
[image]

PivotTable.ShowTableStyleRowHeaders Property (Excel)
See also Send feedback

Published: July 16, 2012

The ShowTableStyleRowHeaders property is set to True if the row headers should be displayed in the PivotTable. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleRowHeaders

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowTableStyleRowStripes Property (Excel)

 Copy code hover
[image]

PivotTable.ShowTableStyleRowStripes Property (Excel)
See also Send feedback

Published: July 16, 2012

The ShowTableStyleRowStripes property displays banded rows in which even rows are formatted differently from odd rows. This makes PivotTables easier to read. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowTableStyleRowStripes

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowValuesRow Property (Excel)

 Copy code hover
[image]

PivotTable.ShowValuesRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the values row is displayed. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowValuesRow

expression A variable that represents a PivotTable object.

Remarks

This property corresponds to the setting of the Show the Values row check box on the Display tab of the PivotTable Options dialog box.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Slicers Property (Excel)

 Copy code hover
[image]

PivotTable.Slicers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Slicers collection for the specified PivotTable. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Slicers

expression A variable that represents a PivotTable object.

Remarks

Slicers can be used to filter data in PivotTable reports. The Slicers collection contains Slicer objects that represent the slicers that are associated with the specified PivotTable.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SmallGrid Property (Excel)

 Copy code hover
[image]

PivotTable.SmallGrid Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel uses a grid that's two cells wide and two cells deep for a newly created PivotTable report. False if Excel uses a blank stencil outline. Read/write Boolean.

Syntax

expression .SmallGrid

expression A variable that represents a PivotTable object.

Remarks

You should use the stencil outline. The grid is provided only because it enables compatibility with earlier versions of Excel.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on this cache, at cell A3 on the active worksheet. The example uses the stencil outline instead of the cell grid.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .MaintainConnection = True
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 0
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 0
 End With
End With

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SortUsingCustomLists Property (Excel)

 Copy code hover
[image]

PivotTable.SortUsingCustomLists Property (Excel)
See also Send feedback

Published: July 16, 2012

The SortUsingCustomLists property controls whether custom lists are used for sorting items of fields, both initially when the PivotField is initialized and the PivotItems are ordered by their captions; and later when the user applies a sort. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .SortUsingCustomLists

expression A variable that represents a PivotTable object.

Remarks

Setting this property to False can optimize performance for fields with many items, and it also allows users who do not want custom list-based sorting to avoid it.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SourceData Property (Excel)

 Copy code hover
[image]

PivotTable.SourceData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the data source for the PivotTable report, as shown in the following table. Read-write Variant.

Syntax

expression .SourceData

expression A variable that represents a PivotTable object.

Remarks

Data source | Return value
Microsoft Excel list or database | The cell reference, as text.
External data source | An array. Each row consists of an SQL connection string with the remaining elements as the query string, broken down into 255-character segments.
Multiple consolidation ranges | A two-dimensional array. Each row consists of a reference and its associated page field items.
Another PivotTable report | One of the above three kinds of information.

This property is not available for OLE DB data sources.

Example

Assume that you used an external data source to create a PivotTable report on Sheet1. This example inserts the SQL connection string and query string into a new worksheet.

VBA Copy code Copy code
Set newSheet = ActiveWorkbook.Worksheets.Add
sdArray = Worksheets("Sheet1").UsedRange.PivotTable.SourceData
For i = LBound(sdArray) To UBound(sdArray)
 newSheet.Cells(i, 1) = sdArray(i)
Next i

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SubtotalHiddenPageItems Property (Excel)

 Copy code hover
[image]

PivotTable.SubtotalHiddenPageItems Property (Excel)
See also Send feedback

Published: July 16, 2012

True if hidden page field items in the PivotTable report are included in row and column subtotals, block totals, and grand totals. The default value is False. Read/write Boolean.

Syntax

expression .SubtotalHiddenPageItems

expression A variable that represents a PivotTable object.

Remarks

For OLAP data sources, the value is always True.

Example

This example sets the first PivotTable report on worksheet one to exclude hidden page field items in subtotals.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").SubtotalHiddenPageItems = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Summary Property (Excel)

 Copy code hover
[image]

PivotTable.Summary Property (Excel)
Send feedback

Published: July 16, 2012

Returns or sets the description associated with the alternative text string for the specified PivotTable. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Summary

expression A variable that represents a PivotTable object.

Remarks

The value of the Summary property corresponds to the value in the Description box on the Alt Text tab of the PivotTable Options dialog box.


PivotTable.TableRange1 Property (Excel)

 Copy code hover
[image]

PivotTable.TableRange1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing the entire PivotTable report, but doesn't include page fields. Read-only.

Syntax

expression .TableRange1

expression A variable that represents a PivotTable object.

Remarks

The TableRange2 property includes page fields.

Example

This example selects all of the PivotTable report except its page fields.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").PivotTable.TableRange1.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.TableRange2 Property (Excel)

 Copy code hover
[image]

PivotTable.TableRange2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing the entire PivotTable report, including page fields. Read-only.

Syntax

expression .TableRange2

expression A variable that represents a PivotTable object.

Remarks

The TableRange1 property doesn't include page fields.

Example

This example selects the entire PivotTable report, including its page fields.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A3").PivotTable.TableRange2.Select

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.TableStyle2 Property (Excel)

 Copy code hover
[image]

PivotTable.TableStyle2 Property (Excel)
See also Send feedback

Published: July 16, 2012

The TableStyle2 property specifies the PivotTable style currently applied to the PivotTable. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .TableStyle2

expression A variable that represents a PivotTable object.

Remarks

The property is called TableStyle2 because there is an exisiting property named TableStyle.

Example

Copy code Copy code
Sub ApplyingStyle()

 ActiveSheet.PivotTables("PivotTable1").TableStyle2 = "PivotStyleLight17"

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Tag Property (Excel)

 Copy code hover
[image]

PivotTable.Tag Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string saved with the PivotTable report. Read/write String.

Syntax

expression .Tag

expression A variable that represents a PivotTable object.

Example

This example sets the PivotTable report's Tag property.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").Tag = "Product Sales by Region"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.TotalsAnnotation Property (Excel)

 Copy code hover
[image]

PivotTable.TotalsAnnotation Property (Excel)
See also Send feedback

True if an asterisk (*) is displayed next to each subtotal and grand total value in the specified PivotTable report if the report is based on an OLAP data source. The default value is True. Read/write Boolean.

Syntax

expression .TotalsAnnotation

expression A variable that represents a PivotTable object.

Remarks

When this property is set to True, the asterisk indicates that hidden items are included in the total. The asterisk appears regardless of whether any items in the report have been hidden.

For non-OLAP data sources, the value of this property is always False.

Example

This example turns off the asterisks in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables(1).TotalsAnnotation = False

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.VacatedStyle Property (Excel)

 Copy code hover
[image]

PivotTable.VacatedStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the style applied to cells vacated when the PivotTable report is refreshed. The default value is a null string (no style is applied by default). Read/write String.

Syntax

expression .VacatedStyle

expression A variable that represents a PivotTable object.

Example

This example sets the vacated cells in the PivotTable report to the BlackAndBlue style.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").VacatedStyle = "BlackAndBlue"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Value Property (Excel)

 Copy code hover
[image]

PivotTable.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the PivotTable report.

Syntax

expression .Value

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Version Property (Excel)

 Copy code hover
[image]

PivotTable.Version Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlPivotTableVersionList value that represents the Microsoft Excel version number.

Syntax

expression .Version

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ViewCalculatedMembers Property (Excel)

 Copy code hover
[image]

PivotTable.ViewCalculatedMembers Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True (default), calculated members for Online Analytical Processing (OLAP) PivotTables can be viewed. Read/write Boolean.

Syntax

expression .ViewCalculatedMembers

expression A variable that represents a PivotTable object.

Example

This example determines if calculated members can be viewed on the PivotTable and notifies the user. It assumes that a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckViewCalculatedMembers()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine if calculated members can be viewed.
 If pvtTable.ViewCalculatedMembers = True Then
 MsgBox "Calculated members can be viewed."
 Else
 MsgBox "Calculated members cannot be viewed."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.VisibleFields Property (Excel)

 Copy code hover
[image]

PivotTable.VisibleFields Property (Excel)
See also Send feedback

Returns an object that represents either a single field in a PivotTable report (a PivotField object) or a collection of all the visible fields (a PivotFields object). Visible fields are shown as row, column, page or data fields. Read-only.

Syntax

expression .VisibleFields(Index)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the field to be returned (can be an array to specify more than one field).

Remarks

For OLAP data sources, there are no hidden fields, and this property returns all the fields in the PivotTable cache.

Example

This example adds the visible field names to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.VisibleFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.VisualTotals Property (Excel)

 Copy code hover
[image]

PivotTable.VisualTotals Property (Excel)
See also Send feedback

Published: July 16, 2012

True (default) to enable Online Analytical Processing (OLAP) PivotTables to retotal after an item has been hidden from view. Read/write Boolean.

Syntax

expression .VisualTotals

expression A variable that represents a PivotTable object.

Remarks

In non-OLAP PivotTables, if you hide an item, the total is recomputed to reflect only the items that remain visible in the PivotTable. In an OLAP PivotTable, the total is computed on the server and is therefore unaffected by whether any items are hidden in the PivotTable view. However, if the VisualTotals property is set to False for an OLAP PivotTable, then the results of the OLAP PivotTable will match those of the non-OLAP PivotTable.

For OLAP PivotTables, a VisualTotals property setting of True (default) works the same way as described for non-OLAP PivotTables.

The VisualTotals property returns True for all new PivotTables. However, if you open a workbook in the current version of Microsoft Excel and the PivotTable had been created in a previous version of Excel, then the VisualTotals property will return False.

Note Note

All previously created PivotTables will have the VisualTotals property set to False by default, unless the user changes it, but for all newly created ones the VisualTotals property is set to True.

Example

This example determines if the ability to re-total after an item has been hidden from view is available for OLAP PivotTables and notifies the user. The example assumes a PivotTable exists on the active worksheet.

VBA Copy code Copy code
Sub CheckVisualTotals()

 Dim pvtTable As PivotTable

 Set pvtTable = ActiveSheet.PivotTables(1)

 ' Determine if visual totals is enabled for OLAP PivotTables.
 If pvtTable.VisualTotals = True Then
 MsgBox "Ability enabled to re-total after an item " & _
 "has been hidden from view."
 Else
 MsgBox "Unable to re-total items not hidden from view."
 End If

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.VisualTotalsForSets Property (Excel)

 Copy code hover
[image]

PivotTable.VisualTotalsForSets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to include filtered items in the totals of named sets for the specified PivotTable. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .VisualTotalsForSets

expression A variable that represents a PivotTable object.

Return Value

Boolean

Remarks

True if filtered items are included in the totals for named sets; otherwise False. The default value of this property is False.

In a PivotTable based on an OLAP data source, you can configure whether totals for named sets in the PivotTable will include items that have been filtered. The setting of the VisualTotalsForSets property corresponds to the Include filtered items in set totals check box on the Totals & Filters tab of the PivotTable Options dialog box.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable Methods (Excel)

 Copy code hover
[image]

PivotTable Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddDataField | Adds a data field to a PivotTable report. Returns a PivotField object that represents the new data field.
AddFields | Adds row, column, and page fields to a PivotTable report or PivotChart report.
AllocateChanges | Performs a writeback operation for all edited cells in a PivotTable report based on an OLAP data source.
CalculatedFields | Returns a CalculatedFields collection that represents all the calculated fields in the specified PivotTable report. Read-only.
ChangeConnection | Changes the connection of the specified PivotTable.
ChangePivotCache | Changes the PivotCache of the specified PivotTable.
ClearAllFilters | The ClearAllFilters method deletes all filters currently applied to the PivotTable. This includes deleting all filters in the PivotFilters collection of the PivotTable object, removing any manual filtering applied and setting all PivotFields in the Report Filter area to the default item.
ClearTable | The ClearTable method is used for clearing a PivotTable. Clearing PivotTables includes removing all the fields and deleting all filtering and sorting applied to the PivotTables. This method resets the PivotTable to the state it had right after it was created, before any fields were added to it.
CommitChanges | Performs a commit operation on the data source of a PivotTable report based on an OLAP data source.
ConvertToFormulas | The ConvertToFormulas method is new in Microsoft Office Excel 2007 and is used for converting a PivotTable to cube formulas. Read/write Boolean.
CreateCubeFile | Creates a cube file from a PivotTable report connected to an Online Analytical Processing (OLAP) data source.
DiscardChanges | Discards all changes in the edited cells of a PivotTable report based on an OLAP data source.
DrillDown | Enables you to drill down into the data within an OLAP or PowerPivot based cube hierarchy.
DrillTo | Enables you to drill to a location within an OLAP or PowerPivot based cube hierarchy.
DrillUp | Enables you to drill up into the data within an OLAP or PowerPivot based cube hierarchy.
GetData | Returns the value for the a data filed in a PivotTable.
GetPivotData | Returns a Range object with information about a data item in a PivotTable report.
ListFormulas | Creates a list of calculated PivotTable items and fields on a separate worksheet.
PivotCache | Returns a PivotCache object that represents the cache for the specified PivotTable report. Read-only.
PivotFields | Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of both the visible and hidden fields (a PivotFields object) in the PivotTable report. Read-only.
PivotSelect | Selects part of a PivotTable report.
PivotTableWizard | Creates and returns a PivotTable object. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.
PivotValueCell | Retrieve the PivotValueCell Object (Excel) object for a given PivotTable provided certain row and column indices.
RefreshDataSourceValues | Retrieves the current values from the data source for all edited cells in a PivotTable report that is in writeback mode.
RefreshTable | Refreshes the PivotTable report from the source data. Returns True if it's successful.
RepeatAllLabels | Specifies whether to repeat item labels for all PivotFields in the specified PivotTable.
RowAxisLayout | This method is used for simultaneously setting layout options for all existing PivotFields.
ShowPages | Creates a new PivotTable report for each item in the page field. Each new report is created on a new worksheet.
SubtotalLocation | This method changes the subtotal location for all existing PivotFields. Changing the subtotal location has an immediate visual effect only for fields in outline form, but it will be set for fields in tabular form as well.
Update | Updates the PivotTable report.


PivotTable.AddDataField Method (Excel)

 Copy code hover
[image]

PivotTable.AddDataField Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a data field to a PivotTable report. Returns a PivotField object that represents the new data field.

Syntax

expression .AddDataField(Field, Caption, Function)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Field | Required | Object | The unique field on the server. If the source data is Online Analytical Processing (OLAP), the unique field is a cube field. If the source data is non-OLAP (non-OLAP source data), the unique field is a PivotTable field.
Caption | Optional | Variant | The label used in the PivotTable report to identify this data field.
Function | Optional | Variant | The function performed in the added data field.

Return Value

PivotField

Example

This example adds a data field titled "Total Score" to a pivot table called "PivotTable1".

Note Note

This example assumes a table exists in which one of the columns contains a column titled "Score".

VBA Copy code Copy code
Sub AddMoreFields()

 With ActiveSheet.PivotTables("PivotTable1")
 .AddDataField ActiveSheet.PivotTables( _
 "PivotTable1").PivotFields("Score"), "Total Score"
 End With

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AddFields Method (Excel)

 Copy code hover
[image]

PivotTable.AddFields Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds row, column, and page fields to a PivotTable report or PivotChart report.

Syntax

expression .AddFields(RowFields, ColumnFields, PageFields, AddToTable)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
RowFields | Optional | Variant | Specifies a field name (or an array of field names) to be added as rows, or to be added to the category axis.
ColumnFields | Optional | Variant | Specifies a field name (or an array of field names) to be added as columns, or to be added to the series axis.
PageFields | Optional | Variant | Specifies a field name (or an array of field names) to be added as pages, or to be added to the page area.
AddToTable | Optional | Variant | Applies only to PivotTable reports. True to add the specified fields to the report (none of the existing fields are replaced). False to replace existing fields with the new fields. The default value is False.

Return Value

Variant

Remarks

You must specify one of the field arguments.

Field names specify the unique name returned by the SourceName property of the PivotField object.

This method is not available for OLAP data sources.

Example

This example replaces the existing column fields in the first PivotTable report on Sheet1 with the Status and Closed_By fields.

VBA Copy code Copy code
Worksheets("Sheet1").PivotTables(1).AddFields _
 ColumnFields:=Array("Status", "Closed_By")

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.AllocateChanges Method (Excel)

 Copy code hover
[image]

PivotTable.AllocateChanges Method (Excel)
See also Send feedback

Performs a writeback operation for all edited cells in a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Syntax

expression .AllocateChanges

expression A variable that represents a PivotTable object.

Return Value

Nothing

Remarks

The AllocateChanges method will execute an UPDATE CUBE statement for all changes made in the values area of the PivotTable since the last apply changes operation was committed, or since the PivotTable was created if commiting apply changes has never been performed. This method generates a run-time error if it is executed on a PivotTable report based on a non-OLAP data source.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CalculatedFields Method (Excel)

 Copy code hover
[image]

PivotTable.CalculatedFields Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CalculatedFields collection that represents all the calculated fields in the specified PivotTable report. Read-only.

Syntax

expression .CalculatedFields

expression A variable that represents a PivotTable object.

Return Value

CalculatedFields

Example

This example prevents the calculated fields from being dragged to the row position.

VBA Copy code Copy code
For Each fld in _
 Worksheets(1).PivotTables("Pivot1") _
 .CalculatedFields
 fld.DragToRow = False
Next

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ChangeConnection Method (Excel)

 Copy code hover
[image]

PivotTable.ChangeConnection Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the connection of the specified PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ChangeConnection(conn)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
conn | Required | WorkbookConnection | A WorkbookConnection object that repesents the new conneciton for the PivotTable.

Remarks

The ChangeConnection method can only be used with a PivotTable that is connected to an external data source. A run-time error will occur if the ChangeConnection method is used with a PivotTable that uses data stored on a worksheet as its data source.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ChangePivotCache Method (Excel)

 Copy code hover
[image]

PivotTable.ChangePivotCache Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the PivotCache of the specified PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ChangePivotCache(bstr)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
bstr | Required | String | A PivotTable or PivotCache object that represents the new PivotCache for the specfied PivotTable.

Remarks

The ChangePivotCache method can only be used with a PivotTable that uses data stored on a worksheet as its data source. A run-time error will occur if the ChangePivotCache method is used with a PivotTable that is connected to an external data source.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ClearAllFilters Method (Excel)

 Copy code hover
[image]

PivotTable.ClearAllFilters Method (Excel)
See also Send feedback

Published: July 16, 2012

The ClearAllFilters method deletes all filters currently applied to the PivotTable. This includes deleting all filters in the PivotFilters collection of the PivotTable object, removing any manual filtering applied and setting all PivotFields in the Report Filter area to the default item.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearAllFilters

expression A variable that represents a PivotTable object.

Remarks

After calling the ClearAllFilters method, the PivotFilters collection will be empty.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ClearTable Method (Excel)

 Copy code hover
[image]

PivotTable.ClearTable Method (Excel)
See also Send feedback

The ClearTable method is used for clearing a PivotTable. Clearing PivotTables includes removing all the fields and deleting all filtering and sorting applied to the PivotTables. This method resets the PivotTable to the state it had right after it was created, before any fields were added to it.

Version Information

Version Added: Excel 2007

Syntax

expression .ClearTable

expression A variable that represents a PivotTable object.

Remarks

The ClearTable function takes no arguments and is available for both relational and OLAP PivotTables.

Example

The following example clears a PivotTable on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables(1).ClearTable()

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CommitChanges Method (Excel)

 Copy code hover
[image]

PivotTable.CommitChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Performs a commit operation on the data source of a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Syntax

expression .CommitChanges

expression A variable that represents a PivotTable object.

Return Value

Nothing

Remarks

The CommitChanges method sends a COMMIT TRANSACTION statement to the OLAP server, and clears all cells that were edited by entering a value, but will not clear formulas in value cells. This method generates a run-time error if it is executed on a PivotTable report based on a non-OLAP data source.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ConvertToFormulas Method (Excel)

 Copy code hover
[image]

PivotTable.ConvertToFormulas Method (Excel)
See also Send feedback

Published: July 16, 2012

The ConvertToFormulas method is new in Microsoft Office Excel 2007 and is used for converting a PivotTable to cube formulas. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ConvertToFormulas(ConvertFilters)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
ConvertFilters | Required | Boolean | Contains True or False to indicate the state of the ReportFilter area.

Remarks

The argument controls whether or not to convert the ReportFilter area of the PivotTable.

Example

In the following example the ReportFilter area is not converted.

Copy code Copy code
Sub ConvertToCubeFormulas()
 ActiveSheet.PivotTables("PivotTable1").ConvertToFormulas False
End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.CreateCubeFile Method (Excel)

 Copy code hover
[image]

PivotTable.CreateCubeFile Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a cube file from a PivotTable report connected to an Online Analytical Processing (OLAP) data source.

Syntax

expression .CreateCubeFile(File, Measures, Levels, Members, Properties)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
File | Required | String | The name of the cube file to be created. It will overwrite the file if it already exists.
Measures | Optional | Variant | An array of unique names of measures that are to be part of the slice.
Levels | Optional | Variant | An array of strings. Each array item is a unique level name. It represents the lowest level of a hierarchy that is in the slice.
Members | Optional | Variant | An array of string arrays. The elements correspond, in order, to the hierarchies represented in the Levels array. Each element is an array of string arrays that consists of the unique names of the top level members in the dimension that are to be included in the slice.
Properties | Optional | Variant | False results in no member properties being included in the slice. The default value is True.

Return Value

String

Example

This example creates a cube file titled "CustomCubeFile" on drive C:\ with no member properties to be included in the slice. With the Measures, Levels, and Members arguments omitted from this example, the cube file will end up matching the view of the PivotTable report. This example assumes a PivotTable report connected to an OLAP data source exists on the active worksheet.

VBA Copy code Copy code
Sub UseCreateCubeFile()

 ActiveSheet.PivotTables(1).CreateCubeFile _
 File:="C:\CustomCubeFile", Properties:=False

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DiscardChanges Method (Excel)

 Copy code hover
[image]

PivotTable.DiscardChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Discards all changes in the edited cells of a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Syntax

expression .DiscardChanges

expression A variable that represents a PivotTable object.

Return Value

Nothing

Remarks

For a PivotTable report based on an OLAP data source, the method removes all values and formulas entered in value cells, and then runs a PivotTable update operation to retrieve the latest values from the data source. It sets the data source value to NULL for all value cells that are edited, and also executes a ROLLBACK TRANSACTION statement against the OLAP server.

If you try to execute this method for a PivotTable report based on a non-OLAP data source, this method generates a run-time error.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DrillDown Method (Excel)

 Copy code hover
[image]

PivotTable.DrillDown Method (Excel)
See also Send feedback

Published: July 16, 2012

Enables you to drill down into the data within an OLAP or PowerPivot based cube hierarchy.

Version information

Version Added: Excel 2013

Syntax

expression .DrillDown(PivotItem,PivotLine)

expression A variable that represents a PivotTable Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
PivotItem | Required | PIVOTITEM | The member from which the drill down is performed.
PivotLine | Optional | VARIANT | Specifies the line in the PivotTable where the operation starting member resides. In cases where PivotLine is not specified, defaults to the top PivotLine where the member appears.

Return value

VOID

Example

The following sample code demonstrates the DrillDown method as used on a PivotTable.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").DrillDown ActiveSheet.PivotTables( _
      "PivotTable1").PivotFields("[Customer].[Customer Geography].[Country]"). _
      PivotItems("[Customer].[Customer Geography].[Country].&[Australia]"), _
      ActiveSheet.PivotTables("PivotTable1").PivotRowAxis.PivotLines(1)

The following sample code demonstrates the DrillDown method as used on a PivotChart.

VBA Copy code Copy code
ActiveChart.PivotLayout.PivotTable.DrillDown ActiveChart.PivotLayout.PivotTable _
        .PivotFields("[Customer].[Customer Geography].[Country]").PivotItems( _
        "[Customer].[Customer Geography].[Country].&[Australia]"), ActiveChart. _
        PivotLayout.PivotTable.PivotRowAxis.PivotLines(1)

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DrillTo Method (Excel)

 Copy code hover
[image]

PivotTable.DrillTo Method (Excel)
See also Send feedback

Published: July 16, 2012

Enables you to drill to a location within an OLAP or PowerPivot based cube hierarchy.

Version information

Version Added: Excel 2013

Syntax

expression .DrillTo(PivotItem,CubeField,PivotLine)

expression A variable that represents a PivotTable Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
PivotItem | Required | PIVOTITEM | The member from which the drill operation is performed.
CubeField | Required | CUBEFIELD | The target hierarchy being drilled to.
PivotLine | Optional | VARIANT | Specifies the line in the PivotTable where the operation starting member resides. In cases where PivotLine is not specified, defaults to the top PivotLine where the member appears.

Return value

VOID

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.DrillUp Method (Excel)

 Copy code hover
[image]

PivotTable.DrillUp Method (Excel)
See also Send feedback

Published: July 16, 2012

Enables you to drill up into the data within an OLAP or PowerPivot based cube hierarchy.

Version information

Version Added: Excel 2013

Syntax

expression .DrillUp(PivotItem,PivotLine,LevelUniqueName)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data type | Description
PivotItem | Required | PIVOTITEM | The member from which the drill up is performed.
PivotLine | Optional | VARIANT | Specifies the line in the PivotTable where the operation starting member resides. In cases where PivotLine is not specified, defaults to the top PivotLine where the member appears.
LevelUniqueName | Optional | VARIANT | The target for a multi-level drill up. The default action if not specified is a one level drill up.

Return value

VOID

Examples

The following sample code demonstrates a single-level drill up on a PivotTable

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").DrillUp ActiveSheet.PivotTables( _
      "PivotTable1").PivotFields("[Customer].[Customer Geography].[Postal Code]"). _
      PivotItems( _
      "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
      ActiveSheet.PivotTables("PivotTable1").PivotRowAxis.PivotLines(1)

The following sample code demonstrates a level drill up on a PivotChart

VBA Copy code Copy code
ActiveChart.PivotLayout.PivotTable.DrillUp ActiveChart.PivotLayout.PivotTable. _
      PivotFields("[Customer].[Customer Geography].[Postal Code]").PivotItems( _
      "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
      ActiveChart.PivotLayout.PivotTable.PivotRowAxis.PivotLines(1)

The following sample code demonstrates multi-level drill up on a PivotTable

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").DrillUp ActiveSheet.PivotTables( _
     "PivotTable1").PivotFields("[Customer].[Customer Geography].[City]").PivotItems _
     ("[Customer].[Customer Geography].[City].&[Coffs Harbour]&[NSW]"), ActiveSheet. _
     PivotTables("PivotTable1").PivotRowAxis.PivotLines(1), _
     "[Customer].[Customer Geography].[Country]"

The following sample code demonstrates multi-level drill up on a PivotChart

VBA Copy code Copy code
ActiveChart.PivotLayout.PivotTable.DrillUp ActiveChart.PivotLayout.PivotTable. _
     PivotFields("[Customer].[Customer Geography].[Postal Code]").PivotItems( _
     "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
     ActiveChart.PivotLayout.PivotTable.PivotRowAxis.PivotLines(1) , _
     "[Customer].[Customer Geography].[Country]"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.GetData Method (Excel)

 Copy code hover
[image]

PivotTable.GetData Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value for the a data filed in a PivotTable.

Syntax

expression .GetData(Name)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Describes a single cell in the PivotTable report, using syntax similar to the PivotSelect method or the PivotTable report references in calculated item formulas.

Return Value

Double

Example

This example shows the sum of revenues for apples in January (Data field = Revenue, Product = Apples, Month = January).

VBA Copy code Copy code
Msgbox ActiveSheet.PivotTables(1) _
 .GetData("'Sum of Revenue' Apples January")

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.GetPivotData Method (Excel)

 Copy code hover
[image]

PivotTable.GetPivotData Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object with information about a data item in a PivotTable report.

Syntax

expression .GetPivotData(DataField, Field1, Item1, Field2, Item2, Field3, Item3, Field4, Item4, Field5, Item5, Field6, Item6, Field7, Item7, Field8, Item8, Field9, Item9, Field10, Item10, Field11, Item11, Field12, Item12, Field13, Item13, Field14, Item14)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
DataField | Optional | Variant | The name of the field containing the data for the PivotTable.
Field1 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item1 | Optional | Variant | The name of an item in Field1.
Field2 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item2 | Optional | Variant | The name of an item in Field2.
Field3 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item3 | Optional | Variant | The name of an item in Field3.
Field4 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item4 | Optional | Variant | The name of an item in Field4.
Field5 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item5 | Optional | Variant | The name of an item in Field5.
Field6 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item6 | Optional | Variant | The name of an item in Field6.
Field7 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item7 | Optional | Variant | The name of an item in Field7.
Field8 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item8 | Optional | Variant | The name of an item in Field8.
Field9 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item9 | Optional | Variant | The name of an item in Field9.
Field10 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item10 | Optional | Variant | The name of an item in Field10.
Field11 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item11 | Optional | Variant | The name of an item in Field11.
Field12 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item12 | Optional | Variant | The name of an item in Field12.
Field13 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item13 | Optional | Variant | The name of an item in Field13.
Field14 | Optional | Variant | The name of a column or row field in the PivotTable report.
Item14 | Optional | Variant | The name of an item in Field14.

Return Value

Range

Example

In this example, Microsoft Excel returns the quantity of chairs in the warehouse to the user. This example assumes a PivotTable report exists on the active worksheet. Also, this example assumes that, in the report, the title of the data field is "Quantity", a field titled "Warehouse" exists, and a data item titled "Chairs" exists in the Warehouse field.

VBA Copy code Copy code
Sub UseGetPivotData()

 Dim rngTableItem As Range

 ' Get PivotData for the quantity of chairs in the warehouse.
 Set rngTableItem = ActiveCell. _
 PivotTable.GetPivotData("Quantity", "Warehouse", "Chairs")

 MsgBox "The quantity of chairs in the warehouse is: " & rngTableItem.Value

End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ListFormulas Method (Excel)

 Copy code hover
[image]

PivotTable.ListFormulas Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a list of calculated PivotTable items and fields on a separate worksheet.

Syntax

expression .ListFormulas

expression A variable that represents a PivotTable object.

Remarks

This method isn't available for OLAP data sources.

Example

This example creates a list of calculated items and fields for the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).ListFormulas

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotCache Method (Excel)

 Copy code hover
[image]

PivotTable.PivotCache Method (Excel)
See also Send feedback

Returns a PivotCache object that represents the cache for the specified PivotTable report. Read-only.

Syntax

expression .PivotCache

expression A variable that represents a PivotTable object.

Return Value

PivotCache

Example

This example causes the PivotTable cache for the first PivotTable report on worksheet one to be optimized when it's constructed.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1") _
 .PivotCache.OptimizeCache = True

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotFields Method (Excel)

 Copy code hover
[image]

PivotTable.PivotFields Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable field (a PivotField object) or a collection of both the visible and hidden fields (a PivotFields object) in the PivotTable report. Read-only.

Syntax

expression .PivotFields(Index)

expression An expression that returns a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the field to be returned.

Return Value

Object

Remarks

For OLAP data sources, there are no hidden fields, and the object or collection that's returned reflects what's currently visible.

Example

This example adds the PivotTable report's field names to a list on a new worksheet.

VBA Copy code Copy code
Set nwSheet = Worksheets.Add
nwSheet.Activate
Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable
rw = 0
For Each pvtField In pvtTable.PivotFields
 rw = rw + 1
 nwSheet.Cells(rw, 1).Value = pvtField.Name
Next pvtField

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotSelect Method (Excel)

 Copy code hover
[image]

PivotTable.PivotSelect Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects part of a PivotTable report.

Syntax

expression .PivotSelect(Name, Mode, UseStandardName)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The part of the PivotTable report to select.
Mode | Optional | XlPTSelectionMode | Specifies the structured selection mode.
UseStandardName | Optional | Variant | True for recorded macros that will play back in other locales.

Remarks

You can use the specified mode only to select the corresponding item in the PivotTable report. For example, you cannot select data and labels by using xlButton mode; likewise, you cannot select buttons by using xlDataOnly mode.

Example

This example selects all date labels in the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables(1).PivotSelect "date[All]", xlLabelOnly

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotTableWizard Method (Excel)

 Copy code hover
[image]

PivotTable.PivotTableWizard Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates and returns a PivotTable object. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.

Syntax

expression .PivotTableWizard(SourceType, SourceData, TableDestination, TableName, RowGrand, ColumnGrand, SaveData, HasAutoFormat, AutoPage, Reserved, BackgroundQuery, OptimizeCache, PageFieldOrder, PageFieldWrapCount, ReadData, Connection)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
SourceType | Optional | Variant | An XlPivotTableSourceType value that represents the source of the report data. If you specify this argument, you must also specify SourceData. If SourceType and SourceData are omitted, Microsoft Excel assumes that the source type is xlDatabase, and the source data comes from the named range "Database." If this named range doesn't exist, Microsoft Excel uses the current region if the current selection is in a range of more than 10 cells that contain data. If this isn't true, this method will fail.
SourceData | Optional | Variant | The data for the new report. Can be a Range object, an array of ranges, or a text constant that represents the name of another report. For an external database, SourceData is an array of strings containing the SQL query string, where each element is up to 255 characters in length. You should use the Connection argument to specify the ODBC connection string. For compatibility with earlier versions of Excel, SourceData can be a two-element array. The first element is the connection string specifying the ODBC source for the data. The second element is the SQL query string used to get the data. If you specify SourceData, you must also specify SourceType. If the active cell is inside the SourceData range, you must specify TableDestination as well.
TableDestination | Optional | Variant | A Range object specifying where the report should be placed on the worksheet. If this argument is omitted, the report is placed at the active cell.
TableName | Optional | Variant | A string that specifies the name of the new report.
RowGrand | Optional | Variant | True to show grand totals for rows in the report.
ColumnGrand | Optional | Variant | True to show grand totals for columns in the report.
SaveData | Optional | Variant | True to save data with the report. False to save only the report definition.
HasAutoFormat | Optional | Variant | True to have Microsoft Excel automatically format the report when it's refreshed or when fields are moved.
AutoPage | Optional | Variant | Valid only if SourceType is xlConsolidation. True to have Microsoft Excel create a page field for the consolidation. If AutoPage is False, you must create the page field or fields.
Reserved | Optional | Variant | Not used by Microsoft Excel.
BackgroundQuery | Optional | Variant | True to have Excel perform queries for the report asynchronously (in the background). The default value is False.
OptimizeCache | Optional | Variant | True to optimize the PivotTable cache when it's constructed. The default value is False.
PageFieldOrder | Optional | Variant | The order in which page fields are added to the PivotTable report's layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default value is xlDownThenOver.
PageFieldWrapCount | Optional | Variant | The number of page fields in each column or row in the PivotTable report. The default value is 0 (zero).
ReadData | Optional | Variant | True to create a PivotTable cache that contains all records from the external database; this cache can be very large. If ReadData is False, you can set some of the fields asserver-based page fields before the data is actually read.
Connection | Optional | Variant | A string that contains ODBC settings that allow Excel to connect to an ODBC data source. The connection string has the form "ODBC;<connection string>". This argument overrides any previous setting for the PivotCache object's Connection property.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.PivotValueCell Method (Excel)

 Copy code hover
[image]

PivotTable.PivotValueCell Method (Excel)
See also Send feedback

Published: July 16, 2012

Retrieve the PivotValueCell Object (Excel) object for a given PivotTable provided certain row and column indices.

Version information

Version Added: Excel 2013

Syntax

expression .PivotValueCell(rowline,columnline)

expression A variable that represents a PivotTable Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
rowline | Optional | VARIANT | If of type PivotLine, specifies the PivotLine in the row area that the PivotValueCell is aligned with. If of type Int, then specifies position of the PivotLine on the row area that the PivotValueCell is aligned with. If missing, Empty, Null, or 0 specifies the grand total row.
columnline | Optional | VARIANT | If of type PivotLine, specifies the PivotLine in the column area that the PivotValueCell is aligned with. If of type Int, then specifies position of the PivotLine on the column area that the PivotValueCell is aligned with. If missing, Empty, Null or 0, specifies the grand total column.

Return value

PIVOTVALUECELL

Example

This code sample uses the PivotValueCell property to test whether the value of one cell in a PivotTable is greater than the value of another cell.

VBA Copy code Copy code
Sub TestEquality()
Dim X As Double
Dim Y As Double

'This code assumes you have a Standalone PivotChart on one of the worksheets
X = ThisWorkbook.PivotTables(1).PivotValueCell(1, 1).Value
Y = ThisWorkbook.PivotTables(1).PivotValueCell(1, 2).Value

If X > Y Then
MsgBox "X is greater than Y"
Else
MsgBox "Y is greater than X"
End If
End Sub

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RefreshDataSourceValues Method (Excel)

 Copy code hover
[image]

PivotTable.RefreshDataSourceValues Method (Excel)
See also Send feedback

Published: July 16, 2012

Retrieves the current values from the data source for all edited cells in a PivotTable report that is in writeback mode.

Version Information

Version Added: Excel 2010

Syntax

expression .RefreshDataSourceValues

expression A variable that represents a PivotTable object.

Return Value

Nothing

Remarks

To determine if a PivotTable report is in writeback mode, check the EnableWriteback or EnableDataValueEditing properties of the PivotTable object, either of which will return True. For PivotTable reports that are not in writeback mode, trying to execute this method generates a run-time error.

For PivotTable reports with OLAP data sources, executing the RefreshDataSourceValues method creates a separate connection to the OLAP server and executes the full MDX query (the value of the PivotTable.MDX property) that is used to perform an update operation to populate the PivotTable report. Excel extracts the values returned for all cells that have been edited in the PivotTable view, and then stores them in the DataSourceValue property for those cells.

This method applies only to PivotTable reports with OLAP data sources. Trying to execute this method or PivotTable reports with non-OLAP data sources generates a run-time error.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RefreshTable Method (Excel)

 Copy code hover
[image]

PivotTable.RefreshTable Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes the PivotTable report from the source data. Returns True if it's successful.

Syntax

expression .RefreshTable

expression A variable that represents a PivotTable object.

Return Value

Boolean

Example

This example refreshes the PivotTable report.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.RefreshTable

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RepeatAllLabels Method (Excel)

 Copy code hover
[image]

PivotTable.RepeatAllLabels Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether to repeat item labels for all PivotFields in the specified PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .RepeatAllLabels(Repeat)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Repeat | Required | XlPivotFieldRepeatLabels |

Return Value

Nothing

Remarks

Using the RepeatAllLabels method corresponds to the Repeat All Item Labels and Do Not Repeat Item Labels commands on the Report Layout drop-down list of the PivotTable Tools Design tab.

To specify whether to repeat item labels for a single PivotField, use the RepeatLabels property.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.RowAxisLayout Method (Excel)

 Copy code hover
[image]

PivotTable.RowAxisLayout Method (Excel)
See also Send feedback

Published: July 16, 2012

This method is used for simultaneously setting layout options for all existing PivotFields.

Version Information

Version Added: Excel 2007

Syntax

expression .RowAxisLayout(RowLayout)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
RowLayout | Required | XlLayoutRowType | Can be xlCompactRow, xlTabularRow, or xlOutlineRow.

Remarks

This method is atomic so it makes sure that if layout options cannot be set on any PivotField, the layout options of none of the fields will change and no change is made to the PivotTable.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.ShowPages Method (Excel)

 Copy code hover
[image]

PivotTable.ShowPages Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new PivotTable report for each item in the page field. Each new report is created on a new worksheet.

Syntax

expression .ShowPages(PageField)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
PageField | Optional | Variant | A string that names a single page field in the report.

Return Value

Variant

Remarks

This method isn't available for OLAP data sources.

Example

This example creates a new PivotTable report for each item in the page field, which is the field named "Country."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.ShowPages "Country"

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.SubtotalLocation Method (Excel)

 Copy code hover
[image]

PivotTable.SubtotalLocation Method (Excel)
See also Send feedback

Published: July 16, 2012

This method changes the subtotal location for all existing PivotFields. Changing the subtotal location has an immediate visual effect only for fields in outline form, but it will be set for fields in tabular form as well.

Version Information

Version Added: Excel 2007

Syntax

expression .SubtotalLocation(Location)

expression A variable that represents a PivotTable object.

Parameters

Name | Required/Optional | Data Type | Description
Location | Required | XlSubtototalLocationType | xlSubtotalLocationType can be either xlAtTop or xlAtBottom.

Remarks

The SubtotalLocation method sets the LayoutSubtotalLocation property for all existing PivotFields automatically.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTable.Update Method (Excel)

 Copy code hover
[image]

PivotTable.Update Method (Excel)
See also Send feedback

Updates the PivotTable report.

Syntax

expression .Update

expression A variable that represents a PivotTable object.

See also

Concepts

PivotTable Object

Other resources

PivotTable Object Members


PivotTableChangeList Object (Excel)

 Copy code hover
[image]

PivotTableChangeList Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the list of changes a user has made to value cells in a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Remarks

The PivotTableChangeList collection contains ValueChange objects that represent the changes a user has made to value cells in a PivotTable report. To return the PivotTableChangeList collection for a PivotTable, use the ChangeList property of the PivotTable object.

See also

Concepts

Excel Object Model Reference

Other resources

PivotTableChangeList Object Members


PivotTableChangeList Members (Excel)

 Copy code hover
[image]

PivotTableChangeList Members (Excel)
Send feedback

Published: July 16, 2012

Represents the list of changes a user has made to value cells in a PivotTable report based on an OLAP data source.

Methods

Name | Description
Add | Adds a ValueChange object to the specified PivotTableChangeList collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single ValueChange object from the specified PivotTableChangeList collection.
Parent | Returns the parent PivotTable object for the specified PivotTableChangeList collection. Read-only.


PivotTableChangeList Properties (Excel)

 Copy code hover
[image]

PivotTableChangeList Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single ValueChange object from the specified PivotTableChangeList collection.
Parent | Returns the parent PivotTable object for the specified PivotTableChangeList collection. Read-only.


PivotTableChangeList.Application Property (Excel)

 Copy code hover
[image]

PivotTableChangeList.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a PivotTableChangeList object.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTableChangeList.Count Property (Excel)

 Copy code hover
[image]

PivotTableChangeList.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a PivotTableChangeList object.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTableChangeList.Creator Property (Excel)

 Copy code hover
[image]

PivotTableChangeList.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotTableChangeList object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTableChangeList.Item Property (Excel)

 Copy code hover
[image]

PivotTableChangeList.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single ValueChange object from the specified PivotTableChangeList collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that returns a PivotTableChangeList object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The MDX name (tuple) or index number of the object.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTableChangeList.Parent Property (Excel)

 Copy code hover
[image]

PivotTableChangeList.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent PivotTable object for the specified PivotTableChangeList collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a PivotTableChangeList object.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTableChangeList Methods (Excel)

 Copy code hover
[image]

PivotTableChangeList Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a ValueChange object to the specified PivotTableChangeList collection.


PivotTableChangeList.Add Method (Excel)

 Copy code hover
[image]

PivotTableChangeList.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a ValueChange object to the specified PivotTableChangeList collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Add(Tuple, Value, AllocationValue, AllocationMethod, AllocationWeightExpression)

expression A variable that represents a PivotTableChangeList object.

Parameters

Name | Required/Optional | Data Type | Description
Tuple | Required | String | The MDX tuple of the value to change in the OLAP data source.
Value | Required | Double | The value to commit.
AllocationValue | Optional | Variant | The value to allocate when performing what-if analysis. If this parameter is not supplied, the default allocation value of the OLAP server will be used.
AllocationMethod | Optional | Variant | The method to use to allocate this value when performing what-if analysis. If this parameter is not supplied, the default allocation method of the OLAP server will be used.
AllocationWeightExpression | Optional | Variant | The MDX weight expression to use for this value when performing what-if analysis. If this parameter is not supplied, the default allocation weight expression of the OLAP server will be used.

Return Value

ValueChange

Remarks

The Add method enables you to add ValueChange objects that represent changes to the PivotTable report through code. Doing so will add to the UPDATE CUBE statement that Excel constructs based on this change list. Note that if the user changes the allocation settings so that not all changes have the same settings, Excel will run multiple UPDATE CUBE statements, one for each group of changes that were made while the same settings were applied.

See also

Concepts

PivotTableChangeList Object

Other resources

PivotTableChangeList Object Members


PivotTables Object (Excel)

 Copy code hover
[image]

PivotTables Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the PivotTable objects in the specified workbook.

Remarks

Note Note

The Workbook.PivotTables property (which is new for Microsoft Office 2013) does not return all the PivotTable objects in the workbook; instead it returns only those associated with decoupled PivotCharts. However, Worksheet.PivotTables returns all the PivotTable objects in the worksheet, irrespective of whether they are associated with decoupled PivotCharts.

Because PivotTable report programming can be complex, it's generally easiest to record PivotTable report actions and then revise the recorded code.

Example

Use the PivotTables method to return the PivotTables collection. The following example displays the number of PivotTable reports on Sheet3.

VBA Copy code Copy code
MsgBox Worksheets("sheet3").PivotTables.Count

Use the PivotTableWizard method to create a new PivotTable report and add it to the collection. The following example creates a new PivotTable report from a Microsoft Excel database (contained in the range A1:C100).

VBA Copy code Copy code
ActiveSheet.PivotTableWizard xlDatabase, Range("A1:C100")

Use PivotTables(index), where index is the PivotTable index number or name, to return a single PivotTable object. The following example makes the Year field a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables(1) _
 .PivotFields("year").Orientation = xlRowField

See also

Concepts

Excel Object Model Reference

Other resources

PivotTables Object Members


PivotTables Members (Excel)

 Copy code hover
[image]

PivotTables Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the PivotTable objects in the specified workbook.

Methods

Name | Description
Add | Adds a new PivotTable report. Returns a PivotTable object.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotTables Properties (Excel)

 Copy code hover
[image]

PivotTables Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


PivotTables.Application Property (Excel)

 Copy code hover
[image]

PivotTables.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PivotTables object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotTables.Count Property (Excel)

 Copy code hover
[image]

PivotTables.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PivotTables object.

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotTables.Creator Property (Excel)

 Copy code hover
[image]

PivotTables.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PivotTables object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotTables.Parent Property (Excel)

 Copy code hover
[image]

PivotTables.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PivotTables object.

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotTables Methods (Excel)

 Copy code hover
[image]

PivotTables Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new PivotTable report. Returns a PivotTable object.
Item | Returns a single object from a collection.


PivotTables.Add Method (Excel)

 Copy code hover
[image]

PivotTables.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new PivotTable report. Returns a PivotTable object.

Syntax

expression .Add(PivotCache, TableDestination, TableName, ReadData, DefaultVersion)

expression A variable that represents a PivotTables object.

Parameters

Name | Required/Optional | Data Type | Description
PivotCache | Required | PivotCache | The PivotTable cache on which the new PivotTable report is based. The cache provides data for the report.
TableDestination | Required | Variant | The cell in the upper-left corner of the PivotTable report's destination range (the range on the worksheet where the resulting report will be placed). You must specify a destination range on the worksheet that contains the PivotTables object specified by expression.
TableName | Optional | Variant | The name of the new PivotTable report.
ReadData | Optional | Variant | True to create a PivotTable cache that contains all records from the external database; this cache can be very large. False to enable setting some of the fields as server-based page fields before the data is actually read.
DefaultVersion | Optional | Variant | The version of Microsoft Excel the PivotTable was originally created in.

Return Value

A PivotTable object that represents the new PivotTable report.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A1 on the first worksheet.

VBA Copy code Copy code
Dim cnnConn As ADODB.Connection
Dim rstRecordset As ADODB.Recordset
Dim cmdCommand As ADODB.Command

' Open the connection.
Set cnnConn = New ADODB.Connection
With cnnConn
 .ConnectionString = _
 "Provider=Microsoft.Jet.OLEDB.4.0"
 .Open "C:\perfdate\record.mdb"
End With

' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnnConn
With cmdCommand
 .CommandText = "Select Speed, Pressure, Time From DynoRun"
 .CommandType = adCmdText
 .Execute
End With

' Open the recordset.
Set rstRecordset = New ADODB.Recordset
Set rstRecordset.ActiveConnection = cnnConn
rstRecordset.Open cmdCommand

' Create PivotTable cache and report.
Set objPivotCache = ActiveWorkbook.PivotCaches.Add( _
 SourceType:=xlExternal)
Set objPivotCache.Recordset = rstRecordset

ActiveSheet.PivotTables.Add _
 PivotCache:=objPivotCache, _
 TableDestination:=Range("A3"), _
 TableName:="Performance"

With ActiveSheet.PivotTables("Performance")
 .SmallGrid = False
 With .PivotFields("Pressure")
 .Orientation = xlRowField
 .Position = 1
 End With
 With .PivotFields("Speed")
 .Orientation = xlColumnField
 .Position = 1
 End With
 With .PivotFields("Time")
 .Orientation = xlDataField
 .Position = 1
 End With
End With

' Close the connections and clean up.
cnnConn.Close
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
Set cnnConn = Nothing

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotTables.Item Method (Excel)

 Copy code hover
[image]

PivotTables.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PivotTables object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A PivotTable object contained by the collection.

Remarks

The text name of the object is the value of the Name and Value properties.

Example

This example makes the Year field a row field in the first PivotTable report on Sheet3.

VBA Copy code Copy code
Worksheets("sheet3").PivotTables.Item(1) _
 .PivotFields("year").Orientation = xlRowField

See also

Concepts

PivotTables Object

Other resources

PivotTables Object Members


PivotValueCell Object (Excel)

 Copy code hover
[image]

PivotValueCell Object (Excel)
See also Send feedback

Published: July 16, 2012

Provides a way to expose values of cells in the case that actual cells (Range objects) are not available.

Version information

Version Added: Excel 2013

Example

This code sample uses the PivotValueCell property to test whether the value of one cell in a PivotTable is greater than another cell.

VBA Copy code Copy code
Sub TestEquality()
Dim X As Double
Dim Y As Double

'This code assumes that you have a Standalone PivotChart on one of the worksheets.
X = ThisWorkbook.PivotTables(1).PivotValueCell(1, 1).Value
Y = ThisWorkbook.PivotTables(1).PivotValueCell(1, 2).Value

If X > Y Then
MsgBox "X is greater than Y"
Else
MsgBox "Y is greater than X"
End If
End Sub

See also

Other resources

PivotValueCell Object Members


PivotValueCell Members (Excel)

 Copy code hover
[image]

PivotValueCell Members (Excel)
Send feedback

Published: July 16, 2012

Provides a way to expose values of cells in the case that actual cells (Range objects) are not available.

Methods

Name | Description
ShowDetail | Puts the individual rows of an OLAP data source which contribute to an aggregate onto their own Excel worksheet.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified PivotValueCell Object (Excel) object. Read-only.
PivotCell | Returns the PivotCell Object (Excel) that specifies the location of the PivotValueCell. Read-only
ServerActions | Returns a collection of OLAP Action name objects which will represent OLAP-defined actions which can be executed. Read-only
Value | Returns the value at the location. The value is the value after ShowAs and other calculations have been applied. Variant can be Empty, Number, Date, String, or Error value.


PivotValueCell Properties (Excel)

 Copy code hover
[image]

PivotValueCell Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified PivotValueCell Object (Excel) object. Read-only.
PivotCell | Returns the PivotCell Object (Excel) that specifies the location of the PivotValueCell. Read-only
ServerActions | Returns a collection of OLAP Action name objects which will represent OLAP-defined actions which can be executed. Read-only
Value | Returns the value at the location. The value is the value after ShowAs and other calculations have been applied. Variant can be Empty, Number, Date, String, or Error value.


PivotValueCell.Application Property (Excel)

 Copy code hover
[image]

PivotValueCell.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a PivotValueCell Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell.Creator Property (Excel)

 Copy code hover
[image]

PivotValueCell.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a PivotValueCell Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Example

The following code uses the Creator property to check whether the specified object is an Excel object.

VBA Copy code Copy code
Sub FindCreator()
 Dim myObject As Excel.Workbook
 Set myObject = ActiveWorkbook
 If myObject.Creator = &h5843454c Then
 MsgBox "This is a Microsoft Excel object."
 Else
 MsgBox "This is not a Microsoft Excel object."
 End If
End Sub

Property value

XLCREATOR

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell.Parent Property (Excel)

 Copy code hover
[image]

PivotValueCell.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified PivotValueCell Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a PivotValueCell Object (Excel) object.

Property value

OBJECT

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell.PivotCell Property (Excel)

 Copy code hover
[image]

PivotValueCell.PivotCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PivotCell Object (Excel) that specifies the location of the PivotValueCell. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .PivotCell

expression A variable that represents a PivotValueCell Object (Excel) object.

Example

The following code sample uses the PivotCell property to get the Multi-dimensional Expressions (MDX) expression for the specified cell.

VBA Copy code Copy code
Sub GetMDX()
   'Get the MDX query for a particular PivotCell in a workbook level PivotTable
   MsgBox "The MDX for the PivotCell 1, 1: " & _
   ThisWorkbook.PivotTables(1).PivotValueCell(1, 1).PivotCell.MDX
End Sub

Property value

PIVOTCELL

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell.ServerActions Property (Excel)

 Copy code hover
[image]

PivotValueCell.ServerActions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a collection of OLAP Action name objects which will represent OLAP-defined actions which can be executed. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ServerActions

expression A variable that represents a PivotValueCell Object (Excel) object.

Remarks

A server action is an optional feature that an OLAP cube administrator can define on a server that uses a cube member or measure as a parameter into a query to obtain details in the cube, or to start another application,

Property value

ACTIONS

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell.Value Property (Excel)

 Copy code hover
[image]

PivotValueCell.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value at the location. The value is the value after ShowAs and other calculations have been applied. Variant can be Empty, Number, Date, String, or Error value.

Version information

Version Added: Excel 2013

Syntax

expression .Value

expression A variable that represents a PivotValueCell object.

Remarks

This property works independent of whether the PivotTable is on a Worksheet or not.

Example

This code sample uses the PivotValueCell property to test whether the value of one cell in a PivotTable is greater than another cell.

VBA Copy code Copy code
Sub TestEquality()
Dim X As Double
Dim Y As Double

'This code assumes you have a Standalone PivotChart on one of the worksheets
X = ThisWorkbook.PivotTables(1).PivotValueCell(1, 1).Value
Y = ThisWorkbook.PivotTables(1).PivotValueCell(1, 2).Value

If X > Y Then
MsgBox "X is greater than Y"
Else
MsgBox "Y is greater than X"
End If
End Sub

Property value

VARIANT

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PivotValueCell Methods (Excel)

 Copy code hover
[image]

PivotValueCell Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ShowDetail | Puts the individual rows of an OLAP data source which contribute to an aggregate onto their own Excel worksheet.


PivotValueCell.ShowDetail Method (Excel)

 Copy code hover
[image]

PivotValueCell.ShowDetail Method (Excel)
See also Send feedback

Published: July 16, 2012

Puts the individual rows of an OLAP data source which contribute to an aggregate onto their own Excel worksheet.

Version information

Version Added: Excel 2013

Syntax

expression .ShowDetail

expression A variable that represents a PivotValueCell object.

Return value

VOID

See also

Other resources

PivotValueCell Object Members
PivotValueCell Object


PlotArea Object (Excel)

 Copy code hover
[image]

PlotArea Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the plot area of a chart.

Remarks

This is the area where your chart data is plotted. The plot area on a 2-D chart contains the data markers, gridlines, data labels, trendlines, and optional chart items placed in the chart area. The plot area on a 3-D chart contains all the above items plus the walls, floor, axes, axis titles, and tick-mark labels in the chart.

The plot area is surrounded by the chart area. The chart area on a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area on a 3-D chart contains the chart title and the legend. For information about formatting the chart area, see the ChartArea object.

Example

Use the PlotArea property to return a PlotArea object. The following example activates the chart sheet named "Chart1," places a dashed border around the chart area of the active chart, and places a dotted border around the plot area.

VBA Copy code Copy code
Charts("Chart1").Activate
With ActiveChart
 .ChartArea.Border.LineStyle = xlDash
 .PlotArea.Border.LineStyle = xlDot
End With

See also

Concepts

Excel Object Model Reference

Other resources

PlotArea Object Members


PlotArea Members (Excel)

 Copy code hover
[image]

PlotArea Members (Excel)
Send feedback

Published: July 16, 2012

Represents the plot area of a chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
InsideHeight | Returns the inside height of the plot area, in points. Read-write Double.
InsideLeft | Returns the distance from the chart edge to the inside left edge of the plot area, in points. Read-write Double.
InsideTop | Returns the distance from the chart edge to the inside top edge of the plot area, in points. Read-write Double.
InsideWidth | Returns the inside width of the plot area, in points. Read-write Double.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


PlotArea Properties (Excel)

 Copy code hover
[image]

PlotArea Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Height | Returns or sets a Double value that represents the height, in points, of the object.
InsideHeight | Returns the inside height of the plot area, in points. Read-write Double.
InsideLeft | Returns the distance from the chart edge to the inside left edge of the plot area, in points. Read-write Double.
InsideTop | Returns the distance from the chart edge to the inside top edge of the plot area, in points. Read-write Double.
InsideWidth | Returns the inside width of the plot area, in points. Read-write Double.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Position | Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width | Returns or sets a Double value that represents the width, in points, of the object.


PlotArea.Application Property (Excel)

 Copy code hover
[image]

PlotArea.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PlotArea object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Creator Property (Excel)

 Copy code hover
[image]

PlotArea.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PlotArea object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Format Property (Excel)

 Copy code hover
[image]

PlotArea.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Height Property (Excel)

 Copy code hover
[image]

PlotArea.Height Property (Excel)
See also Send feedback

Returns or sets a Double value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideHeight Property (Excel)

 Copy code hover
[image]

PlotArea.InsideHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inside height of the plot area, in points. Read-write Double.

Syntax

expression .InsideHeight

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Height property for the plot area uses the bounding rectangle that includes the axis labels.

Example

This example draws a dotted rectangle around the inside of the plot area in Chart1.

VBA Copy code Copy code
With Charts("chart1")
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideLeft Property (Excel)

 Copy code hover
[image]

PlotArea.InsideLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the distance from the chart edge to the inside left edge of the plot area, in points. Read-write Double.

Syntax

expression .InsideLeft

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Left property for the plot area uses the bounding rectangle that includes the axis labels.

Example

This example draws a dotted rectangle around the inside of the plot area in Chart1.

VBA Copy code Copy code
With Charts("chart1")
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideTop Property (Excel)

 Copy code hover
[image]

PlotArea.InsideTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the distance from the chart edge to the inside top edge of the plot area, in points. Read-write Double.

Syntax

expression .InsideTop

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Top property for the plot area uses the bounding rectangle that includes the axis labels.

Example

This example draws a dotted rectangle around the inside of the plot area in Chart1.

VBA Copy code Copy code
With Charts("chart1")
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideWidth Property (Excel)

 Copy code hover
[image]

PlotArea.InsideWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inside width of the plot area, in points. Read-write Double.

Syntax

expression .InsideWidth

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Width property for the plot area uses the bounding rectangle that includes the axis labels.

Example

This example draws a dotted rectangle around the inside of the plot area in Chart1.

VBA Copy code Copy code
With Charts("chart1")
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Left Property (Excel)

 Copy code hover
[image]

PlotArea.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Name Property (Excel)

 Copy code hover
[image]

PlotArea.Name Property (Excel)
See also Send feedback

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Parent Property (Excel)

 Copy code hover
[image]

PlotArea.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Position Property (Excel)

 Copy code hover
[image]

PlotArea.Position Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Excel 2007

Syntax

expression .Position

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Top Property (Excel)

 Copy code hover
[image]

PlotArea.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Syntax

expression .Top

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Width Property (Excel)

 Copy code hover
[image]

PlotArea.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea Methods (Excel)

 Copy code hover
[image]

PlotArea Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Select | Selects the object.


PlotArea.ClearFormats Method (Excel)

 Copy code hover
[image]

PlotArea.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a PlotArea object.

Return Value

Variant

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Select Method (Excel)

 Copy code hover
[image]

PlotArea.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a PlotArea object.

Return Value

Variant

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


Point Object (Excel)

 Copy code hover
[image]

Point Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single point in a series in a chart.

Remarks

The Point object is a member of the Points collection. The Points collection contains all the points in one series.

Example

Use Points(index), where index is the point index number, to return a single Point object. Points are numbered from left to right on the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Points(3).MarkerStyle = xlDiamond

See also

Concepts

Excel Object Model Reference

Other resources

Point Object Members


Point Members (Excel)

 Copy code hover
[image]

Point Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single point in a series in a chart.

Methods

Name | Description
ApplyDataLabels | Applies data labels to a point.
ClearFormats | Clears the formatting of the object.
Copy | If the point has a picture fill, then this method copies the picture to the Clipboard.
Delete | Deletes the series the point belongs to.
Paste | Pastes a picture from the Clipboard as the marker on the selected point.
PieSliceLocation | Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataLabel | Returns a DataLabel object that represents the data label associated with the point. Read-only.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Has3DEffect | True if a point has a three-dimensional appearance. Read/write Boolean.
HasDataLabel | True if the point has a data label. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only.
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
Left | Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns the object name. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
SecondaryPlot | True if the point is in the secondary section of either a pie of pie chart or a bar of pie chart. Applies only to points on pie of pie charts or bar of pie charts. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.
Width | Returns the width, in points, of the object. Read-only.


Point Properties (Excel)

 Copy code hover
[image]

Point Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataLabel | Returns a DataLabel object that represents the data label associated with the point. Read-only.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Has3DEffect | True if a point has a three-dimensional appearance. Read/write Boolean.
HasDataLabel | True if the point has a data label. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only.
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
Left | Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns the object name. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
SecondaryPlot | True if the point is in the secondary section of either a pie of pie chart or a bar of pie chart. Applies only to points on pie of pie charts or bar of pie charts. Read/write Boolean.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Top | Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.
Width | Returns the width, in points, of the object. Read-only.


Point.Application Property (Excel)

 Copy code hover
[image]

Point.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Point object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToEnd Property (Excel)

 Copy code hover
[image]

Point.ApplyPictToEnd Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToEnd

expression A variable that represents a Point object.

Example

This example applies pictures to the end of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToEnd = True

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToFront Property (Excel)

 Copy code hover
[image]

Point.ApplyPictToFront Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToFront

expression A variable that represents a Point object.

Example

This example applies pictures to the front of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToFront = True

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToSides Property (Excel)

 Copy code hover
[image]

Point.ApplyPictToSides Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToSides

expression A variable that represents a Point object.

Example

This example applies pictures to the sides of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToSides = True

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Creator Property (Excel)

 Copy code hover
[image]

Point.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Point object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.DataLabel Property (Excel)

 Copy code hover
[image]

Point.DataLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DataLabel object that represents the data label associated with the point. Read-only.

Syntax

expression .DataLabel

expression A variable that represents a Point object.

Example

This example turns on the data label for point seven in series three in Chart1, and then it sets the data label color to blue.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels type:=xlValue
 .DataLabel.Font.ColorIndex = 5
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Explosion Property (Excel)

 Copy code hover
[image]

Point.Explosion Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.

Syntax

expression .Explosion

expression A variable that represents a Point object.

Example

This example sets the explosion value for point two in Chart1. The example should be run on a pie chart.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Points(2).Explosion = 20

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Format Property (Excel)

 Copy code hover
[image]

Point.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Has3DEffect Property (Excel)

 Copy code hover
[image]

Point.Has3DEffect Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a point has a three-dimensional appearance. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Has3DEffect

expression A variable that represents a Point object.

Remarks

This property applies to bubble charts only.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.HasDataLabel Property (Excel)

 Copy code hover
[image]

Point.HasDataLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the point has a data label. Read/write Boolean.

Syntax

expression .HasDataLabel

expression A variable that represents a Point object.

Example

This example turns on the data label for point seven in series three in Chart1, and then it sets the data label color to blue.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels Type:=xlValue
 .DataLabel.Font.ColorIndex = 5
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Height Property (Excel)

 Copy code hover
[image]

Point.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.InvertIfNegative Property (Excel)

 Copy code hover
[image]

Point.InvertIfNegative Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.

Syntax

expression .InvertIfNegative

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Left Property (Excel)

 Copy code hover
[image]

Point.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Left

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerBackgroundColor Property (Excel)

 Copy code hover
[image]

Point.MarkerBackgroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a Point object.

Example

This example sets the marker background and foreground colors for the second point in series one in Chart1.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Points(2)
 .MarkerBackgroundColor = RGB(0,255,0) ' green
 .MarkerForegroundColor = RGB(255,0,0) ' red
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerBackgroundColorIndex Property (Excel)

 Copy code hover
[image]

Point.MarkerBackgroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a Point object.

Example

This example sets the marker background and foreground colors for the second point in series one in Chart1.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Points(2)
    .MarkerBackgroundColorIndex = 4    'green
    .MarkerForegroundColorIndex = 3    'red
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerForegroundColor Property (Excel)

 Copy code hover
[image]

Point.MarkerForegroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColor

expression A variable that represents a Point object.

Example

This example sets the marker background and foreground colors for the second point in series one in Chart1.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Points(2)
 .MarkerBackgroundColor = RGB(0,255,0) ' green
 .MarkerForegroundColor = RGB(255,0,0) ' red
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerForegroundColorIndex Property (Excel)

 Copy code hover
[image]

Point.MarkerForegroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a Point object.

Example

This example sets the marker background and foreground colors for the second point in series one in Chart1.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Points(2)
 .MarkerBackgroundColorIndex = 4 'green
 .MarkerForegroundColorIndex = 3 'red
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerSize Property (Excel)

 Copy code hover
[image]

Point.MarkerSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.

Syntax

expression .MarkerSize

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerStyle Property (Excel)

 Copy code hover
[image]

Point.MarkerStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Syntax

expression .MarkerStyle

expression A variable that represents a Point object.

Remarks

XlMarkerStyle can be one of these XlMarkerStyle constants.

xlMarkerStyleAutomatic. Automatic markers

xlMarkerStyleCircle. Circular markers

xlMarkerStyleDash. Long bar markers

xlMarkerStyleDiamond. Diamond-shaped markers

xlMarkerStyleDot. Short bar markers

xlMarkerStyleNone. No markers

xlMarkerStylePicture. Picture markers

xlMarkerStylePlus. Square markers with a plus sign

xlMarkerStyleSquare. Square markers

xlMarkerStyleStar. Square markers with an asterisk

xlMarkerStyleTriangle. Triangular markers

xlMarkerStyleX. Square markers with an X

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Name Property (Excel)

 Copy code hover
[image]

Point.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the object name. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Name

expression A variable that represents a Point object.

Return Value

String

Remarks

This property corresponds to the name of a data point on a chart. The name is represented using the following format: S<series number>P<point number>.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Parent Property (Excel)

 Copy code hover
[image]

Point.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PictureType Property (Excel)

 Copy code hover
[image]

Point.PictureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.

Syntax

expression .PictureType

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PictureUnit2 Property (Excel)

 Copy code hover
[image]

Point.PictureUnit2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .PictureUnit2

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.SecondaryPlot Property (Excel)

 Copy code hover
[image]

Point.SecondaryPlot Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the point is in the secondary section of either a pie of pie chart or a bar of pie chart. Applies only to points on pie of pie charts or bar of pie charts. Read/write Boolean.

Syntax

expression .SecondaryPlot

expression A variable that represents a Point object.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example moves point four to the secondary section of the chart.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.SeriesCollection(1)
 .Points(4).SecondaryPlot = True
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Shadow Property (Excel)

 Copy code hover
[image]

Point.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Top Property (Excel)

 Copy code hover
[image]

Point.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Top

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Width Property (Excel)

 Copy code hover
[image]

Point.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point Methods (Excel)

 Copy code hover
[image]

Point Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyDataLabels | Applies data labels to a point.
ClearFormats | Clears the formatting of the object.
Copy | If the point has a picture fill, then this method copies the picture to the Clipboard.
Delete | Deletes the series the point belongs to.
Paste | Pastes a picture from the Clipboard as the marker on the selected point.
PieSliceLocation | Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.
Select | Selects the object.


Point.ApplyDataLabels Method (Excel)

 Copy code hover
[image]

Point.ApplyDataLabels Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies data labels to a point.

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Point object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | The type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default value is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | Pass a boolean value to enable or disable the series name for the data label.
ShowCategoryName | Optional | Variant | Pass a boolean value to enable or disable the category name for the data label.
ShowValue | Optional | Variant | Pass a boolean value to enable or disable the value for the data label.
ShowPercentage | Optional | Variant | Pass a boolean value to enable or disable the percentage for the data label.
ShowBubbleSize | Optional | Variant | Pass a boolean value to enable or disable the bubble size for the data label.
Separator | Optional | Variant | The separator for the data label.

Remarks

XlDataLabelsType can be one of these XlDataLabelsType constants.

xlDataLabelsShowBubbleSizes. The bubble size for the data label.

xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.

xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowLabel. Category for the point.

xlDataLabelsShowNone. No data labels.

xlDataLabelsShowValue. default. Value for the point (assumed if this argument isn't specified).

Example

This example applies category labels to series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ClearFormats Method (Excel)

 Copy code hover
[image]

Point.ClearFormats Method (Excel)
See also Send feedback

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Point object.

Return Value

Variant

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Copy Method (Excel)

 Copy code hover
[image]

Point.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

If the point has a picture fill, then this method copies the picture to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a Point object.

Return Value

Variant

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Delete Method (Excel)

 Copy code hover
[image]

Point.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the series the point belongs to.

Syntax

expression .Delete

expression A variable that represents a Point object.

Return Value

Variant

Remarks

Deleting a Point object deletes the entire series.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Paste Method (Excel)

 Copy code hover
[image]

Point.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard as the marker on the selected point.

Syntax

expression .Paste

expression A variable that represents a Point object.

Return Value

Variant

Remarks

This method can be used on column, bar, line, or radar charts, and it sets the MarkerStyle property to xlMarkerStylePicture.

Example

This example pastes a picture from the Clipboard into series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Paste

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PieSliceLocation Method (Excel)

 Copy code hover
[image]

Point.PieSliceLocation Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.

Version Information

Version Added: Excel 2010

Syntax

expression .PieSliceLocation(loc, Index)

expression A variable that represents a Point object.

Parameters

Name | Required/Optional | Data Type | Description
loc | Required | XlPieSliceLocation | Specifies a horizontal or vertical coordinate.
Index | Optional | XlPieSliceIndex | Specifies which pie slice position coordinate to return. The default value is xlOuterCenterPoint.

Return Value

Double

Remarks

This property only applies to pie and doughnut chart types.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Select Method (Excel)

 Copy code hover
[image]

Point.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Point object.

Return Value

Variant

See also

Concepts

Point Object

Other resources

Point Object Members


Points Object (Excel)

 Copy code hover
[image]

Points Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Point objects in the specified series in a chart.

Remarks

Use Points(index), where index is the point index number, to return a single Point object. Points are numbered from left to right on the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point.

Example

Use the Points method to return the Points collection. The following example adds a data label to the last point on series one in embedded chart one on worksheet one.

VBA Copy code Copy code
Dim pts As Points
Set pts = Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Points
pts(pts.Count).ApplyDataLabels type:=xlShowValue

The following example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Points(3).MarkerStyle = xlDiamond

See also

Concepts

Excel Object Model Reference

Other resources

Points Object Members


Points Members (Excel)

 Copy code hover
[image]

Points Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Point objects in the specified series in a chart.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Points Properties (Excel)

 Copy code hover
[image]

Points Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Points.Application Property (Excel)

 Copy code hover
[image]

Points.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Points object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Count Property (Excel)

 Copy code hover
[image]

Points.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Points object.

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Creator Property (Excel)

 Copy code hover
[image]

Points.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Points object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Parent Property (Excel)

 Copy code hover
[image]

Points.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Points object.

See also

Concepts

Points Object

Other resources

Points Object Members


Points Methods (Excel)

 Copy code hover
[image]

Points Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


Points.Item Method (Excel)

 Copy code hover
[image]

Points.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Points object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number for the object.

Return Value

A Point object contained by the collection.

Example

This example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Points.Item(3).MarkerStyle = xlDiamond

See also

Concepts

Points Object

Other resources

Points Object Members


ProtectedViewWindow Object (Excel)

 Copy code hover
[image]

ProtectedViewWindow Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a Protected View window.

Version Information

Version Added: Excel 2010

Remarks

A Protected View window is used to display a workbook from a potentially unsafe location. Unsafe locations are defined as the following:

  • Files opened from the Internet.

  • Attachments opened from Microsoft Outlook 2010.

  • Files blocked by File Block Policy.

  • Files that fail Office File Validation.

  • Files explicitly opened in Protected View by using the Open in Protected View command of the Open button in the Open dialog box.

Workbooks displayed in a Protected View window cannot be edited and are restricted from running active content such as Visual Basic for Applications macros and data connections. For more information about Protected View windows, see What is Protected View?

To return a single ProtectedViewWindow object from the ProtectedViewWindows collection, use ProtectedViewWindows(Index), where Index is the index number of the window you want to open. You can also access the ProtectedViewWindow object that represents the active Protected View window by using the ActiveProtectedViewWindow property of the Application object.

After you access a ProtectedViewWindow object, use the Workbook property to access the Workbook object that represents the workbook file that is open in the Protected View window. Because a Protected View window is designed to protect the user from potentially malicious code, the operations you can perform by using a Workbook object returned by a ProtectedViewWindow object will be limited. Operations that are not allowed will return an error.

Example

The following code example accesses the Workbook object that represents the workbook that is open in the first Protected View window.

VBA Copy code Copy code
Dim wbProtected As Workbook

If Application.ProtectedViewWindows.Count > 0 Then
    Set wbProtected = Application.ProtectedViewWindows(1).Workbook
End If

See also

Concepts

Excel Object Model Reference

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow Members (Excel)

 Copy code hover
[image]

ProtectedViewWindow Members (Excel)
Send feedback

Published: July 16, 2012

Represents a Protected View window.

Methods

Name | Description
Activate | Brings the Protected View window to the front of the z-order.
Close | Closes the specified Protected View window.
Edit | Opens the workbook that is open in the specified Protected View window for editing.

Properties

Name | Description
Caption | Returns or sets a Variant value that represents the name that appears in the title bar of the Protected View window. Read/write
EnableResize | True if the Protected View window can be resized. Read/write
Height | Returns or sets a value that represents the height, in points, of the Protected View window. Read/write
Left | Returns or sets a value that represents the distance, in points, from the left edge of the client area to the left edge of the Protected View window. Read/write
SourceName | Returns the name of the source file that is open in the specified Protected View window. Read-only
SourcePath | Returns the path of the source file that is open in the specified Protected View window. Read-only
Top | Returns or sets a value that represents the distance, in points, from the top edge of the specified Protected View window to the top edge of the usable area. Read/write
Visible | Returns or sets a value that determines whether the specified Protected View window is visible. Read/write
Width | Returns or sets a value that specifies the width, in points, of the specified Protected View window. Read/write
WindowState | Returns or sets the state of the specified Protected View window. Read/write
Workbook | Returns an object that represents the workbook that is open in the specified Protected View window. Read-only


ProtectedViewWindow Properties (Excel)

 Copy code hover
[image]

ProtectedViewWindow Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Caption | Returns or sets a Variant value that represents the name that appears in the title bar of the Protected View window. Read/write
EnableResize | True if the Protected View window can be resized. Read/write
Height | Returns or sets a value that represents the height, in points, of the Protected View window. Read/write
Left | Returns or sets a value that represents the distance, in points, from the left edge of the client area to the left edge of the Protected View window. Read/write
SourceName | Returns the name of the source file that is open in the specified Protected View window. Read-only
SourcePath | Returns the path of the source file that is open in the specified Protected View window. Read-only
Top | Returns or sets a value that represents the distance, in points, from the top edge of the specified Protected View window to the top edge of the usable area. Read/write
Visible | Returns or sets a value that determines whether the specified Protected View window is visible. Read/write
Width | Returns or sets a value that specifies the width, in points, of the specified Protected View window. Read/write
WindowState | Returns or sets the state of the specified Protected View window. Read/write
Workbook | Returns an object that represents the workbook that is open in the specified Protected View window. Read-only


ProtectedViewWindow.Caption Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the name that appears in the title bar of the Protected View window. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Caption

expression A variable that represents a ProtectedViewWindow object.

Example

The following code example displays the name (Caption property) of the active Protected View window.

VBA Copy code Copy code
MsgBox "The name of the active Protected View window is " & ActiveProtectedWindow.Caption

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.EnableResize Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.EnableResize Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Protected View window can be resized. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .EnableResize

expression A variable that represents a ProtectedViewWindow object.

Return Value

Boolean

Example

The following code example sets the active Protected View window so that it cannot be resized.

VBA Copy code Copy code
ActiveProtectedViewWindow.EnableResize = False

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Height Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that represents the height, in points, of the Protected View window. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a ProtectedViewWindow object.

Return Value

Double

Remarks

You cannot set this property if the Protected View window is maximized or minimized. Use the WindowState property to determine the window state.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Left Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that represents the distance, in points, from the left edge of the client area to the left edge of the Protected View window. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Left

expression A variable that represents a ProtectedViewWindow object.

Return Value

Double

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.SourceName Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the source file that is open in the specified Protected View window. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SourceName

expression A variable that represents a ProtectedViewWindow object.

Return Value

String

Remarks

This property does not return the path for the source file. To return the path, use the SourcePath property of the ProtectedViewWindow object.

Example

The following example returns the path and name of the workbook associated with the specified Protected View window.

VBA Copy code Copy code
MsgBox ActiveProtectedViewWindow.SourcePath & "\" _
 & ActiveProtectedViewWindow.SourceName

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.SourcePath Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.SourcePath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the path of the source file that is open in the specified Protected View window. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SourcePath

expression A variable that represents a ProtectedViewWindow object.

Return Value

String

Remarks

The path does not include a trailing character (for example, "C:\MSOffice"). Use the PathSeparator property to add the character that separates folders and drive letters. Use the SourceName of the ProtectedViewWindow object to return the source file name without the path.

Example

VBA Copy code Copy code
MsgBox ActiveProtectedViewWindow.SourcePath & Application.PathSeparator _
 & ActiveProtectedViewWindow.SourceName

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Top Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that represents the distance, in points, from the top edge of the specified Protected View window to the top edge of the usable area. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Top

expression A variable that represents a ProtectedViewWindow object.

Return Value

Double

Remarks

You cannot set this property for a maximized Protected View window. Use the WindowState property to return or set the state of the window.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Visible Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that determines whether the specified Protected View window is visible. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Visible

expression A variable that represents a ProtectedViewWindow object.

Return Value

Boolean

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Width Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies the width, in points, of the specified Protected View window. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a ProtectedViewWindow object.

Remarks

You cannot set this property if the Protected View window is maximized or minimized. Use the WindowState property to determine the window state.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.WindowState Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.WindowState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the specified Protected View window. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .WindowState

expression A variable that represents a ProtectedViewWindow object.

Return Value

XlProtectedViewWindowState

Example

The following code example maximizes the active Protected View window.

VBA Copy code Copy code
ActiveProtectedViewWindow.WindowState = xlProtectedViewWindowMaximized

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Workbook Property (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Workbook Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the workbook that is open in the specified Protected View window. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Workbook

expression A variable that represents a ProtectedViewWindow object.

Return Value

Workbook

Remarks

Because a Protected View window is designed to protect the user from potentially malicious code, the operations you can perform by using a Workbook object returned by the Workbook method will be limited. Any operation that is not allowed will return an error.

A workbook displayed in a protected view window is not a member of the Workbooks collection. Instead, use the Workbook property of the ProtectedViewWindow object to access a workbook that is displayed in a protected view window.

Example

The following example uses the Workbook property to return the workbook that is open in the first Protected View window.

VBA Copy code Copy code
Dim wbProtected As Workbook

If Application.ProtectedViewWindows.Count > 0 Then
    Set wbProtected = Application.ProtectedViewWindows(1).Workbook
End If

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow Methods (Excel)

 Copy code hover
[image]

ProtectedViewWindow Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Brings the Protected View window to the front of the z-order.
Close | Closes the specified Protected View window.
Edit | Opens the workbook that is open in the specified Protected View window for editing.


ProtectedViewWindow.Activate Method (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Brings the Protected View window to the front of the z-order.

Version Information

Version Added: Excel 2010

Syntax

expression .Activate

expression A variable that represents a ProtectedViewWindow object.

Return Value

Nothing

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Close Method (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Close Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes the specified Protected View window.

Version Information

Version Added: Excel 2010

Syntax

expression .Close

expression A variable that represents a ProtectedViewWindow object.

Return Value

Boolean

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Edit Method (Excel)

 Copy code hover
[image]

ProtectedViewWindow.Edit Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens the workbook that is open in the specified Protected View window for editing.

Version Information

Version Added: Excel 2010

Syntax

expression .Edit(WriteResPassword, UpdateLinks)

expression A variable that represents a ProtectedViewWindow object.

Parameters

Name | Required/Optional | Data Type | Description
WriteResPassword | Optional | Variant | The password required to write to a write-reserved workbook. If this argument is omitted and the workbook requires a password, the user will be prompted for the password.
UpdateLinks | Optional | Variant | Specifies the way external references (links) in the file, such as the reference to a range in the Budget.xls workbook in the following formula =SUM([Budget.xls]Annual!C10:C25), are updated. If this argument is omitted, the user is prompted to specify how links will be updated. For more information about the values used by this parameter, see the Remarks section. If Excel is opening a file in the WKS, WK1, or WK3 format and the UpdateLinks argument is 0, no charts are created; otherwise Excel generates charts from the graphs attached to the file.

Return Value

Workbook

Remarks

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

You can specify one of the values, listed in the following table, in the UpdateLinks parameter to determine whether external references (links) are updated when the workbook is opened.

Value | Meaning
0 | External references (links) will not be updated when the workbook is opened.
3 | External references (links) will be updated when the workbook is opened.

Example

The following code example opens the workbook that is open in the active Protected View window for editing.

VBA Copy code Copy code
Dim pvWbk As Workbook

Set pvWbk = ActiveProtectedViewWindow.Edit

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindows Object (Excel)

 Copy code hover
[image]

ProtectedViewWindows Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of the ProtectedViewWindow objects that represent all the Protected View windows that are currently open in the application.

Version Information

Version Added: Excel 2010

Remarks

Use the ProtectedViewWindows property to return the ProtectedViewWindows collection.

Example

The following code example displays the number of Protected View windows that are open.

VBA Copy code Copy code
MsgBox "There are " & ProtectedViewWindows.Count & _
 " Protected View windows currently open."

See also

Concepts

Excel Object Model Reference

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows Members (Excel)

 Copy code hover
[image]

ProtectedViewWindows Members (Excel)
Send feedback

Published: July 16, 2012

A collection of the ProtectedViewWindow objects that represent all the Protected View windows that are currently open in the application.

Methods

Name | Description
Open | Opens the specified workbook in a new Protected View window.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object).Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only


ProtectedViewWindows Properties (Excel)

 Copy code hover
[image]

ProtectedViewWindows Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object).Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only


ProtectedViewWindows.Application Property (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object).Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a ProtectedViewWindows object.

Return Value

Application

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Count Property (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that represents a ProtectedViewWindows object.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Creator Property (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version Information

Version Added: Excel 2010

Syntax

expression .Creator

expression A variable that represents a ProtectedViewWindows object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Item Property (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a ProtectedViewWindows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Parent Property (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a ProtectedViewWindows object.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows Methods (Excel)

 Copy code hover
[image]

ProtectedViewWindows Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Open | Opens the specified workbook in a new Protected View window.


ProtectedViewWindows.Open Method (Excel)

 Copy code hover
[image]

ProtectedViewWindows.Open Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens the specified workbook in a new Protected View window.

Version Information

Version Added: Excel 2010

Syntax

expression .Open(Filename, Password, AddToMru, RepairMode)

expression A variable that represents a ProtectedViewWindows object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the workbook (paths are accepted).
Password | Optional | Variant | The password for opening the workbook.
AddToMru | Optional | Variant | True to add the file name to the list of recently used files on the Recent tab of the Backstage view.
RepairMode | Optional | Variant | True to repair the workbook to prevent file corruption.

Return Value

ProtectedViewWindow

Remarks

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Example

The following code example opens a workbook in a new Protected View window.

VBA Copy code Copy code
ProtectedViewWindows.Open FileName:="C:\MyFiles\MyWorkbook.xls"

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


Protection Object (Excel)

 Copy code hover
[image]

Protection Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the various types of protection options available for a worksheet.

Remarks

Use the Protection property of the Worksheet object to return a Protection object.

Once a Protection object is returned, you can use its following properties, to set or return protection options.

  • AllowDeletingColumns

  • AllowDeletingRows

  • AllowFiltering

  • AllowFormattingCells

  • AllowFormattingColumns

  • AllowFormattingRows

  • AllowInsertingColumns

  • AllowInsertingHyperlinks

  • AllowInsertingRows

  • AllowSorting

  • AllowUsingPivotTables

Example

The following example demonstrates how to use the AllowInsertingColumns property of the Protection object, placing three numbers in the top row and protecting the worksheet. Then this example checks to see if the protection setting for allowing the insertion of columns is False and sets it to True, if necessary. Finally, it notifies the user to insert a column.

VBA Copy code Copy code
Sub SetProtection()

 Range("A1").Formula = "1"
 Range("B1").Formula = "3"
 Range("C1").Formula = "4"
 ActiveSheet.Protect

 ' Check the protection setting of the worksheet and act accordingly.
 If ActiveSheet.Protection.AllowInsertingColumns = False Then
 ActiveSheet.Protect AllowInsertingColumns:=True
 MsgBox "Insert a column between 1 and 3"
 Else
 MsgBox "Insert a column between 1 and 3"
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Protection Object Members


Protection Members (Excel)

 Copy code hover
[image]

Protection Members (Excel)
Send feedback

Published: July 16, 2012

Represents the various types of protection options available for a worksheet.

Properties

Name | Description
AllowDeletingColumns | Returns True if the deletion of columns is allowed on a protected worksheet. Read-only Boolean.
AllowDeletingRows | Returns True if the deletion of rows is allowed on a protected worksheet. Read-only Boolean.
AllowEditRanges | Returns an AllowEditRanges object.
AllowFiltering | Returns True if the user is allowed to make use of an AutoFilter that was created before the sheet was protected. Read-only Boolean.
AllowFormattingCells | Returns True if the formatting of cells is allowed on a protected worksheet. Read-only Boolean.
AllowFormattingColumns | Returns True if the formatting of columns is allowed on a protected worksheet. Read-only Boolean.
AllowFormattingRows | Returns True if the formatting of rows is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingColumns | Returns True if the insertion of columns is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingHyperlinks | Returns True if the insertion of hyperlinks is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingRows | Returns True if the insertion of rows is allowed on a protected worksheet. Read-only Boolean.
AllowSorting | Returns True if the sorting option is allowed on a protected worksheet. Read-only Boolean.
AllowUsingPivotTables | Returns True if the user is allowed to manipulate pivot tables on a protected worksheet. Read-only Boolean.


Protection Properties (Excel)

 Copy code hover
[image]

Protection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowDeletingColumns | Returns True if the deletion of columns is allowed on a protected worksheet. Read-only Boolean.
AllowDeletingRows | Returns True if the deletion of rows is allowed on a protected worksheet. Read-only Boolean.
AllowEditRanges | Returns an AllowEditRanges object.
AllowFiltering | Returns True if the user is allowed to make use of an AutoFilter that was created before the sheet was protected. Read-only Boolean.
AllowFormattingCells | Returns True if the formatting of cells is allowed on a protected worksheet. Read-only Boolean.
AllowFormattingColumns | Returns True if the formatting of columns is allowed on a protected worksheet. Read-only Boolean.
AllowFormattingRows | Returns True if the formatting of rows is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingColumns | Returns True if the insertion of columns is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingHyperlinks | Returns True if the insertion of hyperlinks is allowed on a protected worksheet. Read-only Boolean.
AllowInsertingRows | Returns True if the insertion of rows is allowed on a protected worksheet. Read-only Boolean.
AllowSorting | Returns True if the sorting option is allowed on a protected worksheet. Read-only Boolean.
AllowUsingPivotTables | Returns True if the user is allowed to manipulate pivot tables on a protected worksheet. Read-only Boolean.


Protection.AllowDeletingColumns Property (Excel)

 Copy code hover
[image]

Protection.AllowDeletingColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the deletion of columns is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowDeletingColumns

expression A variable that represents a Protection object.

Remarks

The AllowDeletingColumns property can be set by using the Protect method arguments.

The columns containing the cells to be deleted must be unlocked when the sheet is protected.

Example

This example unlocks column A then allows the user to delete column A on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 'Unlock column A.
 Columns("A:A").Locked = False

 ' Allow column A to be deleted on a protected worksheet.
 If ActiveSheet.Protection.AllowDeletingColumns = False Then
 ActiveSheet.Protect AllowDeletingColumns:=True
 End If

 MsgBox "Column A can be deleted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowDeletingRows Property (Excel)

 Copy code hover
[image]

Protection.AllowDeletingRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the deletion of rows is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowDeletingRows

expression A variable that represents a Protection object.

Remarks

The AllowDeletingRows property can be set by using the Protect method arguments.

The rows containing the cells to be deleted must be unlocked when the sheet is protected.

Example

This example unlocks row 1 then allows the user to delete row 1 on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 'Unlock row 1.
 Rows("1:1").Locked = False

 ' Allow row 1 to be deleted on a protected worksheet.
 If ActiveSheet.Protection.AllowDeletingRows = False Then
 ActiveSheet.Protect AllowDeletingRows:=True
 End If

 MsgBox "Row 1 can be deleted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowEditRanges Property (Excel)

 Copy code hover
[image]

Protection.AllowEditRanges Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AllowEditRanges object.

Syntax

expression .AllowEditRanges

expression A variable that represents a Protection object.

Example

In this example, Microsoft Excel allows edits to range A1:A4 on the active worksheet and notifies the user of the title and address of the specified range.

VBA Copy code Copy code
Sub UseAllowEditRanges()

 Dim wksOne As Worksheet
 Dim strPwd1 As String

 Set wksOne = Application.ActiveSheet

 strPwd1 = InputBox("Enter Password")

 ' Unprotect worksheet.
 wksOne.Unprotect

 ' Establish a range that can allow edits
 ' on the protected worksheet.
 wksOne.Protection.AllowEditRanges.Add _
 Title:="Classified", _
 Range:=Range("A1:A4"), _
 Password:=strPwd1

 ' Notify the user
 ' the title and address of the range.
 With wksOne.Protection.AllowEditRanges.Item(1)
 MsgBox "Title of range: " & .Title
 MsgBox "Address of range: " & .Range.Address
 End With

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowFiltering Property (Excel)

 Copy code hover
[image]

Protection.AllowFiltering Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the user is allowed to make use of an AutoFilter that was created before the sheet was protected. Read-only Boolean.

Syntax

expression .AllowFiltering

expression A variable that represents a Protection object.

Remarks

The AllowFiltering property can be set by using the Protect method arguments.

The AllowFiltering property allows the user to change filter criteria on an existing AutoFilter. The user cannot create or remove an AutoFilter on a protected worksheet.

The cells to be filtered must be unlocked when the sheet is protected.

Example

This example allows the user to filter row 1 on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Unlock row 1.
 Rows("1:1").Locked = False

 ' Allow row 1 to be filtered on a protected worksheet.
 If ActiveSheet.Protection.AllowFiltering = False Then
 ActiveSheet.Protect AllowFiltering:=True
 End If

 MsgBox "Row 1 can be filtered on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowFormattingCells Property (Excel)

 Copy code hover
[image]

Protection.AllowFormattingCells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the formatting of cells is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowFormattingCells

expression A variable that represents a Protection object.

Remarks

The AllowFormattingCells property can be set by using the Protect method arguments.

Use of this property disables the protection tab, allowing the user to change all formats, but not to unlock or unhide ranges.

Example

This example allows the user to format cells on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow cells to be formatted on a protected worksheet.
 If ActiveSheet.Protection.AllowFormattingCells = False Then
 ActiveSheet.Protect AllowFormattingCells:=True
 End If

 MsgBox "Cells can be formatted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowFormattingColumns Property (Excel)

 Copy code hover
[image]

Protection.AllowFormattingColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the formatting of columns is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowFormattingColumns

expression A variable that represents a Protection object.

Remarks

The AllowFormattingColumns property can be set by using the Protect method arguments.

Example

This example allows the user to format columns on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow columns to be formatted on a protected worksheet.
 If ActiveSheet.Protection.AllowFormattingColumns = False Then
 ActiveSheet.Protect AllowFormattingColumns:=True
 End If

 MsgBox "Columns can be formatted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowFormattingRows Property (Excel)

 Copy code hover
[image]

Protection.AllowFormattingRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the formatting of rows is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowFormattingRows

expression A variable that represents a Protection object.

Remarks

The AllowFormattingRows property can be set by using the Protect method arguments.

Example

This example allows the user to format the rows on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow rows to be formatted on a protected worksheet.
 If ActiveSheet.Protection.AllowFormattingRows = False Then
 ActiveSheet.Protect AllowFormattingRows:=True
 End If

 MsgBox "Rows can be formatted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowInsertingColumns Property (Excel)

 Copy code hover
[image]

Protection.AllowInsertingColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the insertion of columns is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowInsertingColumns

expression A variable that represents a Protection object.

Remarks

An inserted column inherits its formatting (by default) from the column to its left, which means that it may have locked cells. In other words, users may not be able to delete columns that they have inserted.

The AllowInsertingColumns property can be set by using the Protect method arguments.

Example

This example allows the user to insert columns on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow columns to be inserted on a protected worksheet.
 If ActiveSheet.Protection.AllowInsertingColumns = False Then
 ActiveSheet.Protect AllowInsertingColumns:=True
 End If

 MsgBox "Columns can be inserted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowInsertingHyperlinks Property (Excel)

 Copy code hover
[image]

Protection.AllowInsertingHyperlinks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the insertion of hyperlinks is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowInsertingHyperlinks

expression A variable that represents a Protection object.

Remarks

Hyperlinks can only be inserted in unlocked or unprotected cells on a protected worksheet.

The AllowInsertingHyperlinks property can be set by using the Protect method arguments.

Example

This example allows the user to insert a hyperlink in cell A1 on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Unlock cell A1.
 Range("A1").Locked = False

 ' Allow hyperlinks to be inserted on a protected worksheet.
 If ActiveSheet.Protection.AllowInsertingHyperlinks = False Then
 ActiveSheet.Protect AllowInsertingHyperlinks:=True
 End If

 MsgBox "Hyperlinks can be inserted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowInsertingRows Property (Excel)

 Copy code hover
[image]

Protection.AllowInsertingRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the insertion of rows is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowInsertingRows

expression A variable that represents a Protection object.

Remarks

The AllowInsertingRows property can be set by using the Protect method arguments.

Example

This example allows the user to insert rows on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow rows to be inserted on a protected worksheet.
 If ActiveSheet.Protection.AllowInsertingRows = False Then
 ActiveSheet.Protect AllowInsertingRows:=True
 End If

 MsgBox "Rows can be inserted on this protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowSorting Property (Excel)

 Copy code hover
[image]

Protection.AllowSorting Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the sorting option is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowSorting

expression A variable that represents a Protection object.

Remarks

Sorting can only be performed on unlocked or unprotected cells in a protected worksheet.

The AllowSorting property can be set by using the Protect method arguments.

Example

This example allows the user to sort unlocked or unprotected cells on the protected worksheet and notifies the user.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Unlock cells A1 through B5.
 Range("A1:B5").Locked = False

 ' Allow sorting to be performed on the protected worksheet.
 If ActiveSheet.Protection.AllowSorting = False Then
 ActiveSheet.Protect AllowSorting:=True
 End If

 MsgBox "For cells A1 through B5, sorting can be performed on the protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


Protection.AllowUsingPivotTables Property (Excel)

 Copy code hover
[image]

Protection.AllowUsingPivotTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the user is allowed to manipulate pivot tables on a protected worksheet. Read-only Boolean.

Syntax

expression .AllowUsingPivotTables

expression A variable that represents a Protection object.

Remarks

The AllowUsingPivotTables property applies to non-OLAP source data.

The AllowUsingPivotTables property can be set by using the Protect method arguments.

Example

This example allows the user to access the PivotTable report and notifies the user. It assumes a non-OLAP Pivot Table report exists on the active worksheet.

VBA Copy code Copy code
Sub ProtectionOptions()

 ActiveSheet.Unprotect

 ' Allow pivot tables to be manipulated on a protected worksheet.
 If ActiveSheet.Protection.Allow UsingPivotTables = False Then
 ActiveSheet.Protect AllowUsingPivotTables:=True
 End If

 MsgBox "Pivot tables can be manipulated on the protected worksheet."

End Sub

See also

Concepts

Protection Object

Other resources

Protection Object Members


PublishObject Object (Excel)

 Copy code hover
[image]

PublishObject Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an item in a workbook that has been saved to a Web page and can be refreshed according to values specified by the properties and methods of the PublishObject object.

Remarks

The PublishObject object is a member of the PublishObjects collection.

Example

Use PublishObjects(index), where index is the index number of the specified item in the workbook, to return a single PublishObject object. The following example sets the location where the first item in workbook three is saved.

VBA Copy code Copy code
Workbooks(3).PublishObjects(1).FileName = _
 "\\myserver\public\finacct\statemnt.htm"

See also

Concepts

Excel Object Model Reference

Other resources

PublishObject Object Members


PublishObject Members (Excel)

 Copy code hover
[image]

PublishObject Members (Excel)
Send feedback

Published: July 16, 2012

Represents an item in a workbook that has been saved to a Web page and can be refreshed according to values specified by the properties and methods of the PublishObject object.

Methods

Name | Description
Delete | Deletes the object.
Publish | Saves an item or a collection of items in a document to a Web page.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoRepublish | When a workbook is saved, Microsoft Excel determines if any item in the PublishObjects collection has the AutoRepublish property set to True and, if so, republishes it. The default value is False. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DivID | Returns the unique identifier used for identifying an HTML <DIV> tag on a Web page. The tag is associated with an item in a document that you have saved to a Web page. An item can be an entire workbook, a worksheet, a selected print range, an AutoFilter range, a range of cells, a chart, a PivotTable report, or a query table. Read-only String.
Filename | Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.
HtmlType | Returns or sets the type of HTML generated by Microsoft Excel when you save the specified item to a Web page. Can be one of the XlHtmlType constants listed in the following table, specifying whether the item is static or interactive in the Web page. The default value is xlHtmlStatic.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified PublishObject object. Read-only String.
Source | Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.
SourceType | Returns a XlSourceType value that represents the type of item being published.
Title | Returns or sets the title of the Web page when the document is saved as a Web page. Read/write String.


PublishObject Properties (Excel)

 Copy code hover
[image]

PublishObject Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoRepublish | When a workbook is saved, Microsoft Excel determines if any item in the PublishObjects collection has the AutoRepublish property set to True and, if so, republishes it. The default value is False. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DivID | Returns the unique identifier used for identifying an HTML <DIV> tag on a Web page. The tag is associated with an item in a document that you have saved to a Web page. An item can be an entire workbook, a worksheet, a selected print range, an AutoFilter range, a range of cells, a chart, a PivotTable report, or a query table. Read-only String.
Filename | Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.
HtmlType | Returns or sets the type of HTML generated by Microsoft Excel when you save the specified item to a Web page. Can be one of the XlHtmlType constants listed in the following table, specifying whether the item is static or interactive in the Web page. The default value is xlHtmlStatic.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified PublishObject object. Read-only String.
Source | Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.
SourceType | Returns a XlSourceType value that represents the type of item being published.
Title | Returns or sets the title of the Web page when the document is saved as a Web page. Read/write String.


PublishObject.Application Property (Excel)

 Copy code hover
[image]

PublishObject.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PublishObject object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.AutoRepublish Property (Excel)

 Copy code hover
[image]

PublishObject.AutoRepublish Property (Excel)
See also Send feedback

Published: July 16, 2012

When a workbook is saved, Microsoft Excel determines if any item in the PublishObjects collection has the AutoRepublish property set to True and, if so, republishes it. The default value is False. Read/write Boolean.

Syntax

expression .AutoRepublish

expression A variable that represents a PublishObject object.

Example

This example publishes a range on a worksheet to an HTML file on the C: drive. When the user saves the workbook containing the worksheet, Excel will automatically republish the range to the same HTML file. This example assumes that the user has read/write access to the web page and that cells A1 through D10 in the worksheet have values in them.

VBA Copy code Copy code
Sub PublishToWeb()

 With ActiveWorkbook.PublishObjects.Add( _
 SourceType:= xlSourceRange, _
 Filename:="C:\Work.htm", _
 Sheet:="Sheet1", _
 Source:="A1:D10", _
 HtmlType:=xlHtmlStatic, _
 DivID:="Book1.xls_130489")
 .Publish
 .AutoRepublish = True
 End With

End Sub

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Creator Property (Excel)

 Copy code hover
[image]

PublishObject.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PublishObject object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.DivID Property (Excel)

 Copy code hover
[image]

PublishObject.DivID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the unique identifier used for identifying an HTML <DIV> tag on a Web page. The tag is associated with an item in a document that you have saved to a Web page. An item can be an entire workbook, a worksheet, a selected print range, an AutoFilter range, a range of cells, a chart, a PivotTable report, or a query table. Read-only String.

Syntax

expression .DivID

expression A variable that represents a PublishObject object.

Example

This example saves a range of cells to a Web page, and then it obtains the identifier from the <DIV> tag of this item and finds the line on the saved Web page (q198.htm). The example also creates a copy of the Web page (newq1.htm) and inserts a comment line before the <DIV> tag in the copy of the file.

VBA Copy code Copy code
Set objPO = ActiveWorkbook.PublishObjects.Add( _
 SourceType:=xlSourceRange, _
 Filename:="\\Server1\Reports\q198.htm", _
 Sheet:="Sheet1", _
 Source:="C2:D6", _
 HtmlType:=xlHtmlStatic)
objPO.Publish
strTargetDivID = objPO.DivID
Open "\\Server1\Reports\q198.htm" For Input As #1
Open "\\Server1\Reports\newq1.htm" For Output As #2
While Not EOF(1)
 Line Input #1, strFileLine
 If InStr(strFileLine, strTargetDivID) > 0 And _
 InStr(strFileLine, "<div") > 0 Then
 Print #2, "<!--Saved item-->"
 End If
 Print #2, strFileLine
Wend
Close #2
Close #1

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Filename Property (Excel)

 Copy code hover
[image]

PublishObject.Filename Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location where the specified source object was saved. Read/write String.

Syntax

expression .Filename

expression A variable that represents a PublishObject object.

Remarks

The FileName property generates an error if a folder in the specified path doesn't exist.

Example

This example sets the location where the first item in the active workbook is to be saved.

VBA Copy code Copy code
ActiveWorkbook.PublishObjects(1).FileName = _
 "\\Server2\Q1\StockReport.htm"

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.HtmlType Property (Excel)

 Copy code hover
[image]

PublishObject.HtmlType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of HTML generated by Microsoft Excel when you save the specified item to a Web page. Can be one of the XlHtmlType constants listed in the following table, specifying whether the item is static or interactive in the Web page. The default value is xlHtmlStatic.

Syntax

expression .HtmlType

expression A variable that represents a PublishObject object.

Remarks

XlHtmlType can be one of these XlHtmlType constants.

xlHtmlCalc. Use the Spreadsheet component.

xlHtmlChart. Use the Chart component.

xlHtmlList. Use the PivotTable component.

xlHtmlStatic. Use static (noninteractive) HTML for viewing only.

Example

This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page called "stockreport.htm".

VBA Copy code Copy code
With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceRange, _
 Filename:="\\Server\stockreport.htm", Sheet:="First Quarter", Source:="$G$3:$H$6", _
 HtmlType:=xlHtmlStatic, DivID:="Book1_4170")
 .Publish (True)
 .AutoRepublish = False
End With

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Parent Property (Excel)

 Copy code hover
[image]

PublishObject.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PublishObject object.

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Sheet Property (Excel)

 Copy code hover
[image]

PublishObject.Sheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sheet name for the specified PublishObject object. Read-only String.

Syntax

expression .Sheet

expression A variable that represents a PublishObject object.

Remarks

This example determines the name of the worksheet that contains the first PublishObject object that is saved as static HTML in the Web page. The example then sets the Boolean variable blnSheetFound to True. If no items in the document have been saved as static HTML, blnSheetFound is False.

Example

VBA Copy code Copy code
blnSheetFound = False
For Each objPO In Workbooks(1).PublishObjects
 If objPO.HtmlType = xlHTMLStatic Then
 strFirstPO = objPO.Sheet
 blnSheetFound = True
 Exit For
 End If
Next objPO

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Source Property (Excel)

 Copy code hover
[image]

PublishObject.Source Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.

Syntax

expression .Source

expression A variable that represents a PublishObject object.

Remarks

If the SourceType property is set to xlSourceRange, this property returns a range, which can be a defined name. If the SourceType property is set to xlSourceChart, xlSourcePivotTable, or xlSourceQuery, this property returns the name of the object, such as a chart name, a PivotTable report name, or a query table name.

Example

This example determines the unique name of the first chart (in the first workbook) saved as a Web page, and then it sets the Boolean variable blnChartFound to True. If no items in the document have been saved as Chart components, blnChartFound is False.

VBA Copy code Copy code
blnChartFound = False
For Each objPO In Workbooks(1).PublishObjects
 If objPO.SourceType = xlSourceChart Then
 strFirstPO = objPO.Source
 blnChartFound = True
 Exit For
 End If
Next objPO

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.SourceType Property (Excel)

 Copy code hover
[image]

PublishObject.SourceType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a XlSourceType value that represents the type of item being published.

Syntax

expression .SourceType

expression A variable that represents a PublishObject object.

Example

This example determines the unique name of the first chart (in the first workbook) saved as a Web page, and then it sets the Boolean variable blnChartFound to True. If no items in the document have been saved as Chart components, blnChartFound is False.

VBA Copy code Copy code
blnChartFound = False
For Each objPO In Workbooks(1).PublishObjects
    If objPO.SourceType = xlSourceChart Then
        strFirstPO = objPO.Source
        blnChartFound = True
        Exit For
    End If
Next objPO

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Title Property (Excel)

 Copy code hover
[image]

PublishObject.Title Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the Web page when the document is saved as a Web page. Read/write String.

Syntax

expression .Title

expression A variable that represents a PublishObject object.

Remarks

The title is usually displayed in the window title bar when the document is viewed in the Web browser.

Example

This example sets the Web page title to "Sales Forecast" when the first item in the first workbook is saved as a Web page.

VBA Copy code Copy code
Workbooks(1).PublishObjects(1).Title = "Sales Forecast"

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject Methods (Excel)

 Copy code hover
[image]

PublishObject Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Publish | Saves an item or a collection of items in a document to a Web page.


PublishObject.Delete Method (Excel)

 Copy code hover
[image]

PublishObject.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a PublishObject object.

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObject.Publish Method (Excel)

 Copy code hover
[image]

PublishObject.Publish Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves an item or a collection of items in a document to a Web page.

Syntax

expression .Publish(Create)

expression A variable that represents a PublishObject object.

Parameters

Name | Required/Optional | Data Type | Description
Create | Optional | Variant | If the HTML file exists, setting this argument to True replaces the file, and setting this argument to False inserts the item or items at the end of the file. If the file does not exist, then the file is created regardless of the value of the Create argument.

Remarks

The FileName property returns or sets the location and name of the HTML file.

Example

This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page named stockreport.htm. The Spreadsheet component is used to make the Web page interactive.

VBA Copy code Copy code
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
 "\\Server1\sharedfolder\stockreport.htm", "First Quarter", _
 "$D$5:$D$9", xlHtmlStatic, "Book2_25082", "")
 .Publish (True)
 .AutoRepublish = True
End With

See also

Concepts

PublishObject Object

Other resources

PublishObject Object Members


PublishObjects Object (Excel)

 Copy code hover
[image]

PublishObjects Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all PublishObject objects in the workbook.

Remarks

Each PublishObject object represents an item in a workbook that has been saved to a Web page and can be refreshed according to values specified by the properties and methods of the object.

Example

Use the PublishObjects property to return the PublishObjects collection. The following example saves all static PublishObject objects in the active workbook to the Web page.

VBA Copy code Copy code
Set objPObjs = ActiveWorkbook.PublishObjects
For Each objPO in objPObjs
 If objPO.HtmlType = xlHTMLStatic Then
 objPO.Publish
 End If
Next objPO

Use PublishObjects(index), where index is the index number of the specified item in the workbook, to return a single PublishObject object. The following example sets the location where the first item in workbook three is saved.

VBA Copy code Copy code
Workbooks(3).PublishObjects(1).FileName = _
 "\\myserver\public\finacct\statemnt.htm"

See also

Concepts

Excel Object Model Reference

Other resources

PublishObjects Object Members


PublishObjects Members (Excel)

 Copy code hover
[image]

PublishObjects Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all PublishObject objects in the workbook.

Methods

Name | Description
Add | Creates an object that represents an item in a document saved to a Web page. Such objects facilitate subsequent updates to the Web page while automated changes are being made to the document in Microsoft Excel. Returns a PublishObject object.
Delete | Deletes the object.
Publish | Saves a copy of the item or items in the spreadsheet that have been added to the PublishObjects collection to a Web page.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


PublishObjects Properties (Excel)

 Copy code hover
[image]

PublishObjects Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


PublishObjects.Application Property (Excel)

 Copy code hover
[image]

PublishObjects.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a PublishObjects object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Count Property (Excel)

 Copy code hover
[image]

PublishObjects.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a PublishObjects object.

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Creator Property (Excel)

 Copy code hover
[image]

PublishObjects.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a PublishObjects object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Item Property (Excel)

 Copy code hover
[image]

PublishObjects.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a PublishObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example obtains the identifier from a <DIV> tag and finds the line in a Web page (q198.htm) that you saved from a workbook. The example then creates a copy of the Web page (newq1.htm) and inserts a comment line before the <DIV> tag in the copy of the file.

VBA Copy code Copy code
strTargetDivID = ActiveWorkbook.PublishObjects.Item(1).DivID
Open "\\server1\reports\q198.htm" For Input As #1
Open "\\server1\reports\newq1.htm" For Output As #2
While Not EOF(1)
 Line Input #1, strFileLine
 If InStr(strFileLine, strTargetDivID) > 0 And _
 InStr(strFileLine, "<div") > 0 Then
 Print #2, "<!--Saved item-->"
 End If
 Print #2, strFileLine
Wend
Close #2
Close #1

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Parent Property (Excel)

 Copy code hover
[image]

PublishObjects.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PublishObjects object.

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects Methods (Excel)

 Copy code hover
[image]

PublishObjects Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates an object that represents an item in a document saved to a Web page. Such objects facilitate subsequent updates to the Web page while automated changes are being made to the document in Microsoft Excel. Returns a PublishObject object.
Delete | Deletes the object.
Publish | Saves a copy of the item or items in the spreadsheet that have been added to the PublishObjects collection to a Web page.


PublishObjects.Add Method (Excel)

 Copy code hover
[image]

PublishObjects.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates an object that represents an item in a document saved to a Web page. Such objects facilitate subsequent updates to the Web page while automated changes are being made to the document in Microsoft Excel. Returns a PublishObject object.

Syntax

expression .Add(SourceType, FileName, Sheet, Source, HtmlType, DivID, Title)

expression A variable that represents a PublishObjects object.

Parameters

Name | Required/Optional | Data Type | Description
SourceType | Required | XlSourceType | The source type.
Title | Optional | Variant | String. The URL (on the intranet or the Web) or path (local or network) to which the source object was saved.
Sheet | Optional | Variant | The name of the worksheet that was saved as a Web page.
Source | Optional | Variant | A unique name used to identify items that have one of the following constants as their SourceType argument: xlSourceAutoFilter, xlSourceChart, xlSourcePivotTable, xlSourcePrintArea, xlSourceQuery, or xlSourceRange. If SourceType is xlSourceRange, Source specifies a range, which can be a defined name. If SourceType is xlSourceChart, xlSourcePivotTable, or xlSourceQuery, Source specifies the name of a chart, PivotTable report, or query table.
HtmlType | Optional | Variant | Specifies whether the item is saved as an interactive Microsoft Office Web component or as static text and images. Can be one of the XlHTMLType constants: xlHtmlCalc, xlHtmlChart, xlHtmlList, or xlHtmlStatic.
DivID | Optional | Variant | The unique identifier used in the HTML DIV tag to identify the item on the Web page.
Title | Optional | Variant | The title of the Web page.

Return Value

A PublishObject object that represents the new item.

Example

This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page called Stockreport.htm.

VBA Copy code Copy code
With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceRange, _
    Filename:="\\Server\Stockreport.htm", Sheet:="First Quarter", Source:="$G$3:$H$6", _
    HtmlType:=xlHtmlStatic, DivID:="Book1_4170")
        .Publish (True)
        .AutoRepublish = False
End With

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Delete Method (Excel)

 Copy code hover
[image]

PublishObjects.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a PublishObjects object.

See also

Concepts

PublishObjects Object

Other resources

PublishObjects Object Members


PublishObjects.Publish Method (Excel)

 Copy code hover
[image]

PublishObjects.Publish Method (Excel)
Send feedback

Published: July 16, 2012

Saves a copy of the item or items in the spreadsheet that have been added to the PublishObjects collection to a Web page.

Syntax

expression .Publish

expression A variable that represents a PublishObjects object.


QueryTable Object (Excel)

 Copy code hover
[image]

QueryTable Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a worksheet table built from data returned from an external data source, such as an SQL server or a Microsoft Access database.

Remarks

The QueryTable object is a member of the QueryTables collection.

Example

Use QueryTables(index), where index is the index number of the query table, to return a single QueryTable object. The following example sets query table one so that formulas to the right of it are automatically updated whenever it's refreshed.

VBA Copy code Copy code
Sheets("sheet1").QueryTables(1).FillAdjacentFormulas = True

See also

Concepts

Excel Object Model Reference

Other resources

QueryTable Object Members


QueryTable Members (Excel)

 Copy code hover
[image]

QueryTable Members (Excel)
Send feedback

Published: July 16, 2012

Represents a worksheet table built from data returned from an external data source, such as an SQL server or a Microsoft Access database.

Events

Name | Description
AfterRefresh | Occurs after a query is completed or canceled.
BeforeRefresh | Occurs before any refreshes of the query table. This includes refreshes resulting from calling the Refresh method, from the user's actions in the product, and from opening the workbook containing the query table.

Methods

Name | Description
CancelRefresh | Cancels all background queries for the specified query table. Use the Refreshing property to determine whether a background query is currently in progress.
Delete | Deletes the object.
Refresh | Updates an external data range (QueryTable).
ResetTimer | Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.
SaveAsODC | Saves the QueryTable cache source as an Microsoft Office Data Connection file.

Properties

Name | Description
AdjustColumnWidth | True if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. False if the column widths are not automatically adjusted with each refresh. The default value is True. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundQuery | True if queries for the query table are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.
Connection | Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Destination | Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the QueryTable object. Read-only Range.
EditWebPage | Returns or sets the web page Uniform Resource Locator (URL) for a web query. Read/write Variant.
EnableEditing | True if the user can edit the specified query table. False if the user can only refresh the query table. Read/write Boolean.
EnableRefresh | True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.
FetchedRowOverflow | True if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Read-only Boolean.
FieldNames | True if field names from the data source appear as column headings for the returned data. The default value is True. Read/write Boolean.
FillAdjacentFormulas | True if formulas to the right of the specified query table are automatically updated whenever the query table is refreshed. Read/write Boolean.
ListObject | Returns a ListObject object for the QueryTable object. Read-only ListObject object.
MaintainConnection | True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
Parameters | Returns a Parameters collection that represents the query table parameters. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PostText | Returns or sets the string used with the post method of inputting data into a Web server to return data from a Web query. Read/write String.
PreserveColumnInfo | True if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is True. Read/write Boolean.
PreserveFormatting | True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.
QueryType | Indicates the type of query used by Microsoft Excel to populate the query table. Read-only XlQueryType.
Recordset | Returns or sets a Recordset object that's used as the data source for the specified query table. Read/write.
Refreshing | True if there is a background query in progress for the specified query table. Read only Boolean.
RefreshOnFileOpen | True if the PivotTable cache or query table is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RefreshStyle | Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a recordset returned by a query. Read/write XlCellInsertionMode.
ResultRange | Returns a Range object that represents the area of the worksheet occupied by the specified query table. Read-only.
RobustConnect | Returns or sets how the query table connects to its data source. Read/write XlRobustConnect.
RowNumbers | True if row numbers are added as the first column of the specified query table. Read/write Boolean.
SaveData | True if data for the QueryTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.
SavePassword | True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.
Sort | Returns the sort criteria for the query table range. Read-only.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the QueryTable. Read/write.
SourceDataFile | Returns or sets a String value that indicates the source data file for a query table.
TextFileColumnDataTypes | Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you are importing into a query table. The default constant for each column is xlGeneral. Read/write Variant.
TextFileCommaDelimiter | True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/write Boolean.
TextFileConsecutiveDelimiter | True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileDecimalSeparator | Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/write String.
TextFileFixedColumnWidths | Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/write Variant.
TextFileOtherDelimiter | Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/write String.
TextFileParseType | Returns or sets the column format for the data in the text file that you're importing into a query table. Read/write XlTextParsingType.
TextFilePlatform | Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform.
TextFilePromptOnRefresh | True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/write Boolean.
TextFileSemicolonDelimiter | True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextFileParseType property is xlDelimited. The default value is False. Read/write Boolean.
TextFileSpaceDelimiter | True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileStartRow | Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/write Long.
TextFileTabDelimiter | True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileTextQualifier | Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/write XlTextQualifier.
TextFileThousandsSeparator | Returns or sets the thousands separator character thatMicrosoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/write String.
TextFileTrailingMinusNumbers | True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/write Boolean.
TextFileVisualLayout | Returns or sets a XlTextVisualLayoutType enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left.
WebConsecutiveDelimitersAsOne | True if consecutive delimiters are treated as a single delimiter when you import data from HTML <PRE> tags in a Web page into a query table, and if the data is to be parsed into columns. False if you want to treat consecutive delimiters as multiple delimiters. The default value is True. Read/write Boolean.
WebDisableDateRecognition | True if data that resembles dates is parsed as text when you import a Web page into a query table. False if date recognition is used. The default value is False. Read/write Boolean.
WebDisableRedirections | True if Web query redirections are disabled for a QueryTable object. The default value is False. Read/write Boolean.
WebFormatting | Returns or sets a value that determines how much formatting from a Web page, if any, is applied when you import the page into a query table. Read/write XlWebFormatting.
WebPreFormattedTextToColumns | Returns or sets whether data contained within HTML <PRE> tags in the Web page is parsed into columns when you import the page into a query table. The default is True. Read/write Boolean.
WebSelectionType | Returns or sets a value that determines whether an entire Web page, all tables on the Web page, or only specific tables on the Web page are imported into a query table. Read/write XlWebSelectionType .
WebSingleBlockTextImport | True if data from the HTML <PRE> tags in the specified Web page is processed all at once when you import the page into a query table. False if the data is imported in blocks of contiguous rows so that header rows will be recognized as such. The default value is False. Read/write Boolean.
WebTables | Returns or sets a comma-delimited list of table names or table index numbers when you import a Web page into a query table. Read/write String.
WorkbookConnection | Returns the WorkbookConnection object that the query table uses. Read-only.


QueryTable Properties (Excel)

 Copy code hover
[image]

QueryTable Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AdjustColumnWidth | True if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. False if the column widths are not automatically adjusted with each refresh. The default value is True. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BackgroundQuery | True if queries for the query table are performed asynchronously (in the background). Read/write Boolean.
CommandText | Returns or sets the command string for the specified data source. Read/write Variant.
CommandType | Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.
Connection | Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Destination | Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the QueryTable object. Read-only Range.
EditWebPage | Returns or sets the web page Uniform Resource Locator (URL) for a web query. Read/write Variant.
EnableEditing | True if the user can edit the specified query table. False if the user can only refresh the query table. Read/write Boolean.
EnableRefresh | True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.
FetchedRowOverflow | True if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Read-only Boolean.
FieldNames | True if field names from the data source appear as column headings for the returned data. The default value is True. Read/write Boolean.
FillAdjacentFormulas | True if formulas to the right of the specified query table are automatically updated whenever the query table is refreshed. Read/write Boolean.
ListObject | Returns a ListObject object for the QueryTable object. Read-only ListObject object.
MaintainConnection | True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
Parameters | Returns a Parameters collection that represents the query table parameters. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
PostText | Returns or sets the string used with the post method of inputting data into a Web server to return data from a Web query. Read/write String.
PreserveColumnInfo | True if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is True. Read/write Boolean.
PreserveFormatting | True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.
QueryType | Indicates the type of query used by Microsoft Excel to populate the query table. Read-only XlQueryType.
Recordset | Returns or sets a Recordset object that's used as the data source for the specified query table. Read/write.
Refreshing | True if there is a background query in progress for the specified query table. Read only Boolean.
RefreshOnFileOpen | True if the PivotTable cache or query table is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.
RefreshPeriod | Returns or sets the number of minutes between refreshes. Read/write Long.
RefreshStyle | Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a recordset returned by a query. Read/write XlCellInsertionMode.
ResultRange | Returns a Range object that represents the area of the worksheet occupied by the specified query table. Read-only.
RobustConnect | Returns or sets how the query table connects to its data source. Read/write XlRobustConnect.
RowNumbers | True if row numbers are added as the first column of the specified query table. Read/write Boolean.
SaveData | True if data for the QueryTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.
SavePassword | True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.
Sort | Returns the sort criteria for the query table range. Read-only.
SourceConnectionFile | Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the QueryTable. Read/write.
SourceDataFile | Returns or sets a String value that indicates the source data file for a query table.
TextFileColumnDataTypes | Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you are importing into a query table. The default constant for each column is xlGeneral. Read/write Variant.
TextFileCommaDelimiter | True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/write Boolean.
TextFileConsecutiveDelimiter | True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileDecimalSeparator | Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/write String.
TextFileFixedColumnWidths | Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/write Variant.
TextFileOtherDelimiter | Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/write String.
TextFileParseType | Returns or sets the column format for the data in the text file that you're importing into a query table. Read/write XlTextParsingType.
TextFilePlatform | Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform.
TextFilePromptOnRefresh | True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/write Boolean.
TextFileSemicolonDelimiter | True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextFileParseType property is xlDelimited. The default value is False. Read/write Boolean.
TextFileSpaceDelimiter | True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileStartRow | Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/write Long.
TextFileTabDelimiter | True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.
TextFileTextQualifier | Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/write XlTextQualifier.
TextFileThousandsSeparator | Returns or sets the thousands separator character thatMicrosoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/write String.
TextFileTrailingMinusNumbers | True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/write Boolean.
TextFileVisualLayout | Returns or sets a XlTextVisualLayoutType enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left.
WebConsecutiveDelimitersAsOne | True if consecutive delimiters are treated as a single delimiter when you import data from HTML <PRE> tags in a Web page into a query table, and if the data is to be parsed into columns. False if you want to treat consecutive delimiters as multiple delimiters. The default value is True. Read/write Boolean.
WebDisableDateRecognition | True if data that resembles dates is parsed as text when you import a Web page into a query table. False if date recognition is used. The default value is False. Read/write Boolean.
WebDisableRedirections | True if Web query redirections are disabled for a QueryTable object. The default value is False. Read/write Boolean.
WebFormatting | Returns or sets a value that determines how much formatting from a Web page, if any, is applied when you import the page into a query table. Read/write XlWebFormatting.
WebPreFormattedTextToColumns | Returns or sets whether data contained within HTML <PRE> tags in the Web page is parsed into columns when you import the page into a query table. The default is True. Read/write Boolean.
WebSelectionType | Returns or sets a value that determines whether an entire Web page, all tables on the Web page, or only specific tables on the Web page are imported into a query table. Read/write XlWebSelectionType .
WebSingleBlockTextImport | True if data from the HTML <PRE> tags in the specified Web page is processed all at once when you import the page into a query table. False if the data is imported in blocks of contiguous rows so that header rows will be recognized as such. The default value is False. Read/write Boolean.
WebTables | Returns or sets a comma-delimited list of table names or table index numbers when you import a Web page into a query table. Read/write String.
WorkbookConnection | Returns the WorkbookConnection object that the query table uses. Read-only.


QueryTable.AdjustColumnWidth Property (Excel)

 Copy code hover
[image]

QueryTable.AdjustColumnWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. False if the column widths are not automatically adjusted with each refresh. The default value is True. Read/write Boolean.

Syntax

expression .AdjustColumnWidth

expression A variable that represents a QueryTable object.

Remarks

The maximum column width is two-thirds the width of the screen.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the AdjustColumnWidth property.

Example

This example turns off automatic column-width adjustment for the newly added query table on the first worksheet in the first workbook.

VBA Copy code Copy code
With Workbooks(1).Worksheets(1).QueryTables _
 .Add(Connection:= varDBConnStr, _
 Destination:=Range("B1"), _
 Sql:="Select Price From CurrentStocks " & _
 "Where Symbol = 'MSFT'")
 .AdjustColumnWidth = False
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Application Property (Excel)

 Copy code hover
[image]

QueryTable.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Application property.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.BackgroundQuery Property (Excel)

 Copy code hover
[image]

QueryTable.BackgroundQuery Property (Excel)
See also Send feedback

Published: July 16, 2012

True if queries for the query table are performed asynchronously (in the background). Read/write Boolean.

Syntax

expression .BackgroundQuery

expression A variable that represents a QueryTable object.

Remarks

For OLAP data sources, this property is read-only and always returns False.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the BackgroundQuery property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.CommandText Property (Excel)

 Copy code hover
[image]

QueryTable.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Read/write Variant.

Syntax

expression .CommandText

expression An expression that returns a QueryTable object.

Remarks

For OLE DB sources, the CommandType property describes the value of the CommandText property.

For ODBC sources, setting the CommandText causes the data to be refreshed.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the CommandText property.

The sheet that contains the query table must be active to access this property.

Example

This example sets the command string for the first query table's ODBC data source. Note that the command string is an SQL statement.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 .CommandType = xlCmdSQL
 .CommandText = _
 "Select ProductID From Products Where ProductID < 10"
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.CommandType Property (Excel)

 Copy code hover
[image]

QueryTable.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType constants listed in the following table in the remarks section. The constant that is returned or set describes the value of the CommandText property. The default value is xlCmdSQL. Read/write XlCmdType.

Syntax

expression .CommandType

expression An expression that returns a QueryTable object.

Remarks

XlCmdType can be one of these XlCmdType constants.

xlCmdCube. Contains a cube name for an OLAP data source.

xlCmdDefault. Contains command text that the OLE DB provider understands.

xlCmdSql. Contains an SQL statement.

xlCmdTable. Contains a table name for accessing OLE DB data sources.

You can set the CommandType property only if the value of the QueryType property for the query table or PivotTable cache is xlOLEDBQuery.

If the value of the CommandType property is xlCmdCube, you cannot change this value if there is a PivotTable report associated with the query table.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the CommandType property.

Example

This example sets the command string for the first query table's ODBC data source. The command string is an SQL statement.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 .CommandType = xlCmdSQL
 .CommandText = _
 "Select ProductID From Products Where ProductID < 10"
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Connection Property (Excel)

 Copy code hover
[image]

QueryTable.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains one of the following: OLE DB settings that enable Microsoft Excel to connect to an OLE DB data source; ODBC settings that enable Microsoft Excel to connect to an ODBC data source; a URL that enables Microsoft Excel to connect to a Web data source; the path to and file name of a text file, or the path to and file name of a file that specifies a database or Web query. Read/write Variant.

Syntax

expression .Connection

expression An expression that returns a QueryTable object.

Remarks

Setting the Connection property doesn't immediately initiate the connection to the data source. You must use the Refresh method to make the connection and retrieve the data.

For more information about the connection string syntax, see the Add method of the QueryTables collection.

Alternatively, you may choose to access a data source directly by using the Microsoft ActiveX Data Objects (ADO) library instead.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Connection property.

Example

This example supplies new ODBC connection information for the first query table on the first worksheet.

VBA Copy code Copy code
Worksheets(1).QueryTables(1) _
 .Connection:="ODBC;DSN=96SalesData;UID=Rep21;PWD=NUyHwYQI;"

This example specifies a text file.

VBA Copy code Copy code
Worksheets(1).QueryTables(1) _
 Connection := "TEXT;C:\My Documents\19980331.txt"

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Creator Property (Excel)

 Copy code hover
[image]

QueryTable.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a QueryTable object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

Data from Web queries or text queries is imported as a QueryTable object, while all other external data is imported as a ListObject object. You can use the QueryTable property of the ListObject to access the Creator property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Destination Property (Excel)

 Copy code hover
[image]

QueryTable.Destination Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the QueryTable object. Read-only Range.

Syntax

expression .Destination

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Destination property.

Example

This example scrolls through the active window until the upper-left corner of query table one is in the upper-left corner of the window.

VBA Copy code Copy code
Set d = Worksheets(1).QueryTables(1).Destination
With ActiveWindow
 .ScrollColumn = d.Column
 .ScrollRow = d.Row
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.EditWebPage Property (Excel)

 Copy code hover
[image]

QueryTable.EditWebPage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the web page Uniform Resource Locator (URL) for a web query. Read/write Variant.

Syntax

expression .EditWebPage

expression A variable that represents a QueryTable object.

Remarks

The EditWebPage property returns null if not set. The EditWebPage property is only meaningful if the query type is Web or OLE.

If the EditWebPage is not null then ignore the WebTables property for refreshing. As a result an XML query and the WebTable property refers to the table in the original Web page and should only be used in the edit case to pre-populate the Web Query dialog box.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The EditWebPage property applies only to QueryTable objects.

Example

In this example, Microsoft Excel displays to the user a Web page URL. This example assumes a QueryTable object in cell A1 exists in the active worksheet and that a file called "MyHomepage.htm" exists on the C: drive.

VBA Copy code Copy code
Sub ReturnURL()

 ' Set the EditWebPage property to a source.
 Range("A1").QueryTable.EditWebPage = "C:\MyHomepage.htm"

 ' Display the source to the user.
 MsgBox Range("A1").QueryTable.EditWebPage

End Sub

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.EnableEditing Property (Excel)

 Copy code hover
[image]

QueryTable.EnableEditing Property (Excel)
See also Send feedback

True if the user can edit the specified query table. False if the user can only refresh the query table. Read/write Boolean.

Syntax

expression .EnableEditing

expression A variable that represents a QueryTable object.

Remarks

This example sets query table one so that the user cannot edit it.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the EnableEditing property.

Example

VBA Copy code Copy code
Worksheets(1).QueryTables(1).EnableEditing = False

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.EnableRefresh Property (Excel)

 Copy code hover
[image]

QueryTable.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable cache or query table can be refreshed by the user. The default value is True. Read/write Boolean.

Syntax

expression .EnableRefresh

expression A variable that represents a QueryTable object.

Remarks

The RefreshOnFileOpen property is ignored if the EnableRefresh property is set to False.

For OLAP data sources, setting this property to False disables updates.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the EnableRefresh property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.FetchedRowOverflow Property (Excel)

 Copy code hover
[image]

QueryTable.FetchedRowOverflow Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Read-only Boolean.

Syntax

expression .FetchedRowOverflow

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the FetchedRowOverflow property.

Example

This example refreshes query table one. If the number of rows returned by the query exceeds the number of rows available on the worksheet, an error message is displayed.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Refresh
 If .FetchedRowOverflow Then
 MsgBox "Query too large: please redefine."
 End If
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.FieldNames Property (Excel)

 Copy code hover
[image]

QueryTable.FieldNames Property (Excel)
See also Send feedback

Published: July 16, 2012

True if field names from the data source appear as column headings for the returned data. The default value is True. Read/write Boolean.

Syntax

expression .FieldNames

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The FieldNames property applies only to QueryTable objects.

Example

This example sets query table one so that the field names don't appear in it.

VBA Copy code Copy code
Worksheets(1).QueryTables(1).FieldNames = False

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.FillAdjacentFormulas Property (Excel)

 Copy code hover
[image]

QueryTable.FillAdjacentFormulas Property (Excel)
See also Send feedback

Published: July 16, 2012

True if formulas to the right of the specified query table are automatically updated whenever the query table is refreshed. Read/write Boolean.

Syntax

expression .FillAdjacentFormulas

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The FillAdjacentFormulas property applies only to QueryTable objects.

Example

This example sets query table one so that formulas to the right of it are automatically updated whenever the query table is refreshed.

VBA Copy code Copy code
Sheets("sheet1").QueryTables(1).FillAdjacentFormulas = True

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.ListObject Property (Excel)

 Copy code hover
[image]

QueryTable.ListObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListObject object for the QueryTable object. Read-only ListObject object.

Syntax

expression .ListObject

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The ListObject property applies only to ListObject objects.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.MaintainConnection Property (Excel)

 Copy code hover
[image]

QueryTable.MaintainConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.

Syntax

expression .MaintainConnection

expression A variable that represents a QueryTable object.

Remarks

You can set the MaintainConnection property only if the QueryType property of the query table or PivotTable cache is set to xlOLEDBQuery.

If you anticipate frequent queries to a server, setting this property to True might improve performance by reducing reconnection time. Setting the property to False causes an open connection to be closed.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the MaintainConnection property.

Example

This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A3 on the active worksheet. The example terminates the connection after the initial refresh.

VBA Copy code Copy code
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
 .Connection = _
 "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
 .MaintainConnection = False
 .CreatePivotTable TableDestination:=Range("A3"), _
 TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
 .SmallGrid = False
 .PivotCache.RefreshPeriod = 0
 With .CubeFields("[state]")
 .Orientation = xlColumnField
 .Position = 0
 End With
 With .CubeFields("[Measures].[Count Of au_id]")
 .Orientation = xlDataField
 .Position = 0
 End With
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Name Property (Excel)

 Copy code hover
[image]

QueryTable.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a QueryTable object.

Remarks

The following table shows example values of the Name property and related properties given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property | Value (OLAP data source) | Value (non-OLAP data source)
Caption | Paris | Paris
Name | [Europe].[France].[Paris] (read-only) | Paris
SourceName | [Europe].[France].[Paris] (read-only) | (Same as SQL property value, read-only)
Value | [Europe].[France].[Paris] (read-only) | Paris

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The Name property applies only to QueryTable objects.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Parameters Property (Excel)

 Copy code hover
[image]

QueryTable.Parameters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Parameters collection that represents the query table parameters. Read-only.

Syntax

expression .Parameters

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Parameters property.

Example

This example returns the Parameters collection from an existing parameter query. If the first parameter uses the character data type, the user is instructed to enter characters only in the prompt dialog box.

VBA Copy code Copy code
With Sheets("sheet1").QueryTables(1).Parameters(1)
 If .DataType = xlParamTypeVarChar Then
 .SetParam xlPrompt, "Enter a character only"
 End If
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Parent Property (Excel)

 Copy code hover
[image]

QueryTable.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Parent property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.PostText Property (Excel)

 Copy code hover
[image]

QueryTable.PostText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the string used with the post method of inputting data into a Web server to return data from a Web query. Read/write String.

Syntax

expression .PostText

expression A variable that represents a QueryTable object.

Remarks

Microsoft Excel includes sample Web queries that you can modify by changing the HTML code by using WordPad or another text editor. You can find these samples in the Queries folder where you installed Microsoft Office.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The PostText property applies only to QueryTable objects.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.PreserveColumnInfo Property (Excel)

 Copy code hover
[image]

QueryTable.PreserveColumnInfo Property (Excel)
See also Send feedback

Published: July 16, 2012

True if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is True. Read/write Boolean.

Syntax

expression .PreserveColumnInfo

expression A variable that represents a QueryTable object.

Remarks

This property has an effect only when the query table is using a database connection.

You can set this property to False for compatibility with earlier versions of Microsoft Excel.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the PreserveColumnInfo property.

Example

This example preserves column sorting, filtering, and layout information for compatibility with earlier versions of Microsoft Excel.

VBA Copy code Copy code
Dim cnnConnect As ADODB.Connection
Dim rstRecordset As ADODB.Recordset

Set cnnConnect = New ADODB.Connection
cnnConnect.Open "Provider=SQLOLEDB;" & _
 "Data Source=srvdata;" & _
 "User ID=wadet;Password=4me2no;"

Set rstRecordset = New ADODB.Recordset
rstRecordset.Open _
 Source:="Select Name, Quantity, Price From Products", _
 ActiveConnection:=cnnConnect, _
 CursorType:=adOpenDynamic, _
 LockType:=adLockReadOnly, _
 Options:=adCmdText

With ActiveSheet.QueryTables.Add( _
 Connection:=rstRecordset, _
 Destination:=Range("A1"))
 .Name = "Contact List"
 .FieldNames = True
 .RowNumbers = False
 .FillAdjacentFormulas = False
 .PreserveFormatting = True
 .RefreshOnFileOpen = False
 .BackgroundQuery = True
 .RefreshStyle = xlInsertDeleteCells
 .SavePassword = True
 .SaveData = True
 .AdjustColumnWidth = True
 .RefreshPeriod = 0
 .PreserveColumnInfo = True
 .Refresh BackgroundQuery:=False
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.PreserveFormatting Property (Excel)

 Copy code hover
[image]

QueryTable.PreserveFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True.

Syntax

expression .PreserveFormatting

expression A variable that represents a QueryTable object.

Remarks

For database query tables, the default formatting setting is xlSimple.

The new AutoFormat style is applied to the query table when the table is refreshed. The AutoFormat is reset to None whenever PreserveFormatting is set to False. As a result, any AutoFormat that's set before PreserveFormatting is set to False and before the query table is refreshed doesn't take effect, and the resulting query table has no formatting applied to it.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the PreserveFormatting property.

Example

This example preserves the formatting of the first PivotTable report on worksheet one.

VBA Copy code Copy code
Worksheets(1).PivotTables("Pivot1").PreserveFormatting = True

This example demonstrates how setting PreserveFormatting to False causes the AutoFormat to be set to xlRangeAutoFormatNone instead of the specified xlRangeAutoFormatColor1 format.

VBA Copy code Copy code
With Workbooks(1).Worksheets(1).QueryTables(1)
 .Range.AutoFormat = xlRangeAutoFormatColor1
 .PreserveFormatting = False
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.QueryType Property (Excel)

 Copy code hover
[image]

QueryTable.QueryType Property (Excel)
See also Send feedback

Published: July 16, 2012

Indicates the type of query used by Microsoft Excel to populate the query table. Read-only XlQueryType.

Syntax

expression .QueryType

expression A variable that represents a QueryTable object.

Remarks

XlQueryType can be one of these XlQueryType constants.

xlTextImport. Based on a text file, for query tables only

xlOLEDBQuery. Based on an OLE DB query, including OLAP data sources

xlWebQuery. Based on a Web page, for query tables only

xlADORecordset. Based on an ADO recordset query

xlDAORecordSet. Based on a DAO recordset query, for query tables only

xlODBCQuery. Based on an ODBC data source

You specify the data source in the prefix for the Connection property's value.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the QueryType property.

Example

This example refreshes the first query table on the first worksheet if the table is based on a Web page.

VBA Copy code Copy code
Set qtQtrResults = _
 Workbooks(1).Worksheets(1).QueryTables(1)
With qtQtrResults
 if .QueryType = xlWebQuery Then
 .Refresh
 End If
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Recordset Property (Excel)

 Copy code hover
[image]

QueryTable.Recordset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Recordset object that's used as the data source for the specified query table. Read/write.

Syntax

expression .Recordset

expression A variable that represents a QueryTable object.

Remarks

If this property is used to overwrite an existing recordset, the change takes effect when the Refresh method is run.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RecordSet property.

Example

This example changes the Recordset object used with the first query table on the first worksheet and then refreshes the query table.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 .Recordset = _
 Workbooks.OpenDatabase("c:\Nwind.mdb") _
 .OpenRecordset("employees")
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Refreshing Property (Excel)

 Copy code hover
[image]

QueryTable.Refreshing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if there is a background query in progress for the specified query table. Read only Boolean.

Syntax

expression .Refreshing

expression A variable that represents a QueryTable object.

Remarks

Use the CancelRefresh method to cancel background queries.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Refreshing property.

Example

This example displays a message box if there is a background query in progress for query table one.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 If .Refreshing Then
 MsgBox "Query is currently refreshing: please wait"
 Else
 .Refresh BackgroundQuery := False
 .ResultRange.Select
 End If
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.RefreshOnFileOpen Property (Excel)

 Copy code hover
[image]

QueryTable.RefreshOnFileOpen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the PivotTable cache or query table is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.

Syntax

expression .RefreshOnFileOpen

expression A variable that represents a QueryTable object.

Remarks

Query tables and PivotTable reports are not automatically refreshed when you open the workbook by using the Open method in Visual Basic. Use the Refresh method to refresh the data after the workbook is open.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RefreshOnFileOpen property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.RefreshPeriod Property (Excel)

 Copy code hover
[image]

QueryTable.RefreshPeriod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between refreshes. Read/write Long.

Syntax

expression .RefreshPeriod

expression A variable that represents a QueryTable object.

Remarks

Setting the period to 0 (zero) disables automatic timed refreshes and is equivalent to setting this property to Null.

The value of the RefreshPeriod property can be an integer from 0 through 32767.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RefreshPeriod property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.RefreshStyle Property (Excel)

 Copy code hover
[image]

QueryTable.RefreshStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a recordset returned by a query. Read/write XlCellInsertionMode.

Syntax

expression .RefreshStyle

expression A variable that represents a QueryTable object.

Remarks

XlCellInsertionMode can be one of these XlCellInsertionMode constants.

xlInsertDeleteCells Partial rows are inserted or deleted to match the exact number of rows required for the new recordset.

xlOverwriteCells No new cells or rows are added to the worksheet. Data in surrounding cells is overwritten to accommodate any overflow.

xlInsertEntireRows Entire rows are inserted, if necessary, to accommodate any overflow. No cells or rows are deleted from the worksheet.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RefreshStyle property.

Example

This example adds a query table to Sheet1. The RefreshStyle property adds rows to the worksheet as needed, to hold the data results.

VBA Copy code Copy code
Dim qt As QueryTable
Set qt = Sheets("sheet1").QueryTables _
 .Add(Connection:="Finder;c:\myfile.dqy", _
 Destination:=Range("sheet1!a1"))
With qt
 .RefreshStyle = xlInsertEntireRows
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.ResultRange Property (Excel)

 Copy code hover
[image]

QueryTable.ResultRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the area of the worksheet occupied by the specified query table. Read-only.

Syntax

expression .ResultRange

expression A variable that represents a QueryTable object.

Remarks

The range doesn't include the field name row or the row number column.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the ResultRange property.

Example

This example sums the data in the first column of query table one. The sum of the first column is displayed below the data range.

VBA Copy code Copy code
Set c1 = Sheets("sheet1").QueryTables(1).ResultRange.Columns(1)
c1.Name = "Column1"
c1.End(xlDown).Offset(2, 0).Formula = "=sum(Column1)"

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.RobustConnect Property (Excel)

 Copy code hover
[image]

QueryTable.RobustConnect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how the query table connects to its data source. Read/write XlRobustConnect.

Syntax

expression .RobustConnect

expression A variable that represents a QueryTable object.

Remarks

XlRobustConnect can be one of these XlRobustConnect constants.

xlAlways . The query table always uses external source information (as defined by the SourceConnectionFile or SourceDataFile property) to reconnect.

xlAsRequired . The query table uses external source information to reconnect, using the Connection property.

xlNever . The query table never uses source information to reconnect.

If you import data by using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data by using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RobustConnect property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.RowNumbers Property (Excel)

 Copy code hover
[image]

QueryTable.RowNumbers Property (Excel)
See also Send feedback

Published: July 16, 2012

True if row numbers are added as the first column of the specified query table. Read/write Boolean.

Syntax

expression .RowNumbers

expression A variable that represents a QueryTable object.

Remarks

Setting this property to True doesn't immediately cause row numbers to appear. The row numbers appear the next time the query table is refreshed, and they're reconfigured every time the query table is refreshed.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the RowNumbers property.

Example

This example adds row numbers and field names to the query table.

VBA Copy code Copy code
With Worksheets(1).QueryTables("ExternalData1")
 .RowNumbers = True
 .FieldNames = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.SaveData Property (Excel)

 Copy code hover
[image]

QueryTable.SaveData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data for the QueryTable report is saved with the workbook. False if only the report definition is saved. Read/write Boolean.

Syntax

expression .SaveData

expression A variable that represents a QueryTable object.

Remarks

For OLAP data sources, this property is always set to False.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the SaveData property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.SavePassword Property (Excel)

 Copy code hover
[image]

QueryTable.SavePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if password information in an ODBC connection string is saved with the specified query. False if the password is removed. Read/write Boolean.

Syntax

expression .SavePassword

expression A variable that represents a QueryTable object.

Remarks

This property is used in both ODBC and OLEDB queries, and by both PivotTables and QueryTables.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the SavePassword property.

This property is ignored if the ListObject is connected to a SharePoint list.

Example

This example causes password information to be removed from the ODBC connection string whenever query table one is saved.

VBA Copy code Copy code
Worksheets(1).QueryTables(1).SavePassword = False

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Sort Property (Excel)

 Copy code hover
[image]

QueryTable.Sort Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sort criteria for the query table range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Sort

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from Web queries or text queries is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from Web queries or text queries must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the Sort property.

Example

This example refreshes the query table gets the sort criteria.

VBA Copy code Copy code
QueryTable.Refresh

Dim var As Sort
Set var = QueryTable.Sort

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.SourceConnectionFile Property (Excel)

 Copy code hover
[image]

QueryTable.SourceConnectionFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the QueryTable. Read/write.

Syntax

expression .SourceConnectionFile

expression A variable that represents a QueryTable object.

Remarks

Data from Web queries or text queries is imported as a QueryTable object, while all other external data is imported as a ListObject object. You can use the QueryTable property of the ListObject to access the SourceConnectionFile property.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the SourceConnectionFile property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.SourceDataFile Property (Excel)

 Copy code hover
[image]

QueryTable.SourceDataFile Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that indicates the source data file for a query table.

Syntax

expression .SourceDataFile

expression A variable that represents a QueryTable object.

Remarks

For file-based data sources (e.g. Access), the SourceDataFile property contains a fully qualified path to the source data file. It is set to Null for server-based data sources (e.g. SQL Server). The SourceDataFile property is set to Null if the Connection property is changed programmatically.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the SourceDataFile property.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileColumnDataTypes Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileColumnDataTypes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you are importing into a query table. The default constant for each column is xlGeneral. Read/write Variant.

Syntax

expression .TextFileColumnDataTypes

expression A variable that represents a QueryTable object.

Remarks

Use the xlColumnDataType constants listed in the following table to specify the column data types used or the actions taken during the data import.

Constant | Description
xlGeneralFormat | General
xlTextFormat | Text
xlSkipColumn | Skip column
xlDMYFormat | Day-Month-Year date format
xlDYMFormat | Day-Year-Month date format
xlEMDFormat | EMD date
xlMDYFormat | Month-Day-Year date format
xlMYDFormat | Month-Year-Day date format
xlYDMFormat | Year-Day-Month date format
xlYMDFormat | Year-Month-Day date format

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you specify more elements in the array that there are columns, those values are ignored.

Use xlEMDFormat only if Chinese (Taiwan) language support is installed and selected. The xlEMDFormat constant specifies that Chinese (Taiwan) era dates are used.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileColumnDataTypes property applies only to QueryTable objects.

Example

This example imports a fixed-width text file into a new query table on the first worksheet in the first workbook. The first column in the text file is five characters wide and is imported as text. The second column is four characters wide and is skipped. The remainder of the text file is imported into the third column and has the General format applied to it.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1, 1))
With qtQtrResults
 .TextFileParseType = xlFixedWidth
 .TextFileFixedColumnWidths = Array(5, 4)
 .TextFileColumnDataTypes = _
 Array(xlTextFormat, xlSkipColumn, xlGeneralFormat)
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileCommaDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileCommaDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/write Boolean.

Syntax

expression .TextFileCommaDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlDelimited.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileCommaDelimiter property applies only to QueryTable objects.

Example

This example sets the comma to be the delimiter in the query table on the first worksheet in the first workbook, and then it refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1, 1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileCommaDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileConsecutiveDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileConsecutiveDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.

Syntax

expression .TextFileConsecutiveDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property is only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlDelimited.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileConsecutiveDelimiter property applies only to QueryTable objects.

Example

This example sets the space character to be the delimiter in the query table on the first worksheet in the first workbook, and then it refreshes the query table. Consecutive spaces are treated as a single delimiter.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1, 1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileSpaceDelimiter = True
 .TextFileConsecutiveDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileDecimalSeparator Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileDecimalSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/write String.

Syntax

expression .TextFileDecimalSeparator

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), when the file contains decimal and thousands separators that are different from those used on the computer, due to a different language setting being used.

The following table shows the results when you import text into Microsoft Excel using various separators. Numeric results are displayed in the rightmost column.

System decimal separator | System thousands separator | TextFileDecimalSeparator value | TextFileThousandsSeparator value | Text imported | Cell value (data type)
Period | Comma | Comma | Period | 123.123,45 | 123,123.45 (numeric)
Period | Comma | Comma | Comma | 123.123,45 | 123.123,45 (text)
Comma | Period | Comma | Period | 123,123.45 | 123,123.45 (numeric)
Period | Comma | Period | Comma | 123 123.45 | 123 123.45 (text)
Period | Comma | Period | Space | 123 123.45 | 123,123.45 (numeric)

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileDecimalSeparator property applies only to QueryTable objects.

Example

This example saves the original decimal separator and sets it to a comma for the first query table on Sheet1, in preparation for importing a French text file (for example) into the U.S. English version of Microsoft Excel.

VBA Copy code Copy code
strDecSep = Worksheets("Sheet1").QueryTables(1) _
 .TextFileDecimalSeparator
Worksheets("Sheet1").QueryTables(1) _
 .TextFileDecimalSeparator = ","

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileFixedColumnWidths Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileFixedColumnWidths Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/write Variant.

Syntax

expression .TextFileFixedColumnWidths

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlFixedWidth.

You must specify a valid, nonnegative column width. If you specify columns that exceed the width of the text file, those values are ignored. If the width of the text file is greater than the total width of columns you specify, the balance of the text file is imported into an additional column.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileFixedColumnWidths property applies only to QueryTable objects.

Example

This example imports a fixed-width text file into a new query table on the first worksheet in the first workbook. The first column in the text file is five characters wide and is imported as text. The second column is four characters wide and is skipped. The remainder of the text file is imported into the third column and has the General format applied to it.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1, 1))
With qtQtrResults
 .TextFileParseType = xlFixedWidth
 .TextFileFixedColumnWidths = Array(5, 4)
 .TextFileColumnDataTypes = _
 Array(xlTextFormat, xlSkipColumn, xlGeneralFormat)
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileOtherDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileOtherDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/write String.

Syntax

expression .TextFileOtherDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlDelimited.

If you specify more than one character in the string, only the first character is used.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileOtherDelimiter property applies only to QueryTable objects.

Example

This example sets the pound character (#) to be the delimiter for the query table on the first worksheet in the first workbook, and then it refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileOtherDelimiter = "#"
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileParseType Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileParseType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the column format for the data in the text file that you're importing into a query table. Read/write XlTextParsingType.

Syntax

expression .TextFileParseType

expression A variable that represents a QueryTable object.

Remarks

XlTextParsingType can be one of these XlTextParsingType constants.

xlFixedWidth. Indicates that the data in the file is arranged in columns of fixed widths.

xlDelimited default. Iindicates the file is delimited by delimiter characters

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileParseType property applies only to QueryTable objects.

Example

This example imports a fixed-width text file into a new query table on the first worksheet in the first workbook. The first column in the text file is five characters wide and is imported as text. The second column is four characters wide and is skipped. The remainder of the text file is imported into the third column and has the General format applied to it.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1, 1))
With qtQtrResults
 .TextFileParseType = xlFixedWidth
 .TextFileFixedColumnWidths = Array(5, 4)
 .TextFileColumnDataTypes = _
 Array(xlTextFormat, xlSkipColumn, xlGeneralFormat)
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFilePlatform Property (Excel)

 Copy code hover
[image]

QueryTable.TextFilePlatform Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform.

Syntax

expression .TextFilePlatform

expression A variable that represents a QueryTable object.

Remarks

The default value is the current setting of the File Origin option in the Text File Import Wizard.

XlPlatform can be one of these XlPlatform constants.

xlMacintosh

xlMSDOS

xlWindows

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFilePlatform property applies only to QueryTable objects.

Example

This example imports an MS-DOS text file into the query table on the first worksheet in the first workbook, and then it refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFilePlatform = xlMSDOS
 .TextFileParseType = xlDelimited
 .TextFileTabDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFilePromptOnRefresh Property (Excel)

 Copy code hover
[image]

QueryTable.TextFilePromptOnRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/write Boolean.

Syntax

expression .TextFilePromptOnRefresh

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If the value of this property is True, the dialog box doesn't appear the first time a query table is refreshed.

The default value is True in the user interface.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFilePromptOnRefresh property applies only to QueryTable objects.

Example

This example prompts the user for the name of the text file whenever the query table on the first worksheet in the first workbook is refreshed.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFilePromptOnRefresh = True
 .TextFileTabDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileSemicolonDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileSemicolonDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextFileParseType property is xlDelimited. The default value is False. Read/write Boolean.

Syntax

expression .TextFileSemicolonDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileSemicolonDelimiter property applies only to QueryTable objects.

Example

This example sets the semicolon to be the delimiter in the query table on the first worksheet in the first workbook and then refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileSemicolonDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileSpaceDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileSpaceDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.

Syntax

expression .TextFileSpaceDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlDelimited.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileSpaceDelimiter property applies only to QueryTable objects.

Example

This example sets the space character to be the delimiter in the query table on the first worksheet in the first workbook and then refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileSpaceDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileStartRow Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileStartRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/write Long.

Syntax

expression .TextFileStartRow

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileStartRow property applies only to QueryTable objects.

Example

This example sets row 5 as the starting row for text parsing in the query table on the first worksheet in the first workbook, and then it refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileStartRow = 5
 .TextFileTabDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileTabDelimiter Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileTabDelimiter Property (Excel)
See also Send feedback

True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/write Boolean.

Syntax

expression .TextFileTabDelimiter

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport), and only if the value of the TextFileParseType property is xlDelimited.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileTabDelimiter property applies only to QueryTable objects.

Example

This example sets the tab character to be the delimiter in the query table on the first worksheet in the first workbook, and then it refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileTabDelimiter = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileTextQualifier Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileTextQualifier Property (Excel)
See also Send feedback

Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/write XlTextQualifier.

Syntax

expression .TextFileTextQualifier

expression A variable that represents a QueryTable object.

Remarks

XlTextQualifier can be one of these XlTextQualifier constants.

xlTextQualifierNone

xlTextQualifierDoubleQuote default

xlTextQualifierSingleQuote

Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileTextQualifier property applies only to QueryTable objects.

Example

This example sets the single quotation mark character as the text qualifier for the query table on the first worksheet in the first workbook.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .TextFileParseType = xlDelimited
 .TextFileTextQualifier = xlTextQualifierSingleQuote
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileThousandsSeparator Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileThousandsSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the thousands separator character thatMicrosoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/write String.

Syntax

expression .TextFileThousandsSeparator

expression A variable that represents a QueryTable object.

Remarks

Use this property only when your query table is based on data from a text file (with the QueryTable property set to xlTextImport), especially when the file contains decimal and thousands separators that are different from those used on the computer, due to a different language setting being used.

The following table shows the results when you import text into Microsoft Excel using various separators. Numeric results are displayed in the rightmost column.

System decimal separator | System thousands separator | TextFileDecimalSeparator value | TextFileThousandsSeparator value | Text imported | Cell value (data type)
Period | Comma | Comma | Period | 123.123,45 | 123,123.45 (numeric)
Period | Comma | Comma | Comma | 123.123,45 | 123.123,45 (text)
Comma | Period | Comma | Period | 123,123.45 | 123,123.45 (numeric)
Period | Comma | Period | Comma | 123 123.45 | 123 123.45 (text)
Period | Comma | Period | Space | 123 123.45 | 123,123.45 (numeric)

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileThousandsSeparator property applies only to QueryTable objects.

Example

This example saves the original thousands separator and sets it to a period for the first query table on Sheet1, in preparation for importing a French text file (for example) into the U.S. English version of Microsoft Excel.

VBA Copy code Copy code
strDecSep = Worksheets("Sheet1").QueryTables(1) _
 .TextFileThousandsSeparator
Worksheets("Sheet1").QueryTables(1) _
 .TextFileThousandsSeparator = "."

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileTrailingMinusNumbers Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileTrailingMinusNumbers Property (Excel)
See also Send feedback

Published: July 16, 2012

True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/write Boolean.

Syntax

expression .TextFileTrailingMinusNumbers

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileTrailingMinusNumbers property applies only to QueryTable objects.

Example

In this example, Microsoft Excel determines the setting for cell A1, treating numbers imported as text that begin with a "-" symbol. This example assumes a QueryTable object exists on the active worksheet.

VBA Copy code Copy code
Sub CheckQueryTableSetting()

 ' Determine setting for TextFileTrailingMinusNumbers
 If Range("A1").QueryTable.TextFileTrailingMinusNumbers = True Then
 MsgBox "Numbers imported as text that begin with a '-' symbol " & _
 "will be treated as a negative symbol."
 Else
 MsgBox "Numbers imported as text that begin with a '-' symbol " & _
 "will not be treated as a negative symbol."
 End If

End Sub

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.TextFileVisualLayout Property (Excel)

 Copy code hover
[image]

QueryTable.TextFileVisualLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlTextVisualLayoutType enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left.

Syntax

expression .TextFileVisualLayout

expression A variable that represents a QueryTable object.

Remarks

XlTextVisualLayoutType can be one of the following XlTextVisualLayoutType constants.

xlTextVisualLTR

xlTextVisualRTL

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The TextFileVisualLayout property applies only to QueryTable objects.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebConsecutiveDelimitersAsOne Property (Excel)

 Copy code hover
[image]

QueryTable.WebConsecutiveDelimitersAsOne Property (Excel)
See also Send feedback

True if consecutive delimiters are treated as a single delimiter when you import data from HTML <PRE> tags in a Web page into a query table, and if the data is to be parsed into columns. False if you want to treat consecutive delimiters as multiple delimiters. The default value is True. Read/write Boolean.

Syntax

expression .WebConsecutiveDelimitersAsOne

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery, the query returns an HTML document, and the WebPreFormattedTextToColumns property is set to True.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebConsecutiveDelimitersAsOne property applies only to QueryTable objects.

Example

This example sets the space character to be the delimiter in the query table on the first worksheet in the first workbook, and then it refreshes the query table. Consecutive spaces are treated as a single space.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebConsecutiveDelimitersAsOne = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebDisableDateRecognition Property (Excel)

 Copy code hover
[image]

QueryTable.WebDisableDateRecognition Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data that resembles dates is parsed as text when you import a Web page into a query table. False if date recognition is used. The default value is False. Read/write Boolean.

Syntax

expression .WebDisableDateRecognition

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery and the query returns an HTML document.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebDisableDateRecognition property applies only to QueryTable objects.

Example

This example turns off date recognition so that Web page data that resembles dates is imported as text. The example then refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebDisableDateRecognition = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebDisableRedirections Property (Excel)

 Copy code hover
[image]

QueryTable.WebDisableRedirections Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Web query redirections are disabled for a QueryTable object. The default value is False. Read/write Boolean.

Syntax

expression .WebDisableRedirections

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebDisableRedirections property applies only to QueryTable objects.

Example

In this example, Microsoft Excel determines the settings of Web query redirections for the first worksheet in the workbook. This example assumes a QueryTable object exists on the first worksheet, otherwise a run-time error will occur.

VBA Copy code Copy code
Sub CheckWebQuerySetting()
 Dim wksSheet As Worksheet
 Set wksSheet = Application.ActiveSheet
 MsgBox wksSheet.QueryTables(1).WebDisableRedirections
End Sub

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebFormatting Property (Excel)

 Copy code hover
[image]

QueryTable.WebFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that determines how much formatting from a Web page, if any, is applied when you import the page into a query table. Read/write XlWebFormatting.

Syntax

expression .WebFormatting

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery and the query returns an HTML document.

XlWebFormatting can be one of these XlWebFormatting constants.

xlWebFormattingAll

xlWebFormattingRTF

xlWebFormattingNone default

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebFormatting property applies only to QueryTable objects.

Example

This example adds a new Web query table to the first worksheet in the first workbook, imports all of the Web page formatting applied to the data, and then refreshes the query table.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebFormatting = xlAll
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebPreFormattedTextToColumns Property (Excel)

 Copy code hover
[image]

QueryTable.WebPreFormattedTextToColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether data contained within HTML <PRE> tags in the Web page is parsed into columns when you import the page into a query table. The default is True. Read/write Boolean.

Syntax

expression .WebPreFormattedTextToColumns

expression A variable that represents a QueryTable object.

Remarks

This property is used only when the QueryType property of the query table is xlWebQuery and the query returns a HTML document.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebPreFormattedTextToColumns property applies only to QueryTable objects.

Example

This example adds a new Web query table to the first worksheet in the first workbook. Note that the example doesn't parse into columns any data located between the HTML <PRE> tags.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebFormatting = xlNone
 .WebPreFormattedTextToColumns = False
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebSelectionType Property (Excel)

 Copy code hover
[image]

QueryTable.WebSelectionType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that determines whether an entire Web page, all tables on the Web page, or only specific tables on the Web page are imported into a query table. Read/write XlWebSelectionType .

Syntax

expression .WebSelectionType

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery and the query returns an HTML document.

If the value of this property is xlSpecifiedTables, you can use the WebTables property to specify the tables to be imported.

XlWebSelectionType can be one of these XlWebSelectionType constants.

xlEntirePage

xlAllTables default

xlSpecifiedTables

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebSelectionType property applies only to QueryTable objects.

Example

This example adds a new Web query table to the first worksheet in the first workbook and then imports data from the first and second tables in the Web page.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebFormatting = xlNone
 .WebSelectionType = xlSpecifiedTables
 .WebTables = "1,2"
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebSingleBlockTextImport Property (Excel)

 Copy code hover
[image]

QueryTable.WebSingleBlockTextImport Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data from the HTML <PRE> tags in the specified Web page is processed all at once when you import the page into a query table. False if the data is imported in blocks of contiguous rows so that header rows will be recognized as such. The default value is False. Read/write Boolean.

Syntax

expression .WebSingleBlockTextImport

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery and the query returns an HTML document.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebSingleBlockTextImport property applies only to QueryTable objects.

Example

This example adds a new Web query table to the first worksheet in the first workbook and and then imports all of the HTML <PRE> tag data all at once.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebSingleBlockTextImport = True
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WebTables Property (Excel)

 Copy code hover
[image]

QueryTable.WebTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a comma-delimited list of table names or table index numbers when you import a Web page into a query table. Read/write String.

Syntax

expression .WebTables

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery, the query returns an HTML document, and the value of the WebSelectionType property is xlSpecifiedTables.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebTables property applies only to QueryTable objects.

Example

This example adds a new Web query table to the first worksheet in the first workbook and then imports data from the first and second tables in the Web page.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
 .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
 Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
 .WebFormatting = xlNone
 .WebSelectionType = xlSpecifiedTables
 .WebTables = "1,2"
 .Refresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.WorkbookConnection Property (Excel)

 Copy code hover
[image]

QueryTable.WorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the WorkbookConnection object that the query table uses. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .WorkbookConnection

expression A variable that represents a QueryTable object.

Remarks

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WorkbookConnection property applies only to QueryTable objects.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable Methods (Excel)

 Copy code hover
[image]

QueryTable Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CancelRefresh | Cancels all background queries for the specified query table. Use the Refreshing property to determine whether a background query is currently in progress.
Delete | Deletes the object.
Refresh | Updates an external data range (QueryTable).
ResetTimer | Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.
SaveAsODC | Saves the QueryTable cache source as an Microsoft Office Data Connection file.


QueryTable.CancelRefresh Method (Excel)

 Copy code hover
[image]

QueryTable.CancelRefresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Cancels all background queries for the specified query table. Use the Refreshing property to determine whether a background query is currently in progress.

Syntax

expression .CancelRefresh

expression A variable that represents a QueryTable object.

Example

This example cancels a query table refresh operation.

VBA Copy code Copy code
With Worksheets(1).QueryTables(1)
 If .Refreshing Then .CancelRefresh
End With

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Delete Method (Excel)

 Copy code hover
[image]

QueryTable.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a QueryTable object.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.Refresh Method (Excel)

 Copy code hover
[image]

QueryTable.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Updates an external data range (QueryTable).

Syntax

expression .Refresh(BackgroundQuery)

expression A variable that represents a QueryTable object.

Parameters

Name | Required/Optional | Data Type | Description
BackgroundQuery | Optional | Variant | Used only with QueryTables that are based on the results of a SQL query. True to return control to the procedure as soon as a database connection is made and the query is submitted. The QueryTable is updated in the background. False to return control to the procedure only after all data has been fetched to the worksheet. If this argument isn't specified, the setting of the BackgroundQuery property determines the query mode.

Return Value

Boolean

Remarks

The following remarks apply to QueryTable objects that are based on the results of a SQL query.

The Refresh method causes Microsoft Excel to connect to the data source of the QueryTable object, execute the SQL query, and return data to the range that is based on the QueryTable object. Unless this method is called, the QueryTable object doesn't communicate with the data source.

When making the connection to the OLE DB or ODBC data source, Microsoft Excel uses the connection string specified by the Connection property. If the specified connection string is missing required values, dialog boxes will be displayed to prompt the user for the required information. If the DisplayAlerts property is False, dialog boxes aren't displayed and the Refresh method fails with the Insufficient Connection Information exception.

After Microsoft Excel makes a successful connection, it stores the completed connection string so that prompts won't be displayed for subsequent calls to the Refresh method during the same editing session. You can obtain the completed connection string by examining the value of the Connection property.

After the database connection is made, the SQL query is validated. If the query isn't valid, the Refresh method fails with the SQL Syntax Error exception.

If the query requires parameters, the Parameters collection must be initialized with parameter binding information before the Refresh method is called. If not enough parameters have been bound, the Refresh method fails with the Parameter Error exception. If parameters are set to prompt for their values, dialog boxes are displayed to the user regardless of the setting of the DisplayAlerts property. If the user cancels a parameter dialog box, the Refresh method halts and returns False. If extra parameters are bound with the Parameters collection, these extra parameters are ignored.

The Refresh method returns True if the query is successfully completed or started; it returns False if the user cancels a connection or parameter dialog box.

To see whether the number of fetched rows exceeded the number of available rows on the worksheet, examine the FetchedRowOverflow property. This property is initialized every time the Refresh method is called.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.ResetTimer Method (Excel)

 Copy code hover
[image]

QueryTable.ResetTimer Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets the refresh timer for the specified query table or PivotTable report to the last interval you set using the RefreshPeriod property.

Syntax

expression .ResetTimer

expression A variable that represents a QueryTable object.

Example

This example resets the refresh timer for the first query table on the active worksheet.

VBA Copy code Copy code
ActiveSheet.QueryTables(1).ResetTimer

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.SaveAsODC Method (Excel)

 Copy code hover
[image]

QueryTable.SaveAsODC Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the QueryTable cache source as an Microsoft Office Data Connection file.

Syntax

expression .SaveAsODC(ODCFileName, Description, Keywords)

expression A variable that represents a QueryTable object.

Parameters

Name | Required/Optional | Data Type | Description
ODCFileName | Required | String | Location to save the file.
Description | Optional | Variant | Description that will be saved in the file.
Keywords | Optional | Variant | Space-separated keywords that can be used to search for this file.

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable Events (Excel)

 Copy code hover
[image]

QueryTable Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterRefresh | Occurs after a query is completed or canceled.
BeforeRefresh | Occurs before any refreshes of the query table. This includes refreshes resulting from calling the Refresh method, from the user's actions in the product, and from opening the workbook containing the query table.


QueryTable.AfterRefresh Event (Excel)

 Copy code hover
[image]

QueryTable.AfterRefresh Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a query is completed or canceled.

Syntax

expression .AfterRefresh(Success)

expression A variable that represents a QueryTable object.

Parameters

Name | Required/Optional | Data Type | Description
Success | Required | Boolean | True if the query was completed successfully.

Return Value

Nothing

Example

This example uses the Success argument to determine which section of code to run.

VBA Copy code Copy code
Private Sub QueryTable_AfterRefresh(Success As Boolean)
 If Success Then
 ' Query completed successfully
 Else
 ' Query failed or was cancelled
 End If
End Sub

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTable.BeforeRefresh Event (Excel)

 Copy code hover
[image]

QueryTable.BeforeRefresh Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before any refreshes of the query table. This includes refreshes resulting from calling the Refresh method, from the user's actions in the product, and from opening the workbook containing the query table.

Syntax

expression .BeforeRefresh(Cancel)

expression A variable that represents a QueryTable object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the refresh doesn't occur when the procedure is finished.

Return Value

Nothing

Example

This example runs before the query table is refreshed.

VBA Copy code Copy code
Private Sub QueryTable_BeforeRefresh(Cancel As Boolean)
 a = MsgBox("Refresh Now?", vbYesNoCancel)
 If a = vbNo Then Cancel = True
 MsgBox Cancel
End Sub

See also

Concepts

QueryTable Object

Other resources

QueryTable Object Members


QueryTables Object (Excel)

 Copy code hover
[image]

QueryTables Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of QueryTable objects.

Remarks

Each QueryTable object represents a worksheet table built from data returned from an external data source.

Example

Use the QueryTables property to return the QueryTables collection. The following example displays the number of query tables on the active worksheet.

VBA Copy code Copy code
MsgBox ActiveSheet.QueryTables.Count

Use the Add method to create a new query table and add it to the QueryTables collection. The following example creates a new query table.

VBA Copy code Copy code
Dim qt As QueryTable
sqlstring = "select 96Sales.totals from 96Sales where profit < 5"
connstring = _
 "ODBC;DSN=96SalesData;UID=Rep21;PWD=NUyHwYQI;Database=96Sales"
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
 Destination:=Range("B1"), Sql:=sqlstring)
 .Refresh
End With

See also

Concepts

Excel Object Model Reference

Other resources

QueryTables Object Members


QueryTables Members (Excel)

 Copy code hover
[image]

QueryTables Members (Excel)
Send feedback

Published: July 16, 2012

A collection of QueryTable objects.

Methods

Name | Description
Add | Creates a new query table.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


QueryTables Properties (Excel)

 Copy code hover
[image]

QueryTables Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


QueryTables.Application Property (Excel)

 Copy code hover
[image]

QueryTables.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a QueryTables object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QueryTables.Count Property (Excel)

 Copy code hover
[image]

QueryTables.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a QueryTables object.

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QueryTables.Creator Property (Excel)

 Copy code hover
[image]

QueryTables.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a QueryTables object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QueryTables.Parent Property (Excel)

 Copy code hover
[image]

QueryTables.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a QueryTables object.

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QueryTables Methods (Excel)

 Copy code hover
[image]

QueryTables Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new query table.
Item | Returns a single object from a collection.


QueryTables.Add Method (Excel)

 Copy code hover
[image]

QueryTables.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new query table.

Syntax

expression .Add(Connection, Destination, Sql)

expression A variable that represents a QueryTables object.

Parameters

Name

Required/Optional

Data Type

Description

Connection

Required

Variant

The data source for the query table. Can be one of the following:

  • A string containing an OLE DB or ODBC connection string. The ODBC connection string has the form "ODBC;<connection string>".

  • A QueryTable object from which the query information is initially copied, including the connection string and the SQL text, but not including the Destination range. Specifying a QueryTable object causes the Sql argument to be ignored.

  • An ADO or DAO Recordset object. Data is read from the ADO or DAO recordset. Microsoft Excel retains the recordset until the query table is deleted or the connection is changed. The resulting query table cannot be edited.

  • A Web query. A string in the form "URL;<url>", where "URL;" is required but not localized and the rest of the string is used for the URL of the Web query.

  • Data Finder. A string in the form "FINDER;<data finder file path>" where "FINDER;" is required but not localized. The rest of the string is the path and file name of a Data Finder file (*.dqy or *.iqy). The file is read when the Add method is run; subsequent calls to the Connection property of the query table will return strings beginning with "ODBC;" or "URL;" as appropriate.

  • A text file. A string in the form "TEXT;<text file path and name>", where TEXT is required but not localized.

Destination

Required

Range

The cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the QueryTables object specified by expression.

Sql

Optional

Variant

The SQL query string to be run on the ODBC data source. This argument is optional when you're using an ODBC data source (if you don't specify it here, you should set it by using the Sql property of the query table before the table is refreshed). You cannot use this argument when a QueryTable object, text file, or ADO or DAO Recordset object is specified as the data source.

Return Value

A QueryTable object that represents the new query table.

Remarks

A query created by this method isn't run until the Refresh method is called.

Example

This example creates a query table based on an ADO recordset. The example preserves the existing column sorting and filtering settings and layout information for backward compatibility.

VBA Copy code Copy code
Dim cnnConnect As ADODB.Connection
Dim rstRecordset As ADODB.Recordset

Set cnnConnect = New ADODB.Connection
cnnConnect.Open "Provider=SQLOLEDB;" & _
    "Data Source=srvdata;" & _
    "User ID=testac;Password=4me2no;"

Set rstRecordset = New ADODB.Recordset
rstRecordset.Open _
    Source:="Select Name, Quantity, Price From Products", _
    ActiveConnection:=cnnConnect, _
    CursorType:=adOpenDynamic, _
    LockType:=adLockReadOnly, _
    Options:=adCmdText

With ActiveSheet.QueryTables.Add( _
        Connection:=rstRecordset, _
        Destination:=Range("A1"))
    .Name = "Contact List"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = True
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .Refresh BackgroundQuery:=False
End With

This example imports a fixed width text file into a new query table. The first column in the text file is five characters wide and is imported as text. The second column is four characters wide and is skipped. The remainder of the text file is imported into the third column and has the General format applied to it.

VBA Copy code Copy code
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables.Add( _
    Connection := "TEXT;C:\My Documents\19980331.txt",
    Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
    .TextFileParsingType = xlFixedWidth
    .TextFileFixedColumnWidths := Array(5,4)
    .TextFileColumnDataTypes := _
        Array(xlTextFormat, xlSkipColumn, xlGeneralFormat)
    .Refresh
End With

This example creates a new query table on the active worksheet.

VBA Copy code Copy code
sqlstring = "select 96Sales.totals from 96Sales where profit < 5"
connstring = _
    "ODBC;DSN=96SalesData;UID=Rep21;PWD=NUyHwYQI;Database=96Sales"
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
        Destination:=Range("B1"), Sql:=sqlstring)
    .Refresh
End With

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QueryTables.Item Method (Excel)

 Copy code hover
[image]

QueryTables.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a QueryTables object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A QueryTable object contained by the collection.

Example

This example sets a query table so that formulas to the right of the query table are automatically updated whenever it's refreshed.

VBA Copy code Copy code
Sheets("sheet1").QueryTables.Item(1).FillAdjacentFormulas = True

See also

Concepts

QueryTables Object

Other resources

QueryTables Object Members


QuickAnalysis Object (Excel)

 Copy code hover
[image]

QuickAnalysis Object (Excel)
See also Send feedback

Published: July 16, 2012

Object that enables single-click access to data analysis features such as formulas, conditional formatting, sparklines, tables, charts, and PivotTables.

Version information

Version Added: Excel 2013

Example

This sample illustrates using the QuickAnalysis.Hide Method (Excel) method of the QuickAnalysis object. In this example, the 1 argument specifies that, if displayed, the Conditional Formatting & Sparklines callouts are hidden.

VBA Copy code Copy code
ActiveWorksheet.QuickAnalysis.Hide(1)

See also

Other resources

QuickAnalysis Object Members


QuickAnalysis Members (Excel)

 Copy code hover
[image]

QuickAnalysis Members (Excel)
Send feedback

Published: July 16, 2012

Object that enables single-click access to data analysis features such as formulas, conditional formatting, sparklines, tables, charts, and PivotTables.

Methods

Name | Description
Hide | Hides specific members of the Analysis Lens user interface.
Show | Displays specific members of the Analysis Lens user interface.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified QuickAnalysis Object (Excel) object. Read-only.


QuickAnalysis Properties (Excel)

 Copy code hover
[image]

QuickAnalysis Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified QuickAnalysis Object (Excel) object. Read-only.


QuickAnalysis.Application Property (Excel)

 Copy code hover
[image]

QuickAnalysis.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a QuickAnalysis Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

QuickAnalysis Object Members
QuickAnalysis Object


QuickAnalysis.Creator Property (Excel)

 Copy code hover
[image]

QuickAnalysis.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a QuickAnalysis Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

QuickAnalysis Object Members
QuickAnalysis Object


QuickAnalysis.Parent Property (Excel)

 Copy code hover
[image]

QuickAnalysis.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified QuickAnalysis Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a QuickAnalysis Object (Excel) object.

Property value

OBJECT

See also

Other resources

QuickAnalysis Object Members
QuickAnalysis Object


QuickAnalysis Methods (Excel)

 Copy code hover
[image]

QuickAnalysis Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Hide | Hides specific members of the Analysis Lens user interface.
Show | Displays specific members of the Analysis Lens user interface.


QuickAnalysis.Hide Method (Excel)

 Copy code hover
[image]

QuickAnalysis.Hide Method (Excel)
See also Send feedback

Published: July 16, 2012

Hides specific members of the Analysis Lens user interface.

Version information

Version Added: Excel 2013

Syntax

expression .Hide(XlQuickAnalysisMode)

expression A variable that represents a QuickAnalysis object.

Parameters

Name | Required/Optional | Data type | Description
XlQuickAnalysisMode | Optional | XLQUICKANALYSISMODE |

Return value

VOID

Remarks

When the argument is set to any one of the following options, the resulting user interface is hidden:

  • If missing or set to 0 = Hide all buttons

  • 1 = If showing, hide the Conditional Formatting & Sparklines buttons

  • 2 = If showing, hide the Charts button

  • 3 = If showing, hide Suggested Views button

  • 4 = If showing, hide the Totals button

See also

Other resources

QuickAnalysis Object Members
QuickAnalysis Object


QuickAnalysis.Show Method (Excel)

 Copy code hover
[image]

QuickAnalysis.Show Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays specific members of the Analysis Lens user interface.

Version information

Version Added: Excel 2013

Syntax

expression .Show(XlQuickAnalysisMode)

expression A variable that represents a QuickAnalysis object.

Parameters

Name | Required/Optional | Data type | Description
XlQuickAnalysisMode | Optional | XLQUICKANALYSISMODE |

Remarks

When XlQuickAnalysisMode Enumeration (Excel) is set to any one of the following options, the resulting user interface is displayed:

  • If missing or set to xlLensOnly = Show the button but no fly-outs

  • xlFormatConditions = Conditional Formatting

  • xlSparklines = Sparklines

  • xlRecommendedCharts = Charts

  • xlTables = Tables

  • xlTotals = Totals

Return value

VOID

See also

Other resources

QuickAnalysis Object Members
QuickAnalysis Object


Range Object (Excel)

 Copy code hover
[image]

Range Object (Excel)
Send feedback

Published: July 16, 2012

Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3-D range.

Remarks

The following properties and methods for returning a Range object are described in the examples section:

  • Range property

  • Cells property

  • Range and Cells

  • Offset property

  • Union method

Example

Use Range(arg), where arg names the range, to return a Range object that represents a single cell or a range of cells. The following example places the value of cell A1 in cell A5.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A5").Value = _
    Worksheets("Sheet1").Range("A1").Value

The following example fills the range A1:H8 with random numbers by setting the formula for each cell in the range. When it's used without an object qualifier (an object to the left of the period), the Range property returns a range on the active sheet. If the active sheet isn't a worksheet, the method fails. Use the Activate method to activate a worksheet before you use the Range property without an explicit object qualifier.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1:H8").Formula = "=Rand()"    'Range is on the active sheet

The following example clears the contents of the range named Criteria.

Note Note

If you use a text argument for the range address, you must specify the address in A1-style notation (you cannot use R1C1-style notation).

VBA Copy code Copy code
Worksheets(1).Range("Criteria").ClearContents

Use Cells(row, column) where row is the row index and column is the column index, to return a single cell. The following example sets the value of cell A1 to 24.

VBA Copy code Copy code
Worksheets(1).Cells(1, 1).Value = 24

The following example sets the formula for cell A2.

VBA Copy code Copy code
ActiveSheet.Cells(2, 1).Formula = "=Sum(B1:B5)"

Although you can also use Range("A1") to return cell A1, there may be times when the Cells property is more convenient because you can use a variable for the row or column. The following example creates column and row headings on Sheet1. Be aware that after the worksheet has been activated, the Cells property can be used without an explicit sheet declaration (it returns a cell on the active sheet).

Note Note

Although you could use Visual Basic string functions to alter A1-style references, it is easier (and better programming practice) to use the Cells(1, 1) notation.

VBA Copy code Copy code
Sub SetUpTable()
Worksheets("Sheet1").Activate
For TheYear = 1 To 5
    Cells(1, TheYear + 1).Value = 1990 + TheYear
Next TheYear
For TheQuarter = 1 To 4
    Cells(TheQuarter + 1, 1).Value = "Q" & TheQuarter
Next TheQuarter
End Sub

Use expression.Cells(row, column), where expression is an expression that returns a Range object, and row and column are relative to the upper-left corner of the range, to return part of a range. The following example sets the formula for cell C5.

VBA Copy code Copy code
Worksheets(1).Range("C5:C10").Cells(1, 1).Formula = "=Rand()"

Use Range(cell1, cell2), where cell1 and cell2 are Range objects that specify the start and end cells, to return a Range object. The following example sets the border line style for cells A1:J10.

Note Note

Be aware that the period in front of each occurrence of the Cells property. The period is required if the result of the preceding With statement is to be applied to the Cells property—in this case, to indicate that the cells are on worksheet one (without the period, the Cells property would return cells on the active sheet).

VBA Copy code Copy code
With Worksheets(1)
    .Range(.Cells(1, 1), _
        .Cells(10, 10)).Borders.LineStyle = xlThick
End With

Use Offset(row, column), where row and column are the row and column offsets, to return a range at a specified offset to another range. The following example selects the cell three rows down from and one column to the right of the cell in the upper-left corner of the current selection. You cannot select a cell that is not on the active sheet, so you must first activate the worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
  'Can't select unless the sheet is active
Selection.Offset(3, 1).Range("A1").Select

Use Union(range1, range2, ...) to return multiple-area ranges—that is, ranges composed of two or more contiguous blocks of cells. The following example creates an object defined as the union of ranges A1:B2 and C3:D4, and then selects the defined range.

VBA Copy code Copy code
Dim r1 As Range, r2 As Range, myMultiAreaRange As Range
Worksheets("sheet1").Activate
Set r1 = Range("A1:B2")
Set r2 = Range("C3:D4")
Set myMultiAreaRange = Union(r1, r2)
myMultiAreaRange.Select

If you work with selections that contain more than one area, the Areas property is useful. It divides a multiple-area selection into individual Range objects and then returns the objects as a collection. You can use the Count property on the returned collection to verify a selection that contains more than one area, as shown in the following example.

VBA Copy code Copy code
Sub NoMultiAreaSelection()
    NumberOfSelectedAreas = Selection.Areas.Count
    If NumberOfSelectedAreas > 1 Then
        MsgBox "You cannot carry out this command " & _
            "on multi-area selections"
    End If
End Sub

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example uses the AdvancedFilter method of the Range object to create a list of the unique values, and the number of times those unique values occur, in the range of column A.

VBA Copy code Copy code
Sub Create_Unique_List_Count()
    'Excel workbook, the source and target worksheets, and the source and target ranges.
    Dim wbBook As Workbook
    Dim wsSource As Worksheet
    Dim wsTarget As Worksheet
    Dim rnSource As Range
    Dim rnTarget As Range
    Dim rnUnique As Range
    'Variant to hold the unique data
    Dim vaUnique As Variant
    'Number of unique values in the data
    Dim lnCount As Long

    'Initialize the Excel objects
    Set wbBook = ThisWorkbook
    With wbBook
        Set wsSource = .Worksheets("Sheet1")
        Set wsTarget = .Worksheets("Sheet2")
    End With

    'On the source worksheet, set the range to the data stored in column A
    With wsSource
        Set rnSource = .Range(.Range("A1"), .Range("A100").End(xlUp))
    End With

    'On the target worksheet, set the range as column A.
    Set rnTarget = wsTarget.Range("A1")

    'Use AdvancedFilter to copy the data from the source to the target,
    'while filtering for duplicate values.
    rnSource.AdvancedFilter Action:=xlFilterCopy, _
                            CopyToRange:=rnTarget, _
                            Unique:=True

    'On the target worksheet, set the unique range on Column A, excluding the first cell
    '(which will contain the "List" header for the column).
    With wsTarget
        Set rnUnique = .Range(.Range("A2"), .Range("A100").End(xlUp))
    End With

    'Assign all the values of the Unique range into the Unique variant.
    vaUnique = rnUnique.Value

    'Count the number of occurrences of every unique value in the source data,
    'and list it next to its relevant value.
    For lnCount = 1 To UBound(vaUnique)
        rnUnique(lnCount, 1).Offset(0, 1).Value = _
            Application.Evaluate("COUNTIF(" & _
            rnSource.Address(External:=True) & _
            ",""" & rnUnique(lnCount, 1).Text & """)")
    Next lnCount

    'Label the column of occurrences with "Occurrences"
    With rnTarget.Offset(0, 1)
        .Value = "Occurrences"
        .Font.Bold = True
    End With

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."


Range Members (Excel)

 Copy code hover
[image]

Range Members (Excel)
Send feedback

Published: July 16, 2012

Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3-D range.

Methods

Name | Description
Activate | Activates a single cell, which must be inside the current selection. To select a range of cells, use the Select method.
AddComment | Adds a comment to the range.
AdvancedFilter | Filters or copies data from a list based on a criteria range. If the initial selection is a single cell, that cell's current region is used.
AllocateChanges | Performs a writeback operation for all edited cells in a range based on an OLAP data source.
ApplyNames | Applies names to the cells in the specified range.
ApplyOutlineStyles | Applies outlining styles to the specified range.
AutoComplete | Returns an AutoComplete match from the list. If there's no AutoComplete match or if more than one entry in the list matches the string to complete, this method returns an empty string.
AutoFill | Performs an autofill on the cells in the specified range.
AutoFilter | Filters a list using the AutoFilter.
AutoFit | Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.
AutoOutline | Automatically creates an outline for the specified range. If the range is a single cell, Microsoft Excel creates an outline for the entire sheet. The new outline replaces any existing outline.
BorderAround | Adds a border to a range and sets the Color, LineStyle, and Weight properties for the new border. Variant.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
CalculateRowMajorOrder | Calculates a specfied range of cells.
CheckSpelling | Checks the spelling of an object.
Clear | Clears the entire object.
ClearComments | Clears all cell comments from the specified range.
ClearContents | Clears the formulas from the range.
ClearFormats | Clears the formatting of the object.
ClearHyperlinks | Removes all hyperlinks from the specified range.
ClearNotes | Clears notes and sound notes from all the cells in the specified range.
ClearOutline | Clears the outline for the specified range.
ColumnDifferences | Returns a Range object that represents all the cells whose contents are different from the comparison cell in each column.
Consolidate | Consolidates data from multiple ranges on multiple worksheets into a single range on a single worksheet. Variant.
Copy | Copies the range to the specified range or to the Clipboard.
CopyFromRecordset | Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range. If the Recordset object contains fields with OLE objects in them, this method fails.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
CreateNames | Creates names in the specified range, based on text labels in the sheet.
Cut | Cuts the object to the Clipboard or pastes it into a specified destination.
DataSeries | Creates a data series in the specified range. Variant.
Delete | Deletes the object.
DialogBox | Displays a dialog box defined by a dialog box definition table on a Microsoft Excel 4.0 macro sheet. Returns the number of the chosen control, or returns False if the user clicks the Cancel button.
Dirty | Designates a range to be recalculated when the next recalculation occurs.
DiscardChanges | Discards all changes in the edited cells of the range.
EditionOptions | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ExportAsFixedFormat | Exports to a file of the specified format.
FillDown | Fills down from the top cell or cells in the specified range to the bottom of the range. The contents and formatting of the cell or cells in the top row of a range are copied into the rest of the rows in the range.
FillLeft | Fills left from the rightmost cell or cells in the specified range. The contents and formatting of the cell or cells in the rightmost column of a range are copied into the rest of the columns in the range.
FillRight | Fills right from the leftmost cell or cells in the specified range. The contents and formatting of the cell or cells in the leftmost column of a range are copied into the rest of the columns in the range.
FillUp | Fills up from the bottom cell or cells in the specified range to the top of the range. The contents and formatting of the cell or cells in the bottom row of a range are copied into the rest of the rows in the range.
Find | Finds specific information in a range.
FindNext | Continues a search that was begun with the Find method. Finds the next cell that matches those same conditions and returns a Range object that represents that cell. This does not affect the selection or the active cell.
FindPrevious | Continues a search that was begun with the Find method. Finds the previous cell that matches those same conditions and returns a Range object that represents that cell. Doesn't affect the selection or the active cell.
FlashFill | TRUE indicates that the Excel Flash Fill feature has been enabled and active.
FunctionWizard | Starts the Function Wizard for the upper-left cell of the range.
Group | When the Range object represents a single cell in a PivotTable field's data range, the Group method performs numeric or date-based grouping in that field.
Insert | Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to make space.
InsertIndent | Adds an indent to the specified range.
Justify | Rearranges the text in a range so that it fills the range evenly.
ListNames | Pastes a list of all nonhidden names onto the worksheet, beginning with the first cell in the range.
Merge | Creates a merged cell from the specified Range object.
NavigateArrow | Navigates a tracer arrow for the specified range to the precedent, dependent, or error-causing cell or cells. Selects the precedent, dependent, or error cells and returns a Range object that represents the new selection. This method causes an error if it's applied to a cell without visible tracer arrows.
NoteText | Returns or sets the cell note associated with the cell in the upper-left corner of the range. Read/write String. Cell notes have been replaced by range comments. For more information, see the Comment object.
Parse | Parses a range of data and breaks it into multiple cells. Distributes the contents of the range to fill several adjacent columns; the range can be no more than one column wide.
PasteSpecial | Pastes a Range from the Clipboard into the specified range.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
RemoveDuplicates | Removes duplicate values from a range of values.
RemoveSubtotal | Removes subtotals from a list.
Replace | Returns a Boolean indicating characters in cells within the specified range. Using this method doesn't change either the selection or the active cell.
RowDifferences | Returns a Range object that represents all the cells whose contents are different from those of the comparison cell in each row.
Run | Runs the Microsoft Excel macro at this location. The range must be on a macro sheet.
Select | Selects the object.
SetPhonetic | Creates Phonetic objects for all the cells in the specified range.
Show | Scrolls through the contents of the active window to move the range into view. The range must consist of a single cell in the active document.
ShowDependents | Draws tracer arrows to the direct dependents of the range.
ShowErrors | Draws tracer arrows through the precedents tree to the cell that's the source of the error, and returns the range that contains that cell.
ShowPrecedents | Draws tracer arrows to the direct precedents of the range.
Sort | Sorts a range of values.
SortSpecial | Uses East Asian sorting methods to sort the range, a PivotTable report, or uses the method for the active region if the range contains only one cell. For example, Japanese sorts in the order of the Kana syllabary.
Speak | Causes the cells of the range to be spoken in row order or column order.
SpecialCells | Returns a Range object that represents all the cells that match the specified type and value.
SubscribeTo | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Subtotal | Creates subtotals for the range (or the current region, if the range is a single cell).
Table | Creates a data table based on input values and formulas that you define on a worksheet.
TextToColumns | Parses a column of cells that contain text into several columns.
Ungroup | Promotes a range in an outline (that is, decreases its outline level). The specified range must be a row or column, or a range of rows or columns. If the range is in a PivotTable report, this method ungroups the items contained in the range.
UnMerge | Separates a merged area into individual cells.

Properties

Name | Description
AddIndent | Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Address | Returns a String value that represents the range reference in the language of the macro.
AddressLocal | Returns the range reference for the specified range in the language of the user. Read-only String.
AllowEdit | Returns a Boolean value that indicates if the range can be edited on a protected worksheet.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Areas | Returns an Areas collection that represents all the ranges in a multiple-area selection. Read-only.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
Cells | Returns a Range object that represents the cells in the specified range.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Column | Returns the number of the first column in the first area in the specified range. Read-only Long.
Columns | Returns a Range object that represents the columns in the specified range.
ColumnWidth | Returns or sets the width of all columns in the specified range. Read/write Variant.
Comment | Returns a Comment object that represents the comment associated with the cell in the upper-left corner of the range.
Count | Returns a Long value that represents the number of objects in the collection.
CountLarge | Returns a value that represents the number of objects in the collection. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CurrentArray | If the specified cell is part of an array, returns a Range object that represents the entire array. Read-only.
CurrentRegion | Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns. Read-only.
Dependents | Returns a Range object that represents the range containing all the dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.
DirectDependents | Returns a Range object that represents the range containing all the direct dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.
DirectPrecedents | Returns a Range object that represents the range containing all the direct precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only Range object.
DisplayFormat | Returns a DisplayFormat object that represents the display settings for the specified range. Read-only
End | Returns a Range object that represents the cell at the end of the region that contains the source range. Equivalent to pressing END+UP ARROW, END+DOWN ARROW, END+LEFT ARROW, or END+RIGHT ARROW. Read-only Range object.
EntireColumn | Returns a Range object that represents the entire column (or columns) that contains the specified range. Read-only.
EntireRow | Returns a Range object that represents the entire row (or rows) that contains the specified range. Read-only.
Errors | Allows the user to to access error checking options.
Font | Returns a Font object that represents the font of the specified object.
FormatConditions | Returns a FormatConditions collection that represents all the conditional formats for the specified range. Read-only.
Formula | Returns or sets a Variant value that represents the object's formula in A1-style notation and in the macro language.
FormulaArray | Returns or sets the array formula of a range. Returns (or can be set to) a single formula or a Visual Basic array. If the specified range doesn't contain an array formula, this property returns null. Read/write Variant.
FormulaHidden | Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write Variant.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write Variant.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write Variant.
HasArray | True if the specified cell is part of an array formula. Read-only Variant.
HasFormula | True if all cells in the range contain formulas; False if none of the cells in the range contains a formula; null otherwise. Read-only Variant.
Height | Returns or sets a Variant value that represents the height, in points, of the range.
Hidden | Returns or sets a Variant value that indicates if the rows or columns are hidden.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the range.
ID | Returns or sets a String value that represents the identifying label for the specified cell when the page is saved as a Web page.
IndentLevel | Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.
Interior | Returns an Interior object that represents the interior of the specified object.
Item | Returns a Range object that represents a range at an offset to the specified range.
Left | Returns a Variant value that represents the distance, in points, from the left edge of column A to the left edge of the range.
ListHeaderRows | Returns the number of header rows for the specified range. Read-only Long.
ListObject | Returns a ListObject object for the Range object. Read-only ListObject object.
LocationInTable | Returns a constant that describes the part of the PivotTable report that contains the upper-left corner of the specified range. Can be one of the following XlLocationInTable. constants. Read-only Long.
Locked | Returns or sets a Variant value that indicates if the object is locked.
MDX | Returns the MDX name for the specified Range object. Read-only String.
MergeArea | Returns a Range object that represents the merged range containing the specified cell. If the specified cell isn't in a merged range, this property returns the specified cell. Read-only Variant.
MergeCells | True if the range contains merged cells. Read/write Variant.
Name | Returns or sets a Variant value that represents the name of the object.
Next | Returns a Range object that represents the next cell.
NumberFormat | Returns or sets a Variant value that represents the format code for the object.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Offset | Returns a Range object that represents a range that's offset from the specified range.
Orientation | Returns or sets a Variant value that represents the text orientation.
OutlineLevel | Returns or sets the current outline level of the specified row or column. Read/write Variant.
PageBreak | Returns or sets the location of a page break. Can be one of the following XlPageBreak constants: xlPageBreakAutomatic, xlPageBreakManual, or xlPageBreakNone. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
Phonetic | Returns the Phonetic object, which contains information about a specific phonetic text string in a cell.
Phonetics | Returns the Phonetics collection of the range. Read only.
PivotCell | Returns a PivotCell object that represents a cell in a PivotTable report.
PivotField | Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.
PivotItem | Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
PivotTable | Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.
Precedents | Returns a Range object that represents all the precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only.
PrefixCharacter | Returns the prefix character for the cell. Read-only Variant.
Previous | Returns a Range object that represents the next cell.
QueryTable | Returns a QueryTable object that represents the query table that intersects the specified Range object.
Range | Returns a Range object that represents a cell or a range of cells.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Resize | Resizes the specified range. Returns a Range object that represents the resized range.
Row | Returns the number of the first row of the first area in the range. Read-only Long.
RowHeight | Returns or sets the height of the first row in the range specified, measured in points. Read/write Variant.
Rows | Returns a Range object that represents the rows in the specified range. Read-only Range object.
ServerActions | Specifies the actions that can be performed on the SharePoint server for a Range object.
ShowDetail | True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.
ShrinkToFit | Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.
SoundNote | This property should not be used. Sound notes have been removed from Microsoft Excel.
SparklineGroups | Returns a SparklineGroups object that represents an existing group of sparklines from the specified range. Read-only
Style | Returns or sets a Variant value, containing a Style object, that represents the style of the specified range.
Summary | True if the range is an outlining summary row or column. The range should be a row or a column. Read-only Variant.
Text | Returns or sets the text for the specified object. Read-only String.
Top | Returns a Variant value that represents the distance, in points, from the top edge of row 1 to the top edge of the range.
UseStandardHeight | True if the row height of the Range object equals the standard height of the sheet. Returns Null if the range contains more than one row and the rows aren't all the same height. Read/write Variant.
UseStandardWidth | True if the column width of the Range object equals the standard width of the sheet. Returns null if the range contains more than one column and the columns aren't all the same width. Read/write Variant.
Validation | Returns the Validation object that represents data validation for the specified range. Read-only.
Value | Returns or sets a Variant value that represents the value of the specified range.
Value2 | Returns or sets the cell value. Read/write Variant.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns a Variant value that represents the width, in units, of the range.
Worksheet | Returns a Worksheet object that represents the worksheet containing the specified range. Read-only.
WrapText | Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.
XPath | Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.


Range Properties (Excel)

 Copy code hover
[image]

Range Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddIndent | Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Address | Returns a String value that represents the range reference in the language of the macro.
AddressLocal | Returns the range reference for the specified range in the language of the user. Read-only String.
AllowEdit | Returns a Boolean value that indicates if the range can be edited on a protected worksheet.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Areas | Returns an Areas collection that represents all the ranges in a multiple-area selection. Read-only.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
Cells | Returns a Range object that represents the cells in the specified range.
Characters | Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.
Column | Returns the number of the first column in the first area in the specified range. Read-only Long.
Columns | Returns a Range object that represents the columns in the specified range.
ColumnWidth | Returns or sets the width of all columns in the specified range. Read/write Variant.
Comment | Returns a Comment object that represents the comment associated with the cell in the upper-left corner of the range.
Count | Returns a Long value that represents the number of objects in the collection.
CountLarge | Returns a value that represents the number of objects in the collection. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CurrentArray | If the specified cell is part of an array, returns a Range object that represents the entire array. Read-only.
CurrentRegion | Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns. Read-only.
Dependents | Returns a Range object that represents the range containing all the dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.
DirectDependents | Returns a Range object that represents the range containing all the direct dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.
DirectPrecedents | Returns a Range object that represents the range containing all the direct precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only Range object.
DisplayFormat | Returns a DisplayFormat object that represents the display settings for the specified range. Read-only
End | Returns a Range object that represents the cell at the end of the region that contains the source range. Equivalent to pressing END+UP ARROW, END+DOWN ARROW, END+LEFT ARROW, or END+RIGHT ARROW. Read-only Range object.
EntireColumn | Returns a Range object that represents the entire column (or columns) that contains the specified range. Read-only.
EntireRow | Returns a Range object that represents the entire row (or rows) that contains the specified range. Read-only.
Errors | Allows the user to to access error checking options.
Font | Returns a Font object that represents the font of the specified object.
FormatConditions | Returns a FormatConditions collection that represents all the conditional formats for the specified range. Read-only.
Formula | Returns or sets a Variant value that represents the object's formula in A1-style notation and in the macro language.
FormulaArray | Returns or sets the array formula of a range. Returns (or can be set to) a single formula or a Visual Basic array. If the specified range doesn't contain an array formula, this property returns null. Read/write Variant.
FormulaHidden | Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write Variant.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write Variant.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write Variant.
HasArray | True if the specified cell is part of an array formula. Read-only Variant.
HasFormula | True if all cells in the range contain formulas; False if none of the cells in the range contains a formula; null otherwise. Read-only Variant.
Height | Returns or sets a Variant value that represents the height, in points, of the range.
Hidden | Returns or sets a Variant value that indicates if the rows or columns are hidden.
HorizontalAlignment | Returns or sets a Variant value that represents the horizontal alignment for the specified object.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the range.
ID | Returns or sets a String value that represents the identifying label for the specified cell when the page is saved as a Web page.
IndentLevel | Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.
Interior | Returns an Interior object that represents the interior of the specified object.
Item | Returns a Range object that represents a range at an offset to the specified range.
Left | Returns a Variant value that represents the distance, in points, from the left edge of column A to the left edge of the range.
ListHeaderRows | Returns the number of header rows for the specified range. Read-only Long.
ListObject | Returns a ListObject object for the Range object. Read-only ListObject object.
LocationInTable | Returns a constant that describes the part of the PivotTable report that contains the upper-left corner of the specified range. Can be one of the following XlLocationInTable. constants. Read-only Long.
Locked | Returns or sets a Variant value that indicates if the object is locked.
MDX | Returns the MDX name for the specified Range object. Read-only String.
MergeArea | Returns a Range object that represents the merged range containing the specified cell. If the specified cell isn't in a merged range, this property returns the specified cell. Read-only Variant.
MergeCells | True if the range contains merged cells. Read/write Variant.
Name | Returns or sets a Variant value that represents the name of the object.
Next | Returns a Range object that represents the next cell.
NumberFormat | Returns or sets a Variant value that represents the format code for the object.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Offset | Returns a Range object that represents a range that's offset from the specified range.
Orientation | Returns or sets a Variant value that represents the text orientation.
OutlineLevel | Returns or sets the current outline level of the specified row or column. Read/write Variant.
PageBreak | Returns or sets the location of a page break. Can be one of the following XlPageBreak constants: xlPageBreakAutomatic, xlPageBreakManual, or xlPageBreakNone. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.
Phonetic | Returns the Phonetic object, which contains information about a specific phonetic text string in a cell.
Phonetics | Returns the Phonetics collection of the range. Read only.
PivotCell | Returns a PivotCell object that represents a cell in a PivotTable report.
PivotField | Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.
PivotItem | Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.
PivotTable | Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.
Precedents | Returns a Range object that represents all the precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only.
PrefixCharacter | Returns the prefix character for the cell. Read-only Variant.
Previous | Returns a Range object that represents the next cell.
QueryTable | Returns a QueryTable object that represents the query table that intersects the specified Range object.
Range | Returns a Range object that represents a cell or a range of cells.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
Resize | Resizes the specified range. Returns a Range object that represents the resized range.
Row | Returns the number of the first row of the first area in the range. Read-only Long.
RowHeight | Returns or sets the height of the first row in the range specified, measured in points. Read/write Variant.
Rows | Returns a Range object that represents the rows in the specified range. Read-only Range object.
ServerActions | Specifies the actions that can be performed on the SharePoint server for a Range object.
ShowDetail | True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.
ShrinkToFit | Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.
SoundNote | This property should not be used. Sound notes have been removed from Microsoft Excel.
SparklineGroups | Returns a SparklineGroups object that represents an existing group of sparklines from the specified range. Read-only
Style | Returns or sets a Variant value, containing a Style object, that represents the style of the specified range.
Summary | True if the range is an outlining summary row or column. The range should be a row or a column. Read-only Variant.
Text | Returns or sets the text for the specified object. Read-only String.
Top | Returns a Variant value that represents the distance, in points, from the top edge of row 1 to the top edge of the range.
UseStandardHeight | True if the row height of the Range object equals the standard height of the sheet. Returns Null if the range contains more than one row and the rows aren't all the same height. Read/write Variant.
UseStandardWidth | True if the column width of the Range object equals the standard width of the sheet. Returns null if the range contains more than one column and the columns aren't all the same width. Read/write Variant.
Validation | Returns the Validation object that represents data validation for the specified range. Read-only.
Value | Returns or sets a Variant value that represents the value of the specified range.
Value2 | Returns or sets the cell value. Read/write Variant.
VerticalAlignment | Returns or sets a Variant value that represents the vertical alignment of the specified object.
Width | Returns a Variant value that represents the width, in units, of the range.
Worksheet | Returns a Worksheet object that represents the worksheet containing the specified range. Read-only.
WrapText | Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.
XPath | Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.


Range.AddIndent Property (Excel)

 Copy code hover
[image]

Range.AddIndent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)

Syntax

expression .AddIndent

expression A variable that represents a Range object.

Remarks

Set the value of this property to True to autmatically indent text when the text alignment in the cell is set, either horizontally or vertically, to equal distribution.

To set text alignment to equal distribution, you can set the VerticalAlignment property to xlVAlignDistributed when the value of the Orientation property is xlVertical, and you can set the HorizontalAlignment property to xlHAlignDistributed when the value of the Orientation property is xlHorizontal.

Example

This example sets the horizontal alignment for text in cell A1 on Sheet1 to equal distribution and then indents the text.

VBA Copy code Copy code
With Worksheets("Sheet1").Range("A1")
 .HorizontalAlignment = xlHAlignDistributed
 .AddIndent = True
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Address Property (Excel)

 Copy code hover
[image]

Range.Address Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the range reference in the language of the macro.

Syntax

expression .Address(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RowAbsolute | Optional | Variant | True to return the row part of the reference as an absolute reference. The default value is True.
ColumnAbsolute | Optional | Variant | True to return the column part of the reference as an absolute reference. The default value is True.
ReferenceStyle | Optional | XlReferenceStyle | The reference style. The default value is xlA1.
External | Optional | Variant | True to return an external reference. False to return a local reference. The default value is False.
RelativeTo | Optional | Variant | If RowAbsolute and ColumnAbsolute are False, and ReferenceStyle is xlR1C1, you must include a starting point for the relative reference. This argument is a Range object that defines the starting point.

Remarks

If the reference contains more than one cell, RowAbsolute and ColumnAbsolute apply to all rows and columns.

Example

The following example displays four different representations of the same cell address on Sheet1. The comments in the example are the addresses that will be displayed in the message boxes.

VBA Copy code Copy code
Set mc = Worksheets("Sheet1").Cells(1, 1)
MsgBox mc.Address() ' $A$1
MsgBox mc.Address(RowAbsolute:=False) ' $A1
MsgBox mc.Address(ReferenceStyle:=xlR1C1) ' R1C1
MsgBox mc.Address(ReferenceStyle:=xlR1C1, _
 RowAbsolute:=False, _
 ColumnAbsolute:=False, _
 RelativeTo:=Worksheets(1).Cells(3, 3)) ' R[-2]C[-2]

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AddressLocal Property (Excel)

 Copy code hover
[image]

Range.AddressLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the range reference for the specified range in the language of the user. Read-only String.

Syntax

expression .AddressLocal(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RowAbsolute | Optional | Variant | True to return the row part of the reference as an absolute reference. The default value is True.
ColumnAbsolute | Optional | Variant | True to return the column part of the reference as an absolute reference. The default value is True.
ReferenceStyle | Optional | XlReferenceStyle | One of the constants for XlReferenceStyle specifying A1-style or R1C1-style reference.
External | Optional | Variant | True to return an external reference. False to return a local reference. The default value is False.
RelativeTo | Optional | Variant | If RowAbsolute and ColumnAbsolute are both set to False and ReferenceStyle is set to xlR1C1, you must include a starting point for the relative reference. This argument is a Range object that defines the starting point for the reference.

Remarks

If the reference contains more than one cell, RowAbsolute and ColumnAbsolute apply to all rows and all columns, respectively.

Example

Assume that this example was created using U.S. English language support and was then run in using German language support. The example displays the text shown in the comments.

VBA Copy code Copy code
Set mc = Worksheets(1).Cells(1, 1)
MsgBox mc.AddressLocal() ' $A$1
MsgBox mc.AddressLocal(RowAbsolute:=False) ' $A1
MsgBox mc.AddressLocal(ReferenceStyle:=xlR1C1) ' Z1S1
MsgBox mc.AddressLocal(ReferenceStyle:=xlR1C1, _
 RowAbsolute:=False, _
 ColumnAbsolute:=False, _
 RelativeTo:=Worksheets(1).Cells(3, 3)) ' Z(-2)S(-2)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AllowEdit Property (Excel)

 Copy code hover
[image]

Range.AllowEdit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value that indicates if the range can be edited on a protected worksheet.

Syntax

expression .AllowEdit

expression A variable that represents a Range object.

Example

In this example, Microsoft Excel notifies the user if cell A1 can be edited or not on a protected worksheet.

VBA Copy code Copy code
Sub UseAllowEdit()

 Dim wksOne As Worksheet

 Set wksOne = Application.ActiveSheet

 ' Protect the worksheet
 wksOne.Protect

 ' Notify the user about editing cell A1.
 If wksOne.Range("A1").AllowEdit = True Then
 MsgBox "Cell A1 can be edited."
 Else
 Msgbox "Cell A1 cannot be edited."
 End If

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Application Property (Excel)

 Copy code hover
[image]

Range.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Range object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Areas Property (Excel)

 Copy code hover
[image]

Range.Areas Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Areas collection that represents all the ranges in a multiple-area selection. Read-only.

Syntax

expression .Areas

expression A variable that represents a Range object.

Remarks

For a single selection, the Areas property returns a collection that contains one object — the original Range object itself. For a multiple-area selection, the Areas property returns a collection that contains one object for each selected area.

Example

This example displays a message if the user tries to carry out a command when more than one area is selected. This example must be run from a worksheet.

VBA Copy code Copy code
If Selection.Areas.Count > 1 Then
 MsgBox "Cannot do this to a multi-area selection."
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Borders Property (Excel)

 Copy code hover
[image]

Range.Borders Property (Excel)
See also Send feedback

Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).

Syntax

expression .Borders

expression A variable that represents a Range object.

Example

This example sets the color of the bottom border of cell B2 on Sheet1 to a thin red border.

VBA Copy code Copy code
Sub SetRangeBorder()

 With Worksheets("Sheet1").Range("B2").Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 3
 End With

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Cells Property (Excel)

 Copy code hover
[image]

Range.Cells Property (Excel)
See also Send feedback

Returns a Range object that represents the cells in the specified range.

Syntax

expression .Cells

expression A variable that represents a Range object.

Remarks

Because the Item property is the default property for the Range object, you can specify the row and column index immediately after the Cells keyword. For more information, see the Item property and the examples for this topic.

Using this property without an object qualifier returns a Range object that represents all the cells on the active worksheet.

Example

This example sets the font style for cells A1:C5 on Sheet1 to italic.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range(Cells(1, 1), Cells(5, 3)).Font.Italic = True

This example scans a column of data named "myRange." If a cell has the same value as the cell immediately above it, the example displays the address of the cell that contains the duplicate data.

VBA Copy code Copy code
Set r = Range("myRange")
For n = 1 To r.Rows.Count
    If r.Cells(n, 1) = r.Cells(n + 1, 1) Then
        MsgBox "Duplicate data in " & r.Cells(n + 1, 1).Address
    End If
Next n

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example looks through column C, and for every cell that has a comment, it puts the comment text into column D and deletes the comment from column C.

Copy code Copy code
Sub SplitComments()
   'Set up your variables
   Dim cmt As Comment
   Dim iRow As Integer

   'Go through all the cells in Column C, and check to see if the cell has a comment.
   For iRow = 1 To WorksheetFunction.CountA(Columns(3))
      Set cmt = Cells(iRow, 3).Comment
      If Not cmt Is Nothing Then

         'If there is a comment, paste the comment text into column D and delete the original comment.
         Cells(iRow, 4) = Cells(iRow, 3).Comment.Text
         Cells(iRow, 3).Comment.Delete
      End If
   Next iRow
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Characters Property (Excel)

 Copy code hover
[image]

Range.Characters Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Syntax

expression .Characters(Start, Length)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The Characters object isn't a collection.

Example

This example formats the third character in cell A1 on Sheet1 as bold.

Copy code Copy code
With Worksheets("Sheet1").Range("A1")
 .Value = "abcdefg"
 .Characters(3, 1).Font.Bold = True
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Column Property (Excel)

 Copy code hover
[image]

Range.Column Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of the first column in the first area in the specified range. Read-only Long.

Syntax

expression .Column

expression A variable that represents a Range object.

Remarks

Column A returns 1, column B returns 2, and so on.

To return the number of the last column in the range, use the following expression.

myRange.Columns(myRange.Columns.Count).Column

Example

This example sets the column width of every other column on Sheet1 to 4 points.

VBA Copy code Copy code
For Each col In Worksheets("Sheet1").Columns
    If col.Column Mod 2 = 0 Then
        col.ColumnWidth = 4
    End If
Next col

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example deletes the empty columns from a selected range.

VBA Copy code Copy code
Sub Delete_Empty_Columns()
    'The range from which to delete the columns.
    Dim rnSelection As Range

    'Column and count variables used in the deletion process.
    Dim lnLastColumn As Long
    Dim lnColumnCount As Long
    Dim lnDeletedColumns As Long

    lnDeletedColumns = 0

    'Confirm that a range is selected, and that the range is contiguous.
    If TypeName(Selection) = "Range" Then
        If Selection.Areas.Count = 1 Then

            'Initialize the range to what the user has selected, and initialize the count for the upcoming FOR loop.
            Set rnSelection = Application.Selection
            lnLastColumn = rnSelection.Columns.Count

            'Start at the far-right column and work left: if the column is empty then
            'delete the column and increment the deleted column count.
            For lnColumnCount = lnLastColumn To 1 Step -1
                If Application.CountA(rnSelection.Columns(lnColumnCount)) = 0 Then
                    rnSelection.Columns(lnColumnCount).Delete
                    lnDeletedColumns = lnDeletedColumns + 1
                End If
            Next lnColumnCount

            rnSelection.Resize(lnLastColumn - lnDeletedColumns).Select
        Else
            MsgBox "Please select only one area.", vbInformation
        End If
    Else
        MsgBox "Please select a range.", vbInformation
    End If

    'Turn screen updating back on.
    Application.ScreenUpdating = True

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Columns Property (Excel)

 Copy code hover
[image]

Range.Columns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the columns in the specified range.

Syntax

expression .Columns

expression A variable that represents a Range object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Columns.

When applied to a Range object that's a multiple-area selection, this property returns columns from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Columns.Count returns 2, not 4. To use this property on a range that may contain a multiple-area selection, test Areas.Count to determine whether the range contains more than one area. If it does, loop over each area in the range.

Example

This example sets the value of every cell in column one in the range named "myRange" to 0 (zero).

VBA Copy code Copy code
Range("myRange").Columns(1).Value = 0

This example displays the number of columns in the selection on Sheet1. If more than one area is selected, the example loops through each area.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
 MsgBox "The selection contains " & _
 Selection.Columns.Count & " columns."
Else
 For i = 1 To areaCount
 MsgBox "Area " & i & " of the selection contains " & _
 Selection.Areas(i).Columns.Count & " columns."
 Next i
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ColumnWidth Property (Excel)

 Copy code hover
[image]

Range.ColumnWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of all columns in the specified range. Read/write Variant.

Syntax

expression .ColumnWidth

expression A variable that represents a Range object.

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Use the Width property to return the width of a column in points.

If all columns in the range have the same width, the ColumnWidth property returns the width. If columns in the range have different widths, this property returns null.

Example

This example doubles the width of column A on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").Columns("A")
 .ColumnWidth = .ColumnWidth * 2
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Comment Property (Excel)

 Copy code hover
[image]

Range.Comment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Comment object that represents the comment associated with the cell in the upper-left corner of the range.

Syntax

expression .Comment

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Count Property (Excel)

 Copy code hover
[image]

Range.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Range object.

Remarks

The Count property is functionally the same as the CountLarge property, except that the Count property will generate an overflow error if the specified range has more than 2,147,483,647 cells (one less than 2048 columns). The CountLarge property, however, can handle ranges up to the maximum size for a worksheet, which is 17,179,869,184 cells.

Example

This example displays the number of columns in the selection on Sheet1. The code also tests for a multiple-area selection; if one exists, the code loops on the areas of the multiple-area selection.

VBA Copy code Copy code
Sub DisplayColumnCount()
    Dim iAreaCount As Integer
    Dim i As Integer

    Worksheets("Sheet1").Activate
    iAreaCount = Selection.Areas.Count

    If iAreaCount <= 1 Then
        MsgBox "The selection contains " & Selection.Columns.Count & " columns."
    Else
        For i = 1 To iAreaCount
            MsgBox "Area " & i & " of the selection contains " & _
            Selection.Areas(i).Columns.Count & " columns."
        Next i
    End If
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CountLarge Property (Excel)

 Copy code hover
[image]

Range.CountLarge Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the number of objects in the collection. Read-only Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .CountLarge

expression A variable that represents a Range object.

Remarks

The CountLarge property is functionally the same as the Count property, except that the Count property will generate an overflow error if the specified range has more than 2,147,483,647 cells (one less than 2048 columns). The CountLarge property, however, can handle ranges up to the maximum size for a worksheet, which is 17,179,869,184 cells.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Creator Property (Excel)

 Copy code hover
[image]

Range.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Range object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CurrentArray Property (Excel)

 Copy code hover
[image]

Range.CurrentArray Property (Excel)
See also Send feedback

Published: July 16, 2012

If the specified cell is part of an array, returns a Range object that represents the entire array. Read-only.

Syntax

expression .CurrentArray

expression A variable that represents a Range object.

Example

This example assumes that cell A1 on Sheet1 is the active cell and that the active cell is part of an array that includes cells A1:A10. The example selects cells A1:A10 on Sheet1.

VBA Copy code Copy code
ActiveCell.CurrentArray.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CurrentRegion Property (Excel)

 Copy code hover
[image]

Range.CurrentRegion Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns. Read-only.

Syntax

expression .CurrentRegion

expression A variable that represents a Range object.

Remarks

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.

Example

This example selects the current region on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.CurrentRegion.Select

This example assumes that you have a table on Sheet1 that has a header row. The example selects the table, without selecting the header row. The active cell must be somewhere in the table before you run the example.

VBA Copy code Copy code
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
 tbl.Columns.Count).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Dependents Property (Excel)

 Copy code hover
[image]

Range.Dependents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing all the dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.

Syntax

expression .Dependents

expression A variable that represents a Range object.

Remarks

The Dependents property only works on the active sheet and can not trace remote references.

Example

This example selects the dependents of cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").Dependents.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DirectDependents Property (Excel)

 Copy code hover
[image]

Range.DirectDependents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing all the direct dependents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one dependent. Read-only Range object.

Syntax

expression .DirectDependents

expression A variable that represents a Range object.

Remarks

The Direct Dependents property only works on the active sheet and can not trace remote references.

Example

This example selects the direct dependents of cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").DirectDependents.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DirectPrecedents Property (Excel)

 Copy code hover
[image]

Range.DirectPrecedents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing all the direct precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only Range object.

Syntax

expression .DirectPrecedents

expression A variable that represents a Range object.

Remarks

The DirectPrecedents property only works on the active sheet and can not trace remote references.

Example

This example selects the direct precedents of cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").DirectPrecedents.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DisplayFormat Property (Excel)

 Copy code hover
[image]

Range.DisplayFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DisplayFormat object that represents the display settings for the specified range. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .DisplayFormat

expression A variable that represents a Range object.

Return Value

DisplayFormat

Remarks

Note that the DisplayFormat property does not work in user defined functions. For example, in a worksheet function that returns the interior color of a cell, you use a line similar to: Range(n).DisplayFormat.Interior.ColorIndex. When the worksheet function executes, it returns a #VALUE! error.

In another example, you cannot use the DisplayFormat property in a worksheet function to return settings for a particular range. DisplayFormat will work in a function called from Visual Basic for Applications (VBA), however. For instance, in the following function:

VBA Copy code Copy code
Function getColorIndex()
   getColorIndex = ActiveCell.DisplayFormat.Interior.ColorIndex
End Function

Calling the function from a worksheet as follows =getColorIndex() returns the #VALUE! error.

However, when the function is called from the Immediate pane in the Visual Basic Editor, it returns the color index for the active cell. To work around this issue, remove DisplayFormat from the code. The following function will work either from a worksheet or from VBA:

Copy code Copy code
Function getColorIndex()
   getColorIndex = ActiveCell.Interior.ColorIndex
End Function

See also

Concepts

Range Object

Other resources

Range Object Members


Range.End Property (Excel)

 Copy code hover
[image]

Range.End Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell at the end of the region that contains the source range. Equivalent to pressing END+UP ARROW, END+DOWN ARROW, END+LEFT ARROW, or END+RIGHT ARROW. Read-only Range object.

Syntax

expression .End(Direction)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | XlDirection | The direction in which to move.

Example

This example selects the cell at the top of column B in the region that contains cell B4.

VBA Copy code Copy code
Range("B4").End(xlUp).Select

This example selects the cell at the end of row 4 in the region that contains cell B4.

VBA Copy code Copy code
Range("B4").End(xlToRight).Select

This example extends the selection from cell B4 to the last cell in row four that contains data.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("B4", Range("B4").End(xlToRight)).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EntireColumn Property (Excel)

 Copy code hover
[image]

Range.EntireColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the entire column (or columns) that contains the specified range. Read-only.

Syntax

expression .EntireColumn

expression A variable that represents a Range object.

Example

This example sets the value of the first cell in the column that contains the active cell. The example must be run from a worksheet.

VBA Copy code Copy code
ActiveCell.EntireColumn.Cells(1, 1).Value = 5

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EntireRow Property (Excel)

 Copy code hover
[image]

Range.EntireRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the entire row (or rows) that contains the specified range. Read-only.

Syntax

expression .EntireRow

expression A variable that represents a Range object.

Example

This example sets the value of the first cell in the row that contains the active cell. The example must be run from a worksheet.

VBA Copy code Copy code
ActiveCell.EntireRow.Cells(1, 1).Value = 5

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example sorts all the rows on a worksheet, including hidden rows.

VBA Copy code Copy code
Sub SortAll()
    'Turn off screen updating, and define your variables.
    Application.ScreenUpdating = False
    Dim lngLastRow As Long, lngRow As Long
    Dim rngHidden As Range

    'Determine the number of rows in your sheet, and add the header row to the hidden range variable.
    lngLastRow = Cells(Rows.Count, 1).End(xlUp).Row
    Set rngHidden = Rows(1)

    'For each row in the list, if the row is hidden add that that row to the hidden range variable.
    For lngRow = 1 To lngLastRow
        If Rows(lngRow).Hidden = True Then
            Set rngHidden = Union(rngHidden, Rows(lngRow))
        End If
    Next lngRow

    'Unhide everything in the hidden range variable.
    rngHidden.EntireRow.Hidden = False

    'Perform the sort on all the data.
    Range("A1").CurrentRegion.Sort _
        key1:=Range("A2"), _
        order1:=xlAscending, _
        header:=xlYes

    'Re-hide the rows that were originally hidden, but unhide the header.
    rngHidden.EntireRow.Hidden = True
    Rows(1).Hidden = False

    'Turn screen updating back on.
    Set rngHidden = Nothing
    Application.ScreenUpdating = True
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Errors Property (Excel)

 Copy code hover
[image]

Range.Errors Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows the user to to access error checking options.

Syntax

expression .Errors

expression A variable that represents a Range object.

Remarks

Reference the Errors object to view a list of index values associated with error checking options.

Example

In this example, a number written as text is placed in cell A1. Microsoft Excel then determines if the number is written as text in cell A1 and notifies the user accordingly.

VBA Copy code Copy code
Sub CheckForErrors()

 Range("A1").Formula = "'12"

 If Range("A1").Errors.Item(xlNumberAsText).Value = True Then
 MsgBox "The number is written as text."
 Else
 MsgBox "The number is not written as text."
 End If

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Font Property (Excel)

 Copy code hover
[image]

Range.Font Property (Excel)
See also Send feedback

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a Range object.

Example

This example determines the if the font name for cell A1 is Arial and notifies the user.

VBA Copy code Copy code
Sub CheckFont()

 Range("A1").Select

 ' Determine if the font name for selected cell is Arial.
 If Range("A1").Font.Name = "Arial" Then
 MsgBox "The font name for this cell is 'Arial'"
 Else
 MsgBox "The font name for this cell is not 'Arial'"
 End If

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormatConditions Property (Excel)

 Copy code hover
[image]

Range.FormatConditions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FormatConditions collection that represents all the conditional formats for the specified range. Read-only.

Syntax

expression .FormatConditions

expression A variable that represents a Range object.

Example

This example modifies an existing conditional format for cells E1:E10.

VBA Copy code Copy code
Worksheets(1).Range("e1:e10").FormatConditions(1) _
 .Modify xlCellValue, xlLess, "=$a$1"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Formula Property (Excel)

 Copy code hover
[image]

Range.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the object's formula in A1-style notation and in the macro language.

Syntax

expression .Formula

expression A variable that represents a Range object.

Remarks

This property is not available for OLAP data sources.

If the cell contains a constant, this property returns the constant. If the cell is empty, this property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign (=)).

If you set the value or formula of a cell to a date, Microsoft Excel verifies that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

Example

The following code example sets the formula for cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Formula = "=$A$4+$A$10"

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example sets the formula for cell A1 on Sheet1 to display today's date.

VBA Copy code Copy code
Sub InsertTodaysDate()
    ' This macro will put today's date in cell A1 on Sheet1
    Sheets("Sheet1").Select
    Range("A1").Select
    Selection.Formula = "=text(now(),""mmm dd yyyy"")"
    Selection.Columns.AutoFit
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormulaArray Property (Excel)

 Copy code hover
[image]

Range.FormulaArray Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the array formula of a range. Returns (or can be set to) a single formula or a Visual Basic array. If the specified range doesn't contain an array formula, this property returns null. Read/write Variant.

Syntax

expression .FormulaArray

expression A variable that represents a Range object.

Remarks

If you use this property to enter an array formula, the formula must use the R1C1 reference style, not the A1 reference style (see the second example).

The FormulaArray property also has a character limit of 255.

Example

This example enters the number 3 as an array constant in cells A1:C5 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:C5").FormulaArray = "=3"

This example enters the array formula =SUM(R1C1:R3C3) in cells E1:E3 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("E1:E3").FormulaArray = _
 "=Sum(R1C1:R3C3)"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormulaHidden Property (Excel)

 Copy code hover
[image]

Range.FormulaHidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if the formula will be hidden when the worksheet is protected.

Syntax

expression .FormulaHidden

expression A variable that represents a Range object.

Remarks

This property returns True if the formula will be hidden when the worksheet is protected, Null if the specified range contains some cells withFormulaHidden equal to True and some cells with FormulaHidden equal to False.

Don't confuse this property with the Hidden property. The formula will not be hidden if the workbook is protected and the worksheet is not, but only if the worksheet is protected.

Example

This example hides the formulas in cells A1 and B1 on Sheet1 when the worksheet is protected.

VBA Copy code Copy code
Sub HideFormulas()

 Worksheets("Sheet1").Range("A1:B1").FormulaHidden = True

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormulaLocal Property (Excel)

 Copy code hover
[image]

Range.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write Variant.

Syntax

expression .FormulaLocal

expression A variable that represents a Range object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

Example

Assume that you enter the formula =SUM(A1:A10) in cell A11 on worksheet one, using the American English version of Microsoft Excel. If you then open the workbook on a computer that's running the German version and run the following example, the example displays the formula =SUMME(A1:A10) in a message box.

VBA Copy code Copy code
MsgBox Worksheets(1).Range("A11").FormulaLocal

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

Range.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write Variant.

Syntax

expression .FormulaR1C1

expression A variable that represents a Range object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

Example

This example sets the formula for cell B1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("B1").FormulaR1C1 = "=SQRT(R1C1)"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

Range.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write Variant.

Syntax

expression .FormulaR1C1Local

expression A variable that represents a Range object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

Example

Assume that you enter the formula =SUM(A1:A10) in cell A11 on worksheet one, using the American English version of Microsoft Excel. If you then open the workbook on a computer that's running the German version and run the following example, the example displays the formula =SUMME(Z1S1:Z10S1) in a message box.

VBA Copy code Copy code
MsgBox Worksheets(1).Range("A11").FormulaR1C1Local

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HasArray Property (Excel)

 Copy code hover
[image]

Range.HasArray Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified cell is part of an array formula. Read-only Variant.

Syntax

expression .HasArray

expression A variable that represents a Range object.

Example

This example displays a message if the active cell on Sheet1 is part of an array.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
If ActiveCell.HasArray =True Then
 MsgBox "The active cell is part of an array"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HasFormula Property (Excel)

 Copy code hover
[image]

Range.HasFormula Property (Excel)
See also Send feedback

Published: July 16, 2012

True if all cells in the range contain formulas; False if none of the cells in the range contains a formula; null otherwise. Read-only Variant.

Syntax

expression .HasFormula

expression A variable that represents a Range object.

Example

This example prompts the user to select a range on Sheet1. If every cell in the selected range contains a formula, the example displays a message.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set rr = Application.InputBox( _
 prompt:="Select a range on this worksheet", _
 Type:=8)
If rr.HasFormula = True Then
 MsgBox "Every cell in the selection contains a formula"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Height Property (Excel)

 Copy code hover
[image]

Range.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the height, in points, of the range.

Syntax

expression .Height

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Hidden Property (Excel)

 Copy code hover
[image]

Range.Hidden Property (Excel)
See also Send feedback

Returns or sets a Variant value that indicates if the rows or columns are hidden.

Syntax

expression .Hidden

expression A variable that represents a Range object.

Remarks

Set this property to True to hide a row or column. The specified range must span an entire column or row.

Don't confuse this property with the FormulaHidden property.

Example

This example hides column C on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("C").Hidden = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

Range.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a Range object.

Remarks

The value of this property can be set to one of the following constants:

xlCenter

xlDistributed

xlJustify

xlLeft

xlRight

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Hyperlinks Property (Excel)

 Copy code hover
[image]

Range.Hyperlinks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents the hyperlinks for the range.

Syntax

expression .Hyperlinks

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ID Property (Excel)

 Copy code hover
[image]

Range.ID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the identifying label for the specified cell when the page is saved as a Web page.

Syntax

expression .ID

expression A variable that represents a Range object.

Remarks

You can use an ID label as a hyperlink reference in other HTML documents or on the same Web page.

Example

This example sets the ID of cell A1 on the active worksheet to "target".

VBA Copy code Copy code
ActiveSheet.Range("A1").ID = "target"

Later, the document is saved as a Web page, and the following line of HTML is added to the Web page. When the user then views the page in a Web browser and clicks the hyperlink, the browser displays the cell.

VBA Copy code Copy code
<A HREF="#target">Quarterly earnings</A>

See also

Concepts

Range Object

Other resources

Range Object Members


Range.IndentLevel Property (Excel)

 Copy code hover
[image]

Range.IndentLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the indent level for the cell or range. Can be an integer from 0 to 15.

Syntax

expression .IndentLevel

expression A variable that represents a Range object.

Remarks

Using this property to set the indent level to a number less than 0 (zero) or greater than 15 causes an error.

Example

This example increases the indent level to 15 in cell A10.

VBA Copy code Copy code
With Range("A10")
 .IndentLevel = 15
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Interior Property (Excel)

 Copy code hover
[image]

Range.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object.

Syntax

expression .Interior

expression A variable that represents a Range object.

Example

This example sets the interior color for cell A1 on Sheet1 to cyan.

VBA Copy code Copy code
Sub SetColor()

 Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 8 ' Cyan

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Item Property (Excel)

 Copy code hover
[image]

Range.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a range at an offset to the specified range.

Syntax

expression .Item(RowIndex, ColumnIndex)

expression A variable that represents a Range object.

Parameters

Name

Required/Optional

Data Type

Description

RowIndex

Required

Variant

The index number of the cell you want to access, in order from left to right, then down.

VBA Copy code Copy code
Range.Item(1)

returns the upper-left cell in the range;

VBA Copy code Copy code
Range.Item(2)

returns the cell immediately to the right of the upper-left cell.

ColumnIndex

Optional

Variant

A number or string that indicates the column number of the cell you want to access, starting with either 1 or "A" for the first column in the range.

Remarks

Syntax 1 uses a row number and a column number or letter as index arguments. For more information about this syntax, see the Range object. The RowIndex and ColumnIndex arguments are relative offsets. In other words, specifying a RowIndex of 1 returns cells in the first row of the range, not the first row of the worksheet. For example, if the selection is cell C3, Selection.Cells(2, 2) returns cell D4 (you can use the Item property to index outside the original range).

Example

This example fills the range A1:A10 on Sheet1, based on the contents of cell A1.

VBA Copy code Copy code
Worksheets("Sheet1").Range.Item("A1:A10").FillDown

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Left Property (Excel)

 Copy code hover
[image]

Range.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the distance, in points, from the left edge of column A to the left edge of the range.

Syntax

expression .Left

expression A variable that represents a Range object.

Remarks

If the range is discontinuous, the first area is used. If the range is more than one column wide, the leftmost column in the range is used.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListHeaderRows Property (Excel)

 Copy code hover
[image]

Range.ListHeaderRows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of header rows for the specified range. Read-only Long.

Syntax

expression .ListHeaderRows

expression A variable that represents a Range object.

Remarks

Before you use this property, use the CurrentRegion property to find the boundaries of the range.

Example

This example sets the rTbl variable to the range represented by the current region for the active cell, not including any header rows.

VBA Copy code Copy code
Set rTbl = ActiveCell.CurrentRegion
' remove the headers from the range
iHdrRows = rTbl.ListHeaderRows
If iHdrRows > 0 Then
 ' resize the range minus n rows
 Set rTbl = rTbl.Resize(rTbl.Rows.Count - iHdrRows)
 ' and then move the resized range down to
 ' get to the first non-header row
 Set rTbl = rTbl.Offset(iHdrRows)
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListObject Property (Excel)

 Copy code hover
[image]

Range.ListObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListObject object for the Range object. Read-only ListObject object.

Syntax

expression .ListObject

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LocationInTable Property (Excel)

 Copy code hover
[image]

Range.LocationInTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a constant that describes the part of the PivotTable report that contains the upper-left corner of the specified range. Can be one of the following XlLocationInTable. constants. Read-only Long.

Syntax

expression .LocationInTable

expression A variable that represents a Range object.

Remarks

XlLocationInTable can be one of these XlLocationInTable constants.

xlRowHeader

xlColumnHeader

xlPageHeader

xlDataHeader

xlRowItem

xlColumnItem

xlPageItem

xlDataItem

xlTableBody

Example

This example displays a message box that describes the location of the active cell within the PivotTable report.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Select Case ActiveCell.LocationInTable
Case Is = xlRowHeader
 MsgBox "Active cell is part of a row header"
Case Is = xlColumnHeader
 MsgBox "Active cell is part of a column header"
Case Is = xlPageHeader
 MsgBox "Active cell is part of a page header"
Case Is = xlDataHeader
 MsgBox "Active cell is part of a data header"
Case Is = xlRowItem
 MsgBox "Active cell is part of a row item"
Case Is = xlColumnItem
 MsgBox "Active cell is part of a column item"
Case Is = xlPageItem
 MsgBox "Active cell is part of a page item"
Case Is = xlDataItem
 MsgBox "Active cell is part of a data item"
Case Is = xlTableBody
 MsgBox "Active cell is part of the table body"
End Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Locked Property (Excel)

 Copy code hover
[image]

Range.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a Range object.

Remarks

This property returns True if the object is locked, False if the object can be modified when the sheet is protected, or Null if the specified range contains both locked and unlocked cells.

Example

This example unlocks cells A1:G37 on Sheet1 so that they can be modified when the sheet is protected.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").Locked = False
Worksheets("Sheet1").Protect

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MDX Property (Excel)

 Copy code hover
[image]

Range.MDX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the MDX name for the specified Range object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .MDX

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MergeArea Property (Excel)

 Copy code hover
[image]

Range.MergeArea Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the merged range containing the specified cell. If the specified cell isn't in a merged range, this property returns the specified cell. Read-only Variant.

Syntax

expression .MergeArea

expression A variable that represents a Range object.

Remarks

The MergeArea property only works on a single-cell range.

Example

This example sets the value of the merged range that contains cell A3.

VBA Copy code Copy code
Set ma = Range("a3").MergeArea
If ma.Address = "$A$3" Then
 MsgBox "not merged"
Else
 ma.Cells(1, 1).Value = "42"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MergeCells Property (Excel)

 Copy code hover
[image]

Range.MergeCells Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the range contains merged cells. Read/write Variant.

Syntax

expression .MergeCells

expression A variable that represents a Range object.

Remarks

When you select a range that contains merged cells, the resulting selection may be different from the intended selection. Use the Address property to check the address of the selected range.

Example

This example sets the value of the merged range that contains cell A3.

VBA Copy code Copy code
Set ma = Range("a3").MergeArea
If Range("a3").MergeCells Then
 ma.Cells(1, 1).Value = "42"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Name Property (Excel)

 Copy code hover
[image]

Range.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Range object.

Remarks

The name of a Range object is a Name object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Next Property (Excel)

 Copy code hover
[image]

Range.Next Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the next cell.

Syntax

expression .Next

expression A variable that represents a Range object.

Remarks

If the object is a range, this property emulates the TAB key, although the property returns the next cell without selecting it.

On a protected sheet, this property returns the next unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the right of the specified cell.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NumberFormat Property (Excel)

 Copy code hover
[image]

Range.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a Range object.

Remarks

This property returns Null if all cells in the specified range don't have the same number format.

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

Example

These examples set the number format for cell A17, row one, and column C (respectively) on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A17").NumberFormat = "General"
Worksheets("Sheet1").Rows(1).NumberFormat = "hh:mm:ss"
Worksheets("Sheet1").Columns("C"). _
 NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

Range.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a Range object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

Example

This example displays the number format for cell A1 on Sheet1 in the language of the user.

VBA Copy code Copy code
MsgBox "The number format for cell A1 is " & _
 Worksheets("Sheet1").Range("A1").NumberFormatLocal

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Offset Property (Excel)

 Copy code hover
[image]

Range.Offset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a range that's offset from the specified range.

Syntax

expression .Offset(RowOffset, ColumnOffset)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RowOffset | Optional | Variant | The number of rows (positive, negative, or 0 (zero)) by which the range is to be offset. Positive values are offset downward, and negative values are offset upward. The default value is 0.
ColumnOffset | Optional | Variant | The number of columns (positive, negative, or 0 (zero)) by which the range is to be offset. Positive values are offset to the right, and negative values are offset to the left. The default value is 0.

Example

This example activates the cell three columns to the right of and three rows down from the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Offset(rowOffset:=3, columnOffset:=3).Activate

This example assumes that Sheet1 contains a table that has a header row. The example selects the table, without selecting the header row. The active cell must be somewhere in the table before the example is run.

VBA Copy code Copy code
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
 tbl.Columns.Count).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Orientation Property (Excel)

 Copy code hover
[image]

Range.Orientation Property (Excel)
See also Send feedback

Returns or sets a Variant value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a Range object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees or to one of the following constants:

xlDownward

xlHorizontal

xlUpward

xlVertical

See also

Concepts

Range Object

Other resources

Range Object Members


Range.OutlineLevel Property (Excel)

 Copy code hover
[image]

Range.OutlineLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the current outline level of the specified row or column. Read/write Variant.

Syntax

expression .OutlineLevel

expression A variable that represents a Range object.

Remarks

Level one is the outermost summary level.

Example

This example sets the outline level for row two on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(2).OutlineLevel = 1

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PageBreak Property (Excel)

 Copy code hover
[image]

Range.PageBreak Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of a page break. Can be one of the following XlPageBreak constants: xlPageBreakAutomatic, xlPageBreakManual, or xlPageBreakNone. Read/write Long.

Syntax

expression .PageBreak

expression A variable that represents a Range object.

Remarks

This property can return the location of either automatic or manual page breaks, but it can only set the location of manual breaks (it can only be set to xlPageBreakManual or xlPageBreakNone).

To remove all manual page breaks on a worksheet, set Cells.PageBreak to xlPageBreakNone.

Example

This example sets a manual page break above row 25 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakManual

This example sets a manual page break to the left of column J on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("J").PageBreak = xlPageBreakManual

This example deletes the two page breaks that were set in the preceding examples.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakNone
Worksheets("Sheet1").Columns("J").PageBreak = xlNone

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Parent Property (Excel)

 Copy code hover
[image]

Range.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Phonetic Property (Excel)

 Copy code hover
[image]

Range.Phonetic Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Phonetic object, which contains information about a specific phonetic text string in a cell.

Syntax

expression .Phonetic

expression An expression that returns a Range object.

Return Value

Phonetic

Remarks

This property provides compatibility with earlier versions of Microsoft Excel. You should use Phonetics(index), where index is the index number of the phonetic text, to return a single Phonetic object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Phonetics Property (Excel)

 Copy code hover
[image]

Range.Phonetics Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Phonetics collection of the range. Read only.

Syntax

expression .Phonetics

expression A variable that represents a Range object.

Example

This example displays all of the Phonetic objects in the active cell.

VBA Copy code Copy code
Set objPhon = ActiveCell.Phonetics
With objPhon
 For Each objPhonItem in objPhon
 MsgBox "Phonetic object: " & .Text
 Next
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PivotCell Property (Excel)

 Copy code hover
[image]

Range.PivotCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotCell object that represents a cell in a PivotTable report.

Syntax

expression .PivotCell

expression A variable that represents a Range object.

Example

This example determines the name of the PivotTable the PivotCell object is located in and notifies the user. The example assumes that a PivotTable exists on the active worksheet and that cell A3 is located in the PivotTable.

VBA Copy code Copy code
Sub CheckPivotCell()

 'Determine the name of the PivotTable the PivotCell is located in.
 MsgBox "Cell A3 is located in PivotTable: " & _
 Application.Range("A3").PivotCell.Parent

End Sub

See also

Concepts

Range Object
ValueChange Object

Other resources

ValueChange Object Members
Range Object Members


Range.PivotField Property (Excel)

 Copy code hover
[image]

Range.PivotField Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotField object that represents the PivotTable field containing the upper-left corner of the specified range.

Syntax

expression .PivotField

expression A variable that represents a Range object.

Example

This example displays the name of the PivotTable field that contains the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active cell is in the field " & _
 ActiveCell.PivotField.Name

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PivotItem Property (Excel)

 Copy code hover
[image]

Range.PivotItem Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotItem object that represents the PivotTable item containing the upper-left corner of the specified range.

Syntax

expression .PivotItem

expression A variable that represents a Range object.

Example

This example displays the name of the PivotTable item that contains the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The active cell is in the item " & _
 ActiveCell.PivotItem.Name

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PivotTable Property (Excel)

 Copy code hover
[image]

Range.PivotTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.

Syntax

expression .PivotTable

expression A variable that represents a Range object.

Example

This example sets the current page for the PivotTable report on Sheet1 to the page named "Canada."

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
pvtTable.PivotFields("Country").CurrentPage = "Canada"

This example determines the PivotTable report associated with the Sales chart on the active worksheet, and then it sets the page named "Oregon" as the current page for the PivotTable report.

VBA Copy code Copy code
Set objPT = _
 ActiveSheet.Charts("Sales").PivotLayout.PivotTable
objPT.PivotFields("State").CurrentPageName = "Oregon"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Precedents Property (Excel)

 Copy code hover
[image]

Range.Precedents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the precedents of a cell. This can be a multiple selection (a union of Range objects) if there's more than one precedent. Read-only.

Syntax

expression .Precedents

expression A variable that represents a Range object.

Example

This example selects the precedents of cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").Precedents.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PrefixCharacter Property (Excel)

 Copy code hover
[image]

Range.PrefixCharacter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the prefix character for the cell. Read-only Variant.

Syntax

expression .PrefixCharacter

expression A variable that represents a Range object.

Remarks

If the TransitionNavigKeys property is False, this prefix character will be ' for a text label, or blank. If the TransitionNavigKeys property is True, this character will be ' for a left-justified label, " for a right-justified label, ^ for a centered label, \ for a repeated label, or blank.

Example

This example displays the prefix character for cell A1 on Sheet1.

VBA Copy code Copy code
MsgBox "The prefix character is " & _
 Worksheets("Sheet1").Range("A1").PrefixCharacter

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Previous Property (Excel)

 Copy code hover
[image]

Range.Previous Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the next cell.

Syntax

expression .Previous

expression A variable that represents a Range object.

Remarks

If the object is a range, this property emulates pressing SHIFT+TAB; unlike the key combination, however, the property returns the previous cell without selecting it.

On a protected sheet, this property returns the previous unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the left of the specified cell.

Example

This example selects the previous unlocked cell on Sheet1. If Sheet1 is unprotected, this is the cell immediately to the left of the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Previous.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.QueryTable Property (Excel)

 Copy code hover
[image]

Range.QueryTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a QueryTable object that represents the query table that intersects the specified Range object.

Syntax

expression .QueryTable

expression A variable that represents a Range object.

Example

This example refreshes the QueryTable object that intersects cell A10 on worksheet one.

VBA Copy code Copy code
Worksheets(1).Range("a10").QueryTable.Refresh

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Range Property (Excel)

 Copy code hover
[image]

Range.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a cell or a range of cells.

Syntax

expression .Range(Cell1, Cell2)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cell1 | Required | Variant | The name of the range. This must be an A1-style reference in the language of the macro. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but they're ignored. You can use a local defined name in any part of the range. If you use a name, the name is assumed to be in the language of the macro.
Cell2 | Optional | Variant | The cell in the upper-left and lower-right corner of the range. Can be a Range object that contains a single cell, an entire column, or entire row, or it can be a string that names a single cell in the language of the macro.

Remarks

When used without an object qualifier, this property is a shortcut for ActiveSheet.Range (it returns a range from the active sheet; if the active sheet isn't a worksheet, the property fails).

When applied to a Range object, the property is relative to the Range object. For example, if the selection is cell C3, then Selection.Range("B1") returns cell D3 because it's relative to the Range object returned by the Selection property. On the other hand, the code ActiveSheet.Range("B1") always returns cell B1.

Example

This example sets the value of cell A1 on Sheet1 to 3.14159.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Value = 3.14159

This example creates a formula in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Formula = "=10*RAND()"

This example loops on cells A1:D10 on Sheet1. If one of the cells has a value less than 0.001, the code replaces that value with 0 (zero).

VBA Copy code Copy code
For Each c in Worksheets("Sheet1").Range("A1:D10")
 If c.Value < .001 Then
 c.Value = 0
 End If
Next c

This example loops on the range named "TestRange" and displays the number of empty cells in the range.

VBA Copy code Copy code
numBlanks = 0
For Each c In Range("TestRange")
 If c.Value = "" Then
 numBlanks = numBlanks + 1
 End If
Next c
MsgBox "There are " & numBlanks & " empty cells in this range"

This example sets the font style in cells A1:C5 on Sheet1 to italic. The example uses Syntax 2 of the Range property.

VBA Copy code Copy code
Worksheets("Sheet1").Range(Cells(1, 1), Cells(5, 3)). _
 Font.Italic = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ReadingOrder Property (Excel)

 Copy code hover
[image]

Range.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Resize Property (Excel)

 Copy code hover
[image]

Range.Resize Property (Excel)
See also Send feedback

Published: July 16, 2012

Resizes the specified range. Returns a Range object that represents the resized range.

Syntax

expression .Resize(RowSize, ColumnSize)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RowSize | Optional | Variant | The number of rows in the new range. If this argument is omitted, the number of rows in the range remains the same.
ColumnSize | Optional | Variant | The number of columns in the new range. If this argument is omitted, the number of columns in the range remains the same.

Return Value

Range

Example

This example resizes the selection on Sheet1 to extend it by one row and one column.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
numRows = Selection.Rows.Count
numColumns = Selection.Columns.Count
Selection.Resize(numRows + 1, numColumns + 1).Select

This example assumes that you have a table on Sheet1 that has a header row. The example selects the table, without selecting the header row. The active cell must be somewhere in the table before you run the example.

VBA Copy code Copy code
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
 tbl.Columns.Count).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Row Property (Excel)

 Copy code hover
[image]

Range.Row Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of the first row of the first area in the range. Read-only Long.

Syntax

expression .Row

expression A variable that represents a Range object.

Example

This example sets the row height of every other row on Sheet1 to 4 points.

VBA Copy code Copy code
For Each rw In Worksheets("Sheet1").Rows
    If rw.Row Mod 2 = 0 Then
        rw.RowHeight = 4
    End If
Next rw

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributors

This example uses the BeforeDoubleClick worksheet event to copy a row of data from one worksheet to another. To run this code, the name of the target worksheet must be in column A. When you double click a cell that contains data, this example gets the target worksheet name from column A and copies the entire row of data into the next available row on the target worksheet. This example accesses the active row using the Target keyword.

Copy code Copy code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    'If the double click occurs on the header row or an empty cell, exit the macro.
    If Target.Row = 1 Then Exit Sub
    If Target.Row > ActiveSheet.UsedRange.Rows.Count Then Exit Sub
    If Target.Column > ActiveSheet.UsedRange.Columns.Count Then Exit Sub

    'Override the default double-click behavior with this function.
    Cancel = True

    'Declare your variables.
    Dim wks As Worksheet, xRow As Long

    'If an error occurs, use inline error handling.
    On Error Resume Next

    'Set the target worksheet as the worksheet whose name is listed in the first cell of the current row.
    Set wks = Worksheets(CStr(Cells(Target.Row, 1).Value))
    'If there is an error, exit the macro.
    If Err > 0 Then
        Err.Clear
        Exit Sub
    'Otherwise, find the next empty row in the target worksheet and copy the data into that row.
    Else
        xRow = wks.Cells(wks.Rows.Count, 1).End(xlUp).Row + 1
        wks.Range(wks.Cells(xRow, 1), wks.Cells(xRow, 7)).Value = _
        Range(Cells(Target.Row, 1), Cells(Target.Row, 7)).Value
    End If
End Sub

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributors

This example deletes the empty rows from a selected range.

VBA Copy code Copy code
Sub Delete_Empty_Rows()
    'The range from which to delete the rows.
    Dim rnSelection As Range

    'Row and count variables used in the deletion process.
    Dim lnLastRow As Long
    Dim lnRowCount As Long
    Dim lnDeletedRows As Long

    'Initialize the number of deleted rows.
    lnDeletedRows = 0

    'Confirm that a range is selected, and that the range is contiguous.
    If TypeName(Selection) = "Range" Then
        If Selection.Areas.Count = 1 Then

            'Initialize the range to what the user has selected, and initialize the count for the upcoming FOR loop.
            Set rnSelection = Application.Selection
            lnLastRow = rnSelection.Rows.Count

            'Start at the bottom row and work up: if the row is empty then
            'delete the row and increment the deleted row count.
            For lnRowCount = lnLastRow To 1 Step -1
                If Application.CountA(rnSelection.Rows(lnRowCount)) = 0 Then
                    rnSelection.Rows(lnRowCount).Delete
                    lnDeletedRows = lnDeletedRows + 1
                End If
            Next lnRowCount

            rnSelection.Resize(lnLastRow - lnDeletedRows).Select
         Else
            MsgBox "Please select only one area.", vbInformation
         End If
    Else
        MsgBox "Please select a range.", vbInformation
    End If

    'Turn screen updating back on.
    Application.ScreenUpdating = True

End Sub

About the Contributors

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."

See also

Concepts

Range Object

Other resources

Range Object Members


Range.RowHeight Property (Excel)

 Copy code hover
[image]

Range.RowHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the first row in the range specified, measured in points. Read/write Variant.

Syntax

expression .RowHeight

expression A variable that represents a Range object.

Remarks

You can use the Height property to return the total height of a range of cells.

Note Note

If a merged cell is in the range, RowHeight returns Null for varied row heights.

Example

This example doubles the height of row one on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").Rows(1)
 .RowHeight = .RowHeight * 2
End With

See also

Concepts

Slicer Object
Range Object

Other resources

Slicer Object Members
Range Object Members


Range.Rows Property (Excel)

 Copy code hover
[image]

Range.Rows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the rows in the specified range. Read-only Range object.

Syntax

expression .Rows

expression A variable that represents a Range object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Rows.

When applied to a Range object that's a multiple selection, this property returns rows from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Rows.Count returns 2, not 4. To use this property on a range that may contain a multiple selection, test Areas.Count to determine whether the range is a multiple selection. If it is, loop over each area in the range, as shown in the third example.

Example

This example deletes row three on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(3).Delete

This example deletes rows in the current region on worksheet one where the value of cell one in the row is the same as the value in cell one in the previous row.

VBA Copy code Copy code
For Each rw In Worksheets(1).Cells(1, 1).CurrentRegion.Rows
 this = rw.Cells(1, 1).Value
 If this = last Then rw.Delete
 last = this
Next

This example displays the number of rows in the selection on Sheet1. If more than one area is selected, the example loops through each area.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
 MsgBox "The selection contains " & _
 Selection.Rows.Count & " rows."
Else
 i = 1
 For Each a In Selection.Areas
 MsgBox "Area " & i & " of the selection contains " & _
 a.Rows.Count & " rows."
 i = i + 1
 Next a
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ServerActions Property (Excel)

 Copy code hover
[image]

Range.ServerActions Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the actions that can be performed on the SharePoint server for a Range object.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerActions

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShowDetail Property (Excel)

 Copy code hover
[image]

Range.ShowDetail Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the outline is expanded for the specified range (so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline. Read/write Variant. For the PivotItem object (or the Range object if the range is in a PivotTable report), this property is set to True if the item is showing detail.

Syntax

expression .ShowDetail

expression A variable that represents a Range object.

Remarks

This property isn't available for OLAP data sources.

If the specified range isn't in a PivotTable report, the following statements are true:

  • The range must be in a single summary row or column.

  • This property returns False if any of the children of the row or column are hidden.

  • Setting this property to True is equivalent to unhiding all the children of the summary row or column.

  • Setting this property to False is equivalent to hiding all the children of the summary row or column.

If the specified range is in a PivotTable report, it's possible to set this property for more than one cell at a time if the range is contiguous. This property can be returned only if the range is a single cell.

Example

This example shows detail for the summary row of an outline on Sheet1. Before running this example, create a simple outline that contains a single summary row, and then collapse the outline so that only the summary row is showing. Select one of the cells in the summary row, and then run the example.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set myRange = ActiveCell.CurrentRegion
lastRow = myRange.Rows.Count
myRange.Rows(lastRow).ShowDetail = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShrinkToFit Property (Excel)

 Copy code hover
[image]

Range.ShrinkToFit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if text automatically shrinks to fit in the available column width.

Syntax

expression .ShrinkToFit

expression A variable that represents a Range object.

Remarks

This property returns True if text automatically shrinks to fit in the available column width, or Null if this property isn't set to the same value for all cells in the specified range.

Example

This example causes text in row one to automatically shrink to fit in the available column width.

VBA Copy code Copy code
Rows(1).ShrinkToFit = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SoundNote Property (Excel)

 Copy code hover
[image]

Range.SoundNote Property (Excel)
See also Send feedback

Published: July 16, 2012

This property should not be used. Sound notes have been removed from Microsoft Excel.

Syntax

expression .SoundNote

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SparklineGroups Property (Excel)

 Copy code hover
[image]

Range.SparklineGroups Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparklineGroups object that represents an existing group of sparklines from the specified range. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SparklineGroups

expression A variable that represents a Range object.

Return Value

SparklineGroups

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Style Property (Excel)

 Copy code hover
[image]

Range.Style Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing a Style object, that represents the style of the specified range.

Syntax

expression .Style

expression A variable that represents a Range object.

Example

This example applies the Normal style to cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.Name = "Normal"

If cell B4 on Sheet1 currently has the Normal style applied, this example applies the Percent style.

VBA Copy code Copy code
If Worksheets("Sheet1").Range("B4").Style.Name = "Normal" Then
 Worksheets("Sheet1").Range("B4").Style.Name = "Percent"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Summary Property (Excel)

 Copy code hover
[image]

Range.Summary Property (Excel)
Send feedback

Published: July 16, 2012

True if the range is an outlining summary row or column. The range should be a row or a column. Read-only Variant.

Syntax

expression .Summary

expression A variable that represents a Range object.

Example

This example formats row four on Sheet1 as bold and italic if it's an outlining summary column.

VBA Copy code Copy code
With Worksheets("Sheet1").Rows(4)
 If .Summary = True Then
 .Font.Bold = True
 .Font.Italic = True
 End If
End With


Range.Text Property (Excel)

 Copy code hover
[image]

Range.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read-only String.

Syntax

expression .Text

expression A variable that represents a Range object.

Example

This example illustrates the difference between the Text and Value properties of cells that contain formatted numbers.

VBA Copy code Copy code
Set c = Worksheets("Sheet1").Range("B14")
c.Value = 1198.3
c.NumberFormat = "$#,##0_);($#,##0)"
MsgBox c.Value
MsgBox c.Text

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Top Property (Excel)

 Copy code hover
[image]

Range.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the distance, in points, from the top edge of row 1 to the top edge of the range.

Syntax

expression .Top

expression A variable that represents a Range object.

Remarks

If the range is discontinuous, the first area is used. If the range is more than one row high, the top (lowest numbered) row in the range is used.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.UseStandardHeight Property (Excel)

 Copy code hover
[image]

Range.UseStandardHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the row height of the Range object equals the standard height of the sheet. Returns Null if the range contains more than one row and the rows aren't all the same height. Read/write Variant.

Syntax

expression .UseStandardHeight

expression A variable that represents a Range object.

Example

This example sets the height of row one on Sheet1 to the standard height.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(1).UseStandardHeight = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.UseStandardWidth Property (Excel)

 Copy code hover
[image]

Range.UseStandardWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the column width of the Range object equals the standard width of the sheet. Returns null if the range contains more than one column and the columns aren't all the same width. Read/write Variant.

Syntax

expression .UseStandardWidth

expression A variable that represents a Range object.

Example

This example sets the width of column A on Sheet1 to the standard width.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("A").UseStandardWidth = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Validation Property (Excel)

 Copy code hover
[image]

Range.Validation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Validation object that represents data validation for the specified range. Read-only.

Syntax

expression .Validation

expression A variable that represents a Range object.

Example

This example causes data validation for cell E5 to allow blank values.

VBA Copy code Copy code
Range("e5").Validation.IgnoreBlank = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Value Property (Excel)

 Copy code hover
[image]

Range.Value Property (Excel)
See also Send feedback

Returns or sets a Variant value that represents the value of the specified range.

Syntax

expression .Value(RangeValueDataType)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RangeValueDataType | Optional | Variant | The range value data type. Can be a xlRangeValueDataType constant.

Remarks

When setting a range of cells with the contents of an XML spreadsheet file, only values of the first sheet in the workbook are used. You cannot set or get a discontiguous range of cells in the XML spreadsheet format.

Example

This example sets the value of cell A1 on Sheet1 to 3.14159.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Value = 3.14159

This example loops on cells A1:D10 on Sheet1. If one of the cells has a value less than 0.001, the code replaces the value with 0 (zero).

VBA Copy code Copy code
For Each c in Worksheets("Sheet1").Range("A1:D10")
 If c.Value < .001 Then
 c.Value = 0
 End If
Next c

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Value2 Property (Excel)

 Copy code hover
[image]

Range.Value2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the cell value. Read/write Variant.

Syntax

expression .Value2

expression A variable that represents a Range object.

Remarks

The only difference between this property and the Value property is that the Value2 property doesn't use the Currency and Date data types. You can return values formatted with these data types as floating-point numbers by using the Double data type.

Example

This example uses the Value2 property to add the values of two cells.

VBA Copy code Copy code
Range("a1").Value2 = Range("b1").Value2 + Range("c1").Value2

See also

Concepts

Range Object

Other resources

Range Object Members


Range.VerticalAlignment Property (Excel)

 Copy code hover
[image]

Range.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a Range object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom

xlCenter

xlDistributed

xlJustify

xlTop

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Width Property (Excel)

 Copy code hover
[image]

Range.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the width, in units, of the range.

Syntax

expression .Width

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Worksheet Property (Excel)

 Copy code hover
[image]

Range.Worksheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Worksheet object that represents the worksheet containing the specified range. Read-only.

Syntax

expression .Worksheet

expression A variable that represents a Range object.

Example

This example displays the name of the worksheet that contains the active cell. The example must be run from a worksheet.

VBA Copy code Copy code
MsgBox ActiveCell.Worksheet.Name

This example displays the name of the worksheet that contains the range named "testRange."

VBA Copy code Copy code
MsgBox Range("testRange").Worksheet.Name

See also

Concepts

Range Object

Other resources

Range Object Members


Range.WrapText Property (Excel)

 Copy code hover
[image]

Range.WrapText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that indicates if Microsoft Excel wraps the text in the object.

Syntax

expression .WrapText

expression A variable that represents a Range object.

Remarks

This property returns True if text is wrapped in all cells within the specified range, False if text is not wrapped in all cells within the specified range, or Null if the specified range contains some cells that wrap text and other cells that don't.

Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range.

Example

This example formats cell B2 on Sheet1 so that the text wraps within the cell.

VBA Copy code Copy code
Worksheets("Sheet1").Range("B2").Value = _
 "This text should wrap in a cell."
Worksheets("Sheet1").Range("B2").WrapText = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.XPath Property (Excel)

 Copy code hover
[image]

Range.XPath Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XPath object that represents the Xpath of the element mapped to the specified Range object. The context of the range determines whether or not the action succeeds or returns an empty object. Read-only.

Syntax

expression .XPath

expression A variable that represents a Range object.

Remarks

The XPath property is valid when the range it contains meets the following conditions:

  • The range is a single cell.

  • If the range consists of two or more cells, then one or the other must be true:

    1. If the cells contain XPath information, then all cells in the range must contain XPath information (that is, each cell is associated with one or more data maps), and all of the cells must have identical XPath content (that is, each cell contributes to the same set of data maps).

    2. All of the cells must contain no XPath information.

  • The range does not contain discontinuous areas.

    Note Note

    The header and totals row of a table are considered to contain XPath information.

Any ranges that don't meet the above conditions returns a runtime error.

If the range selection is valid, but none of the cells are mapped, Excel returns an XPath object so that you can access the SetValue method to create a mapping.

See also

Concepts

Range Object

Other resources

Range Object Members


Range Methods (Excel)

 Copy code hover
[image]

Range Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates a single cell, which must be inside the current selection. To select a range of cells, use the Select method.
AddComment | Adds a comment to the range.
AdvancedFilter | Filters or copies data from a list based on a criteria range. If the initial selection is a single cell, that cell's current region is used.
AllocateChanges | Performs a writeback operation for all edited cells in a range based on an OLAP data source.
ApplyNames | Applies names to the cells in the specified range.
ApplyOutlineStyles | Applies outlining styles to the specified range.
AutoComplete | Returns an AutoComplete match from the list. If there's no AutoComplete match or if more than one entry in the list matches the string to complete, this method returns an empty string.
AutoFill | Performs an autofill on the cells in the specified range.
AutoFilter | Filters a list using the AutoFilter.
AutoFit | Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.
AutoOutline | Automatically creates an outline for the specified range. If the range is a single cell, Microsoft Excel creates an outline for the entire sheet. The new outline replaces any existing outline.
BorderAround | Adds a border to a range and sets the Color, LineStyle, and Weight properties for the new border. Variant.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
CalculateRowMajorOrder | Calculates a specfied range of cells.
CheckSpelling | Checks the spelling of an object.
Clear | Clears the entire object.
ClearComments | Clears all cell comments from the specified range.
ClearContents | Clears the formulas from the range.
ClearFormats | Clears the formatting of the object.
ClearHyperlinks | Removes all hyperlinks from the specified range.
ClearNotes | Clears notes and sound notes from all the cells in the specified range.
ClearOutline | Clears the outline for the specified range.
ColumnDifferences | Returns a Range object that represents all the cells whose contents are different from the comparison cell in each column.
Consolidate | Consolidates data from multiple ranges on multiple worksheets into a single range on a single worksheet. Variant.
Copy | Copies the range to the specified range or to the Clipboard.
CopyFromRecordset | Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range. If the Recordset object contains fields with OLE objects in them, this method fails.
CopyPicture | Copies the selected object to the Clipboard as a picture. Variant.
CreateNames | Creates names in the specified range, based on text labels in the sheet.
Cut | Cuts the object to the Clipboard or pastes it into a specified destination.
DataSeries | Creates a data series in the specified range. Variant.
Delete | Deletes the object.
DialogBox | Displays a dialog box defined by a dialog box definition table on a Microsoft Excel 4.0 macro sheet. Returns the number of the chosen control, or returns False if the user clicks the Cancel button.
Dirty | Designates a range to be recalculated when the next recalculation occurs.
DiscardChanges | Discards all changes in the edited cells of the range.
EditionOptions | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ExportAsFixedFormat | Exports to a file of the specified format.
FillDown | Fills down from the top cell or cells in the specified range to the bottom of the range. The contents and formatting of the cell or cells in the top row of a range are copied into the rest of the rows in the range.
FillLeft | Fills left from the rightmost cell or cells in the specified range. The contents and formatting of the cell or cells in the rightmost column of a range are copied into the rest of the columns in the range.
FillRight | Fills right from the leftmost cell or cells in the specified range. The contents and formatting of the cell or cells in the leftmost column of a range are copied into the rest of the columns in the range.
FillUp | Fills up from the bottom cell or cells in the specified range to the top of the range. The contents and formatting of the cell or cells in the bottom row of a range are copied into the rest of the rows in the range.
Find | Finds specific information in a range.
FindNext | Continues a search that was begun with the Find method. Finds the next cell that matches those same conditions and returns a Range object that represents that cell. This does not affect the selection or the active cell.
FindPrevious | Continues a search that was begun with the Find method. Finds the previous cell that matches those same conditions and returns a Range object that represents that cell. Doesn't affect the selection or the active cell.
FlashFill | TRUE indicates that the Excel Flash Fill feature has been enabled and active.
FunctionWizard | Starts the Function Wizard for the upper-left cell of the range.
Group | When the Range object represents a single cell in a PivotTable field's data range, the Group method performs numeric or date-based grouping in that field.
Insert | Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to make space.
InsertIndent | Adds an indent to the specified range.
Justify | Rearranges the text in a range so that it fills the range evenly.
ListNames | Pastes a list of all nonhidden names onto the worksheet, beginning with the first cell in the range.
Merge | Creates a merged cell from the specified Range object.
NavigateArrow | Navigates a tracer arrow for the specified range to the precedent, dependent, or error-causing cell or cells. Selects the precedent, dependent, or error cells and returns a Range object that represents the new selection. This method causes an error if it's applied to a cell without visible tracer arrows.
NoteText | Returns or sets the cell note associated with the cell in the upper-left corner of the range. Read/write String. Cell notes have been replaced by range comments. For more information, see the Comment object.
Parse | Parses a range of data and breaks it into multiple cells. Distributes the contents of the range to fill several adjacent columns; the range can be no more than one column wide.
PasteSpecial | Pastes a Range from the Clipboard into the specified range.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
RemoveDuplicates | Removes duplicate values from a range of values.
RemoveSubtotal | Removes subtotals from a list.
Replace | Returns a Boolean indicating characters in cells within the specified range. Using this method doesn't change either the selection or the active cell.
RowDifferences | Returns a Range object that represents all the cells whose contents are different from those of the comparison cell in each row.
Run | Runs the Microsoft Excel macro at this location. The range must be on a macro sheet.
Select | Selects the object.
SetPhonetic | Creates Phonetic objects for all the cells in the specified range.
Show | Scrolls through the contents of the active window to move the range into view. The range must consist of a single cell in the active document.
ShowDependents | Draws tracer arrows to the direct dependents of the range.
ShowErrors | Draws tracer arrows through the precedents tree to the cell that's the source of the error, and returns the range that contains that cell.
ShowPrecedents | Draws tracer arrows to the direct precedents of the range.
Sort | Sorts a range of values.
SortSpecial | Uses East Asian sorting methods to sort the range, a PivotTable report, or uses the method for the active region if the range contains only one cell. For example, Japanese sorts in the order of the Kana syllabary.
Speak | Causes the cells of the range to be spoken in row order or column order.
SpecialCells | Returns a Range object that represents all the cells that match the specified type and value.
SubscribeTo | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Subtotal | Creates subtotals for the range (or the current region, if the range is a single cell).
Table | Creates a data table based on input values and formulas that you define on a worksheet.
TextToColumns | Parses a column of cells that contain text into several columns.
Ungroup | Promotes a range in an outline (that is, decreases its outline level). The specified range must be a row or column, or a range of rows or columns. If the range is in a PivotTable report, this method ungroups the items contained in the range.
UnMerge | Separates a merged area into individual cells.


Range.Activate Method (Excel)

 Copy code hover
[image]

Range.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates a single cell, which must be inside the current selection. To select a range of cells, use the Select method.

Syntax

expression .Activate

expression A variable that represents a Range object.

Return Value

Variant

Example

This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1:C3").Select
Range("B2").Activate

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AddComment Method (Excel)

 Copy code hover
[image]

Range.AddComment Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a comment to the range.

Syntax

expression .AddComment(Text)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Optional | Variant | The comment text.

Return Value

Comment

Example

This example adds a comment to cell E5 on worksheet one.

VBA Copy code Copy code
Worksheets(1).Range("E5").AddComment "Current Sales"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AdvancedFilter Method (Excel)

 Copy code hover
[image]

Range.AdvancedFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

Filters or copies data from a list based on a criteria range. If the initial selection is a single cell, that cell's current region is used.

Syntax

expression .AdvancedFilter(Action, CriteriaRange, CopyToRange, Unique)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Action | Required | XlFilterAction | One of the constants of XlFilterAction specifying whether to make a copy or filter the list in place.
CriteriaRange | Optional | Variant | The criteria range. If this argument is omitted, there are no criteria.
CopyToRange | Optional | Variant | The destination range for the copied rows if Action is xlFilterCopy. Otherwise, this argument is ignored.
Unique | Optional | Variant | True to filter unique records only. False to filter all records that meet the criteria. The default value is False.

Return Value

Variant

Example

This example filters a database (named "Database") based on a criteria range named "Criteria."

VBA Copy code Copy code
Range("Database").AdvancedFilter _
 Action:=xlFilterInPlace, _
 CriteriaRange:=Range("Criteria")

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AllocateChanges Method (Excel)

 Copy code hover
[image]

Range.AllocateChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Performs a writeback operation for all edited cells in a range based on an OLAP data source.

Version Information

Version Added: Excel 2010

Syntax

expression .AllocateChanges

expression A variable that represents a Range object.

Remarks

The AllocateChanges method will execute an UPDATE CUBE statement for all changes made in the range since the last apply changes operation was committed. This method generates a run-time error if it is executed on a range based on a non-OLAP data source.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ApplyNames Method (Excel)

 Copy code hover
[image]

Range.ApplyNames Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies names to the cells in the specified range.

Syntax

expression .ApplyNames(Names, IgnoreRelativeAbsolute, UseRowColumnNames, OmitColumn, OmitRow, Order, AppendLast)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Names | Optional | Variant | An array of the names to be applied. If this argument is omitted, all names on the sheet are applied to the range.
IgnoreRelativeAbsolute | Optional | Variant | True to replace references with names, regardless of the reference types of either the names or references. False to replace absolute references only with absolute names, relative references only with relative names, and mixed references only with mixed names. The default value is True.
UseRowColumnNames | Optional | Variant | True to use the names of row and column ranges that contain the specified range if names for the range cannot be found. False to ignore the OmitColumn and OmitRow arguments. The default value is True.
OmitColumn | Optional | Variant | True to replace the entire reference with the row-oriented name. The column-oriented name can be omitted only if the referenced cell is in the same column as the formula and is within a row-oriented named range. The default value is True.
OmitRow | Optional | Variant | True to replace the entire reference with the column-oriented name. The row-oriented name can be omitted only if the referenced cell is in the same row as the formula and is within a column-oriented named range. The default value is True.
Order | Optional | XlApplyNamesOrder | Determines which range name is listed first when a cell reference is replaced by a row-oriented and column-oriented range name.
AppendLast | Optional | Variant | True to replace the definitions of the names in Names and also replace the definitions of the last names that were defined. False to replace the definitions of the names in Names only. The default value is False.

Return Value

Variant

Remarks

You can use the Array function to create the list of names for the Names argument.

If you want to apply names to the entire sheet, use Cells.ApplyNames.

You cannot "unapply" names; to delete names, use the Delete method.

Example

This example applies names to the entire sheet.

VBA Copy code Copy code
Cells.ApplyNames Names:=Array("Sales", "Profits")

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ApplyOutlineStyles Method (Excel)

 Copy code hover
[image]

Range.ApplyOutlineStyles Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies outlining styles to the specified range.

Syntax

expression .ApplyOutlineStyles

expression A variable that represents a Range object.

Return Value

Variant

Example

The following example applies automatic outlining styles to the selection. The selection must include the entire outline range on a worksheet.

VBA Copy code Copy code
Selection.ApplyOutlineStyles

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AutoComplete Method (Excel)

 Copy code hover
[image]

Range.AutoComplete Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AutoComplete match from the list. If there's no AutoComplete match or if more than one entry in the list matches the string to complete, this method returns an empty string.

Syntax

expression .AutoComplete(String)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The string to complete.

Return Value

String

Remarks

This method works even if the AutoComplete feature is disabled.

Example

This example returns the AutoComplete match for the string segment "Ap." An AutoComplete match is made if the column containing cell A5 contains a contiguous list and one of the entries in the list contains a match for the string.

VBA Copy code Copy code
s = Worksheets(1).Range("A5").AutoComplete("Ap")
If Len(s) > 0 Then
 MsgBox "Completes to " & s
Else
 MsgBox "Has no completion"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AutoFill Method (Excel)

 Copy code hover
[image]

Range.AutoFill Method (Excel)
See also Send feedback

Published: July 16, 2012

Performs an autofill on the cells in the specified range.

Syntax

expression .AutoFill(Destination, Type)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Destination | Required | Range | The cells to be filled. The destination must include the source range.
Type | Optional | XlAutoFillType | Specifies the fill type.

Return Value

Variant

Example

This example performs an autofill on cells A1:A20 on Sheet1, based on the source range A1:A2 on Sheet1. Before running this example, type 1 in cell A1 and type 2 in cell A2.

VBA Copy code Copy code
Set sourceRange = Worksheets("Sheet1").Range("A1:A2")
Set fillRange = Worksheets("Sheet1").Range("A1:A20")
sourceRange.AutoFill Destination:=fillRange

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AutoFilter Method (Excel)

 Copy code hover
[image]

Range.AutoFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

Filters a list using the AutoFilter.

Syntax

expression .AutoFilter(Field, Criteria1, Operator, Criteria2, VisibleDropDown)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Field | Optional | Variant | The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field one).
Criteria1 | Optional | Variant | The criteria (a string; for example, "101"). Use "=" to find blank fields, or use "<>" to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is xlTop10Items, Criteria1 specifies the number of items (for example, "10").
Operator | Optional | XlAutoFilterOperator | One of the constants of XlAutoFilterOperator specifying the type of filter.
Criteria2 | Optional | Variant | The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
VisibleDropDown | Optional | Variant | True to display the AutoFilter drop-down arrow for the filtered field. False to hide the AutoFilter drop-down arrow for the filtered field. True by default.

Return Value

Variant

Remarks

If you omit all the arguments, this method simply toggles the display of the AutoFilter drop-down arrows in the specified range.

Example

This example filters a list starting in cell A1 on Sheet1 to display only the entries in which field one is equal to the string "Otis". The drop-down arrow for field one will be hidden.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").AutoFilter _
 field:=1, _
 Criteria1:="Otis", _
 VisibleDropDown:=False

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AutoFit Method (Excel)

 Copy code hover
[image]

Range.AutoFit Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.

Syntax

expression .AutoFit

expression A variable that represents a Range object.

Return Value

Variant

Remarks

The Range object must be a row or a range of rows, or a column or a range of columns. Otherwise, this method generates an error.

One unit of column width is equal to the width of one character in the Normal style.

Example

This example changes the width of columns A through I on Sheet1 to achieve the best fit.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("A:I").AutoFit

This example changes the width of columns A through E on Sheet1 to achieve the best fit, based only on the contents of cells A1:E1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:E1").Columns.AutoFit

See also

Concepts

Range Object

Other resources

Range Object Members


Range.AutoOutline Method (Excel)

 Copy code hover
[image]

Range.AutoOutline Method (Excel)
See also Send feedback

Published: July 16, 2012

Automatically creates an outline for the specified range. If the range is a single cell, Microsoft Excel creates an outline for the entire sheet. The new outline replaces any existing outline.

Syntax

expression .AutoOutline

expression A variable that represents a Range object.

Return Value

Variant

Example

This example creates an outline for the range A1:G37 on Sheet1.

Note Note

The range must contain either a summary row or a summary column.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").AutoOutline

See also

Concepts

Range Object

Other resources

Range Object Members


Range.BorderAround Method (Excel)

 Copy code hover
[image]

Range.BorderAround Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a border to a range and sets the Color, LineStyle, and Weight properties for the new border. Variant.

Syntax

expression .BorderAround(LineStyle, Weight, ColorIndex, Color, ThemeColor)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
LineStyle | Optional | Variant | One of the constants of XlLineStyle specifying the line style for the border.
Weight | Optional | XlBorderWeight | The border weight.
ColorIndex | Optional | XlColorIndex | The border color, as an index into the current color palette or as an XlColorIndex constant.
Color | Optional | Variant | The border color, as an RGB value.
ThemeColor | Optional | Variant | The theme color, as an index into the current color theme or as an XlThemeColor value.

Return Value

Variant

Remarks

You must specify only one of the following: ColorIndex, Color, or ThemeColor.

You can specify either LineStyle or Weight, but not both. If you don't specify either argument, Microsoft Excel uses the default line style and weight.

This method outlines the entire range without filling it in. To set the borders of all the cells, you must set the Color , LineStyle , and Weight properties for the Borders collection. To clear the border, you must set the LineStyle property to xlLineStyleNone for all the cells in the range.

Example

This example adds a thick red border around the range A1:D4 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:D4").BorderAround _
 ColorIndex:=3, Weight:=xlThick

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Calculate Method (Excel)

 Copy code hover
[image]

Range.Calculate Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.

Syntax

expression .Calculate

expression A variable that represents a Range object.

Return Value

Variant

Remarks

To calculate | Follow this example
All open workbooks | Application.Calculate (or just Calculate)
A specific worksheet | Worksheets(1).Calculate
A specified range | Worksheets(1).Rows(2).Calculate

Example

This example calculates the formulas in columns A, B, and C in the used range on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").UsedRange.Columns("A:C").Calculate

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CalculateRowMajorOrder Method (Excel)

 Copy code hover
[image]

Range.CalculateRowMajorOrder Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates a specfied range of cells.

Version Information

Version Added: Excel 2007

Syntax

expression .CalculateRowMajorOrder

expression An expression that returns a Range object.

Return Value

Variant

Remarks

The CalculateRowMajorOrder method calculates the specified range range cell-by-cell, from its top left corner to its to bottom right corner in row-major order. This is the same process that is used by Excel 2000 and earlier versions to calculate a range.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CheckSpelling Method (Excel)

 Copy code hover
[image]

Range.CheckSpelling Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the spelling of an object.

Syntax

expression .CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest, SpellLang)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
CustomDictionary | Optional | Variant | A string that indicates the file name of the custom dictionary to be examined if the word isn't found in the main dictionary. If this argument is omitted, the currently specified dictionary is used.
IgnoreUppercase | Optional | Variant | True to have Microsoft Excel ignore words that are all uppercase. False to have Microsoft Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
AlwaysSuggest | Optional | Variant | True to have Microsoft Excel display a list of suggested alternate spellings when an incorrect spelling is found. False to have Microsoft Excel wait for you to input the correct spelling. If this argument is omitted, the current setting will be used.
SpellLang | Optional | Variant | The language of the dictionary being used. Can be one of the MsoLanguageID values.

Return Value

Variant

Remarks

This method has no return value; Microsoft Excel displays the Spelling dialog box.

To check headers, footers, and objects on a worksheet, use this method on a Worksheet object.

To check only cells and notes, use this method with the object returned by the Cells property.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Clear Method (Excel)

 Copy code hover
[image]

Range.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the entire object.

Syntax

expression .Clear

expression A variable that represents a Range object.

Return Value

Variant

Example

This example clears the formulas and formatting in cells A1:G37 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").Clear

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearComments Method (Excel)

 Copy code hover
[image]

Range.ClearComments Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears all cell comments from the specified range.

Syntax

expression .ClearComments

expression A variable that represents a Range object.

Example

This example clears all comments from cell E5.

VBA Copy code Copy code
Worksheets(1).Range("e5").ClearComments

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearContents Method (Excel)

 Copy code hover
[image]

Range.ClearContents Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formulas from the range.

Syntax

expression .ClearContents

expression A variable that represents a Range object.

Return Value

Variant

Example

This example clears the formulas from cells A1:G37 on Sheet1 but leaves the formatting intact.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").ClearContents

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearFormats Method (Excel)

 Copy code hover
[image]

Range.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Range object.

Return Value

Variant

Example

This example clears all formatting from cells A1:G37 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").ClearFormats

This example clears the formatting from embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.ClearFormats

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearHyperlinks Method (Excel)

 Copy code hover
[image]

Range.ClearHyperlinks Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all hyperlinks from the specified range.

Version Information

Version Added: Excel 2010

Syntax

expression .ClearHyperlinks

expression A variable that returns a Range object.

Return Value

Nothing

Remarks

Calling the ClearHyperlinks method on the specified range is equivalent to using the Clear Hyperlinks command from the Clear drop-down list in the Editing section of the Home tab. Only hyperlinks will be removed; all other cell content, such as text and formatting will be unaffected.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearNotes Method (Excel)

 Copy code hover
[image]

Range.ClearNotes Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears notes and sound notes from all the cells in the specified range.

Syntax

expression .ClearNotes

expression A variable that represents a Range object.

Return Value

Variant

Example

This example clears all notes and sound notes from columns A through C on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("A:C").ClearNotes

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ClearOutline Method (Excel)

 Copy code hover
[image]

Range.ClearOutline Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the outline for the specified range.

Syntax

expression .ClearOutline

expression A variable that represents a Range object.

Return Value

Variant

Example

This example clears the outline for the range A1:G37 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").ClearOutline

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ColumnDifferences Method (Excel)

 Copy code hover
[image]

Range.ColumnDifferences Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells whose contents are different from the comparison cell in each column.

Syntax

expression .ColumnDifferences(Comparison)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Comparison | Required | Variant | A single cell to compare to the specified range.

Return Value

Range

Example

This example selects the cells in column A on Sheet1 whose contents are different from cell A4.

VBA Copy code Copy code
Sub CompDiff()
'Setting up data to be compared
 Range("A1").Value = "Rod"
 Range("A2").Value = "Bill"
 Range("A3").Value = "John"
 Range("A4").Value = "Rod"
 Range("A5").Value = "Kelly"
 Range("A6").Value = "Rod"
 Range("A7").Value = "Paddy"
 Range("A8").Value = "Rod"
 Range("A9").Value = "Rod"
 Range("A10").Value = "Rod"

'Code to do the comparison, selects the values that are unlike A1
Worksheets("Sheet1").Activate
Set r1 = ActiveSheet.Columns("A").ColumnDifferences( _
 Comparison:=ActiveSheet.Range("A1"))
r1.Select
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Consolidate Method (Excel)

 Copy code hover
[image]

Range.Consolidate Method (Excel)
See also Send feedback

Published: July 16, 2012

Consolidates data from multiple ranges on multiple worksheets into a single range on a single worksheet. Variant.

Syntax

expression .Consolidate(Sources, Function, TopRow, LeftColumn, CreateLinks)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Sources | Optional | Variant | The sources of the consolidation as an array of text reference strings in R1C1-style notation. The references must include the full path of sheets to be consolidated.
Function | Optional | Variant | One of the constants of XlConsolidationFunction which specifies the type of consolidation.
TopRow | Optional | Variant | True to consolidate data based on column titles in the top row of the consolidation ranges. False to consolidate data by position. The default value is False.
LeftColumn | Optional | Variant | True to consolidate data based on row titles in the left column of the consolidation ranges. False to consolidate data by position. The default value is False.
CreateLinks | Optional | Variant | True to have the consolidation use worksheet links. False to have the consolidation copy the data. The default value is False.

Return Value

Variant

Example

This example consolidates data from Sheet2 and Sheet3 onto Sheet1, using the SUM function.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Consolidate _
 Sources:=Array("Sheet2!R1C1:R37C6", "Sheet3!R1C1:R37C6"), _
 Function:=xlSum

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Copy Method (Excel)

 Copy code hover
[image]

Range.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the range to the specified range or to the Clipboard.

Syntax

expression .Copy(Destination)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Destination | Optional | Variant | Specifies the new range to which the specified range will be copied. If this argument is omitted, Microsoft Excel copies the range to the Clipboard.

Return Value

Variant

Example

The following code example copies the formulas in cells A1:D4 on Sheet1 into cells E5:H8 on Sheet2.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:D4").Copy _
    destination:=Worksheets("Sheet2").Range("E5")

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example inspects the value in column D for each row in Sheet1. If the value in column D equals "A" the entire row is copied onto SheetA, in the next empty row. If the value equals "B" the row is copied onto SheetB.

VBA Copy code Copy code
Public Sub CopyRows()
    Sheets("Sheet1").Select
    ' Find the last row of data
    FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
    ' Loop through each row
    For x = 2 To FinalRow
        ' Decide if to copy based on column D
        ThisValue = Cells(x, 4).Value
        If ThisValue = "A" Then
            Cells(x, 1).Resize(1, 33).Copy
            Sheets("SheetA").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            ActiveSheet.Paste
            Sheets("Sheet1").Select
        ElseIf ThisValue = "B" Then
            Cells(x, 1).Resize(1, 33).Copy
            Sheets("SheetB").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            ActiveSheet.Paste
            Sheets("Sheet1").Select
        End If
    Next x
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CopyFromRecordset Method (Excel)

 Copy code hover
[image]

Range.CopyFromRecordset Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the contents of an ADO or DAO Recordset object onto a worksheet, beginning at the upper-left corner of the specified range. If the Recordset object contains fields with OLE objects in them, this method fails.

Syntax

expression .CopyFromRecordset(Data, MaxRows, MaxColumns)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Data | Required | Variant | The Recordset object to copy into the range.
MaxRows | Optional | Variant | The maximum number of records to copy onto the worksheet. If this argument is omitted, all the records in the Recordset object are copied.
MaxColumns | Optional | Variant | The maximum number of fields to copy onto the worksheet. If this argument is omitted, all the fields in the Recordset object are copied.

Return Value

Long

Remarks

Copying begins at the current row of the Recordset object. After copying is completed, the EOF property of the Recordset object is True.

Example

This example copies the field names from a DAO Recordset object into the first row of a worksheet and formats the names as bold. The example then copies the recordset onto the worksheet, beginning at cell A2.

VBA Copy code Copy code
For iCols = 0 to rs.Fields.Count - 1
 ws.Cells(1, iCols + 1).Value = rs.Fields(iCols).Name
Next
ws.Range(ws.Cells(1, 1), _
 ws.Cells(1, rs.Fields.Count)).Font.Bold = True
ws.Range("A2").CopyFromRecordset rs

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CopyPicture Method (Excel)

 Copy code hover
[image]

Range.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture. Variant.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | . Specifies how the picture should be copied.
Format | Optional | XlCopyPictureFormat | . The format of the picture.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CreateNames Method (Excel)

 Copy code hover
[image]

Range.CreateNames Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates names in the specified range, based on text labels in the sheet.

Syntax

expression .CreateNames(Top, Left, Bottom, Right)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Top | Optional | Variant | True to create names by using labels in the top row. The default value is False.
Left | Optional | Variant | True to create names by using labels in the left column. The default value is False.
Bottom | Optional | Variant | True to create names by using labels in the bottom row. The default value is False.
Right | Optional | Variant | True to create names by using labels in the right column. The default value is False.

Return Value

Variant

Remarks

If you don't specify one of Top, Left, Bottom, or Right, Microsoft Excel guesses the location of the text labels, based on the shape of the specified range.

Example

This example creates names for cells B1:B3 based on the text in cells A1:A3. Note that you must include the cells that contain the names in the range, even though the names are created only for cells B1:B3.

VBA Copy code Copy code
Set rangeToName = Worksheets("Sheet1").Range("A1:B3")
rangeToName.CreateNames Left:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Cut Method (Excel)

 Copy code hover
[image]

Range.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard or pastes it into a specified destination.

Syntax

expression .Cut(Destination)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Destination | Optional | Variant | The range where the object should be pasted. If this argument is omitted, the object is cut to the Clipboard.

Return Value

Variant

Remarks

The cut range must be made up of adjacent cells.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DataSeries Method (Excel)

 Copy code hover
[image]

Range.DataSeries Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a data series in the specified range. Variant.

Syntax

expression .DataSeries(Rowcol, Type, Date, Step, Stop, Trend)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Rowcol | Optional | Variant | Can be the xlRows or xlColumns constant to have the data series entered in rows or columns, respectively. If this argument is omitted, the size and shape of the range is used.
Type | Optional | XlDataSeriesType | The type for the data series.
Date | Optional | XlDataSeriesDate | If the Type argument is xlChronological, the Date argument indicates the step date unit.
Step | Optional | Variant | The step value for the series. The default value is 1.
Stop | Optional | Variant | The stop value for the series. If this argument is omitted, Microsoft Excel fills to the end of the range.
Trend | Optional | Variant | True to create a linear trend or growth trend. False to create a standard data series. The default value is False.

Return Value

Variant

Example

This example creates a series of 12 dates. The series contains the last day of every month in 1996 and is created in the range A1:A12 on Sheet1.

VBA Copy code Copy code
Set dateRange = Worksheets("Sheet1").Range("A1:A12")
Worksheets("Sheet1").Range("A1").Formula = "31-JAN-1996"
dateRange.DataSeries Type:=xlChronological, Date:=xlMonth

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Delete Method (Excel)

 Copy code hover
[image]

Range.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete(Shift)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Shift | Optional | Variant | Used only with Range objects. Specifies how to shift cells to replace deleted cells. Can be one of the following XlDeleteShiftDirection constants: xlShiftToLeft or xlShiftUp. If this argument is omitted, Microsoft Excel decides based on the shape of the range.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DialogBox Method (Excel)

 Copy code hover
[image]

Range.DialogBox Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays a dialog box defined by a dialog box definition table on a Microsoft Excel 4.0 macro sheet. Returns the number of the chosen control, or returns False if the user clicks the Cancel button.

Syntax

expression .DialogBox

expression A variable that represents a Range object.

Return Value

Variant

Remarks

The Range must refer to a dialog box definition table on a Microsoft Excel 4.0 macro sheet.

Example

This example runs a Microsoft Excel 4.0 dialog box and then displays the return value in a message box. The dialogRange variable refers to the dialog box definition table on the Microsoft Excel 4.0 macro sheet named "Macro1."

VBA Copy code Copy code
Set dialogRange = Excel4MacroSheets("Macro1").Range("myDialogBox")
result = dialogRange.DialogBox
MsgBox result

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Dirty Method (Excel)

 Copy code hover
[image]

Range.Dirty Method (Excel)
See also Send feedback

Published: July 16, 2012

Designates a range to be recalculated when the next recalculation occurs.

Syntax

expression .Dirty

expression A variable that represents a Range object.

Remarks

The Calculate method forces the specified range to be recalculated, for cells that Microsoft Excel understands as needing recalculation.

If the application is in manual calculation mode, using the Dirty method instructs Excel to identify the specified cell to be recalculated. If the application is in automatic calculation mode, using the Dirty method instructs Excel to perform a recalculation.

Example

In this example, Microsoft Excel enters a formula in cell A3, saves the changes, and then recalculates cell A3.

VBA Copy code Copy code
Sub UseDirtyMethod()

 MsgBox "Two values and a formula will be entered."
 Range("A1").Value = 1
 Range("A2").Value = 2
 Range("A3").Formula = "=A1+A2"

 ' Save the changes made to the worksheet.
 Application.DisplayAlerts = False
 Application.Save
 MsgBox "Changes saved."

 ' Force a recalculation of range A3.
 Application.Range("A3").Dirty
 MsgBox "Try to close the file without saving and a dialog box will appear."

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DiscardChanges Method (Excel)

 Copy code hover
[image]

Range.DiscardChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Discards all changes in the edited cells of the range.

Version Information

Version Added: Excel 2010

Syntax

expression .DiscardChanges

expression A variable that represents a Range object.

Remarks

For a range based on an OLAP data source, this method removes all values and formulas entered in the cells, and then runs an update operation to retrieve the latest values from the data source. It sets the data source value to NULL for all value cells that are edited, and also executes a ROLLBACK TRANSACTION statement against the OLAP server. For ranges based on non-OLAP data sources, this method simply clears all edited cells.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EditionOptions Method (Excel)

 Copy code hover
[image]

Range.EditionOptions Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .EditionOptions(Type, Option, Name, Reference, Appearance, ChartSize, Format)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlEditionType | See help included with Microsoft Office Macintosh Edition.
Option | Required | XlEditionOptionsOption | See help included with Microsoft Office Macintosh Edition.
Name | Optional | Variant | See help included with Microsoft Office Macintosh Edition.
Reference | Optional | Variant | See help included with Microsoft Office Macintosh Edition.
Appearance | Optional | XlPictureAppearance | See help included with Microsoft Office Macintosh Edition.
ChartSize | Optional | XlPictureAppearance | See help included with Microsoft Office Macintosh Edition.
Format | Optional | Variant | See help included with Microsoft Office Macintosh Edition.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ExportAsFixedFormat Method (Excel)

 Copy code hover
[image]

Range.ExportAsFixedFormat Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports to a file of the specified format.

Version Information

Version Added: Excel 2007

Syntax

expression .ExportAsFixedFormat(Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFixedFormatType | The type of file format to export to.
Filename | Optional | Variant | The file name of the file to be saved. You can include a full path, or Excel saves the file in the current folder.
Quality | Optional | Variant | Optional XlFixedFormatQuality. Specifies the quality of the published file.
IncludeDocProperties | Optional | Variant | True to include the document properties; otherwise False.
IgnorePrintAreas | Optional | Variant | True to ignore any print areas set when publishing; otherwise False.
From | Optional | Variant | The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To | Optional | Variant | The number of the last page to publish. If this argument is omitted, publishing ends with the last page.
OpenAfterPublish | Optional | Variant | True to display the file in the viewer after it is published; otherwise False.
FixedFormatExtClassPtr | Optional | Variant | Pointer to the FixedFormatExt class.

Remarks

This method also supports initializing an add-in to export a file to a fixed-format file. For example, Excel will perform file format conversion if the converters are present. The conversion is usually initiated by the user.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FillDown Method (Excel)

 Copy code hover
[image]

Range.FillDown Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills down from the top cell or cells in the specified range to the bottom of the range. The contents and formatting of the cell or cells in the top row of a range are copied into the rest of the rows in the range.

Syntax

expression .FillDown

expression A variable that represents a Range object.

Return Value

Variant

Example

This example fills the range A1:A10 on Sheet1, based on the contents of cell A1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A10").FillDown

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FillLeft Method (Excel)

 Copy code hover
[image]

Range.FillLeft Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills left from the rightmost cell or cells in the specified range. The contents and formatting of the cell or cells in the rightmost column of a range are copied into the rest of the columns in the range.

Syntax

expression .FillLeft

expression A variable that represents a Range object.

Return Value

Variant

Example

This example fills the range A1:M1 on Sheet1, based on the contents of cell M1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:M1").FillLeft

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FillRight Method (Excel)

 Copy code hover
[image]

Range.FillRight Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills right from the leftmost cell or cells in the specified range. The contents and formatting of the cell or cells in the leftmost column of a range are copied into the rest of the columns in the range.

Syntax

expression .FillRight

expression A variable that represents a Range object.

Return Value

Variant

Example

This example fills the range A1:M1 on Sheet1, based on the contents of cell A1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:M1").FillRight

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FillUp Method (Excel)

 Copy code hover
[image]

Range.FillUp Method (Excel)
See also Send feedback

Published: July 16, 2012

Fills up from the bottom cell or cells in the specified range to the top of the range. The contents and formatting of the cell or cells in the bottom row of a range are copied into the rest of the rows in the range.

Syntax

expression .FillUp

expression A variable that represents a Range object.

Return Value

Variant

Example

This example fills the range A1:A10 on Sheet1, based on the contents of cell A10.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A10").FillUp

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Find Method (Excel)

 Copy code hover
[image]

Range.Find Method (Excel)
See also Send feedback

Published: July 16, 2012

Finds specific information in a range.

Syntax

expression .Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | Variant | The data to search for. Can be a string or any Microsoft Excel data type.
After | Optional | Variant | The cell after which you want the search to begin. This corresponds to the position of the active cell when a search is done from the user interface. Notice that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell isn't searched until the method wraps back around to this cell. If you do no specify this argument, the search starts after the cell in the upper-left corner of the range.
LookIn | Optional | Variant | The type of information.
LookAt | Optional | Variant | Can be one of the following XlLookAt constants: xlWhole or xlPart.
SearchOrder | Optional | Variant | Can be one of the following XlSearchOrder constants: xlByRows or xlByColumns.
SearchDirection | Optional | XlSearchDirection | . The search direction.
MatchCase | Optional | Variant | True to make the search case sensitive. The default value is False.
MatchByte | Optional | Variant | Used only if you have selected or installed double-byte language support. True to have double-byte characters match only double-byte characters. False to have double-byte characters match their single-byte equivalents.
SearchFormat | Optional | Variant | The search format.

Return Value

A Range object that represents the first cell where that information is found.

Remarks

This method returns Nothing if no match is found. The Find method does not affect the selection or the active cell.

The settings for LookIn, LookAt, SearchOrder, and MatchByte are saved each time you use this method. If you do not specify values for these arguments the next time you call the method, the saved values are used. Setting these arguments changes the settings in the Find dialog box, and changing the settings in the Find dialog box changes the saved values that are used if you omit the arguments. To avoid problems, set these arguments explicitly each time you use this method.

You can use the FindNext and FindPrevious methods to repeat the search.

When the search reaches the end of the specified search range, it wraps around to the beginning of the range. To stop a search when this wraparound occurs, save the address of the first found cell, and then test each successive found-cell address against this saved address.

To find cells that match more complicated patterns, use a For Each...Next statement with the Like operator. For example, the following code searches for all cells in the range A1:C5 that use a font whose name starts with the letters Cour. When Microsoft Excel finds a match, it changes the font to Times New Roman.

For Each c In [A1:C5] If c.Font.Name Like "Cour*" Then c.Font.Name = "Times New Roman" End If Next

Example

This example finds all cells in the range A1:A500 on worksheet one that contain the value 2 and changes it to 5.

VBA Copy code Copy code
With Worksheets(1).Range("a1:a500")
    Set c = .Find(2, lookin:=xlValues)
    If Not c Is Nothing Then
        firstAddress = c.Address
        Do
            c.Value = 5
            Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
End With

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example takes a path and name of a workbook and a search term, and searches the specified workbook for the search term. If the search term is found, the address of the result is stored in cell D10 of the current workbook.

VBA Copy code Copy code
Option Explicit

Sub FindAddress()
    'Defining the variables.
    Dim GCell As Range
    Dim Page$, Txt$, MyPath$, MyWB$, MySheet$

    'The text for which to search.
    Txt = "Hello"
    'The path to the workbook in which to search.
    MyPath = "C:\Your\File\Path\"
    'The name of the workbook in which to search.
    MyWB = "YourFileName.xls"

    'Use the current sheet as the place to store the data for which to search.
    MySheet = ActiveSheet.Name

    'If an error occurs, use the error handling routine at the end of this file.
    On Error GoTo ErrorHandler

    'Turn off screen updating, and then open the target workbook.
    Application.ScreenUpdating = False
    Workbooks.Open FileName:=MyPath & MyWB

    'Search for the specified text
    Set GCell = ActiveSheet.Cells.Find(Txt)

    'Record the address of the data, along with the date, in the current workbook.
    With ThisWorkbook.ActiveSheet.Range("D10")
        .Value = "Address of " & Txt & ":"
        .Offset(0, 1).Value = "Date:"
        .Offset(1, 0).Value = GCell.Address
        .Offset(1, 1).Value = Date
        .Columns.AutoFit
        .Offset(1, 1).Columns.AutoFit
    End With

    'Close the data workbook, without saving any changes, and turn screen updating back on.
    ActiveWorkbook.Close savechanges:=False
    Application.ScreenUpdating = True
Exit Sub

'Error Handling section.
ErrorHandler:
Select Case Err.Number
        'Common error #1: file path or workbook name is wrong.
        Case 1004
            Range("D10:E11").ClearContents
            Application.ScreenUpdating = True
            MsgBox "The workbook " & MyWB & " could not be found in the path" & vbCrLf & MyPath & "."
        Exit Sub

        'Common error #2: the specified text wasn't in the target workbook.
        Case 9, 91
            ThisWorkbook.Sheets(MySheet).Range("D10:E11").ClearContents
            Workbooks(MyWB).Close False
            Application.ScreenUpdating = True
            MsgBox "The value " & Txt & " was not found."
        Exit Sub

        'General case: turn screenupdating back on, and exit.
        Case Else
            Application.ScreenUpdating = True
        Exit Sub
End Select

End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FindNext Method (Excel)

 Copy code hover
[image]

Range.FindNext Method (Excel)
See also Send feedback

Published: July 16, 2012

Continues a search that was begun with the Find method. Finds the next cell that matches those same conditions and returns a Range object that represents that cell. This does not affect the selection or the active cell.

Syntax

expression .FindNext(After)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
After | Optional | Variant | The cell after which you want to search. This corresponds to the position of the active cell when a search is done from the user interface. Be aware that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell is not searched until the method wraps back around to this cell. If this argument is not specified, the search starts after the cell in the upper-left corner of the range.

Return Value

Range

Remarks

When the search reaches the end of the specified search range, it wraps around to the beginning of the range. To stop a search when this wraparound occurs, save the address of the first found cell, and then test each successive found-cell address against this saved address.

Example

This example finds all cells in the range A1:A500 that contain the value 2 and changes their values to 5.

VBA Copy code Copy code
With Worksheets(1).Range("a1:a500")
    Set c = .Find(2, lookin:=xlValues)
    If Not c Is Nothing Then
        firstAddress = c.Address
        Do
            c.Value = 5
            Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
End With

Sample code provided by: MVP Contributor Dennis Wallentin, VSTO & .NET & Excel | About the Contributor

This example finds all the cells in the first four columns that have a constant "X" in them and hides the column that contains the X.

VBA Copy code Copy code
Sub Hide_Columns()

    'Excel objects.
    Dim m_wbBook As Workbook
    Dim m_wsSheet As Worksheet
    Dim m_rnCheck As Range
    Dim m_rnFind As Range
    Dim m_stAddress As String

    'Initialize the Excel objects.
    Set m_wbBook = ThisWorkbook
    Set m_wsSheet = m_wbBook.Worksheets("Sheet1")

    'Search the four columns for any constants.
    Set m_rnCheck = m_wsSheet.Range("A1:D1").SpecialCells(xlCellTypeConstants)

    'Retrieve all columns that contain an X. If there is at least one, begin the DO/WHILE loop.
    With m_rnCheck
        Set m_rnFind = .Find(What:="X")
        If Not m_rnFind Is Nothing Then
            m_stAddress = m_rnFind.Address

            'Hide the column, and then find the next X.
            Do
                m_rnFind.EntireColumn.Hidden = True
                Set m_rnFind = .FindNext(m_rnFind)
            Loop While Not m_rnFind Is Nothing And m_rnFind.Address <> m_stAddress
        End If
    End With

End Sub

This example finds all the cells in the first four columns that have a constant "X" in them and unhides the column that contains the X.

VBA Copy code Copy code
Sub Unhide_Columns()
    'Excel objects.
    Dim m_wbBook As Workbook
    Dim m_wsSheet As Worksheet
    Dim m_rnCheck As Range
    Dim m_rnFind As Range
    Dim m_stAddress As String

    'Initialize the Excel objects.
    Set m_wbBook = ThisWorkbook
    Set m_wsSheet = m_wbBook.Worksheets("Sheet1")

    'Search the four columns for any constants.
    Set m_rnCheck = m_wsSheet.Range("A1:D1").SpecialCells(xlCellTypeConstants)

    'Retrieve all columns that contain X. If there is at least one, begin the DO/WHILE loop.
    With m_rnCheck
        Set m_rnFind = .Find(What:="X", LookIn:=xlFormulas)
        If Not m_rnFind Is Nothing Then
            m_stAddress = m_rnFind.Address

            'Unhide the column, and then find the next X.
            Do
                m_rnFind.EntireColumn.Hidden = False
                Set m_rnFind = .FindNext(m_rnFind)
            Loop While Not m_rnFind Is Nothing And m_rnFind.Address <> m_stAddress
        End If
    End With

End Sub

About the Contributor

Dennis Wallentin is the author of VSTO & .NET & Excel, a blog that focuses on .NET Framework solutions for Excel and Excel Services. Dennis has been developing Excel solutions for over 20 years and is also the co-author of "Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA and .NET (2nd Edition)."

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FindPrevious Method (Excel)

 Copy code hover
[image]

Range.FindPrevious Method (Excel)
See also Send feedback

Published: July 16, 2012

Continues a search that was begun with the Find method. Finds the previous cell that matches those same conditions and returns a Range object that represents that cell. Doesn't affect the selection or the active cell.

Syntax

expression .FindPrevious(After)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
After | Optional | Variant | The cell before which you want to search. This corresponds to the position of the active cell when a search is done from the user interface. Note that After must be a single cell in the range. Remember that the search begins before this cell; the specified cell isn't searched until the method wraps back around to this cell. If this argument isn't specified, the search starts before the upper- left cell in the range.

Return Value

Range

Remarks

When the search reaches the beginning of the specified search range, it wraps around to the end of the range. To stop a search when this wraparound occurs, save the address of the first found cell, and then test each successive found-cell address against this saved address.

Example

This example shows how the FindPrevious method is used with the Find and FindNext methods. Before running this example, make sure that Sheet1 contains at least two occurrences of the word "Phoenix" in column B.

VBA Copy code Copy code
Sub FindTest()
 Dim fc As Range
 Set fc = Worksheets("Sheet1").Columns("B").Find(what:="Phoenix")
 MsgBox "The first occurrence is in cell " & fc.Address
 Set fc = Worksheets("Sheet1").Columns("B").FindNext(after:=fc)
 MsgBox "The next occurrence is in cell " & fc.Address
 Set fc = Worksheets("Sheet1").Columns("B").FindPrevious(after:=fc)
 MsgBox "The previous occurrence is in cell " & fc.Address
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FlashFill Method (Excel)

 Copy code hover
[image]

Range.FlashFill Method (Excel)
See also Send feedback

Published: July 16, 2012

TRUE indicates that the Excel Flash Fill feature has been enabled and active.

Version information

Version Added: Excel 2013

Syntax

expression .FlashFill

expression A variable that represents a Range object.

Return value

VOID

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FunctionWizard Method (Excel)

 Copy code hover
[image]

Range.FunctionWizard Method (Excel)
See also Send feedback

Published: July 16, 2012

Starts the Function Wizard for the upper-left cell of the range.

Syntax

expression .FunctionWizard

expression A variable that represents a Range object.

Return Value

Variant

Example

This example starts the Function Wizard for the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.FunctionWizard

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Group Method (Excel)

 Copy code hover
[image]

Range.Group Method (Excel)
See also Send feedback

Published: July 16, 2012

When the Range object represents a single cell in a PivotTable field's data range, the Group method performs numeric or date-based grouping in that field.

Syntax

expression .Group(Start, End, By, Periods)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first value to be grouped. If this argument is omitted or True, the first value in the field is used.
End | Optional | Variant | The last value to be grouped. If this argument is omitted or True, the last value in the field is used.
By | Optional | Variant | If the field is numeric, this argument specifies the size of each group. If the field is a date, this argument specifies the number of days in each group if element 4 in the Periods array is True and all the other elements are False. Otherwise, this argument is ignored. If this argument is omitted, Microsoft Excel automatically chooses a default group size.
Periods | Optional | Variant | An array of Boolean values that specify the period for the group, described in the Remarks section. If an element in the array is True, a group is created for the corresponding time; if the element is False, no group is created. If the field isn't a date field, this argument is ignored.

Return Value

Variant

Remarks

The Boolean array for the Periods parameter contains the following elements:

Array element | Period
1 | Seconds
2 | Minutes
3 | Hours
4 | Days
5 | Months
6 | Quarters
7 | Years

Because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

The Range object must be a single cell in the PivotTable field's data range. If you attempt to apply this method to more than one cell, it will fail (without displaying an error message).

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Insert Method (Excel)

 Copy code hover
[image]

Range.Insert Method (Excel)
See also Send feedback

Published: July 16, 2012

Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to make space.

Syntax

expression .Insert(Shift, CopyOrigin)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Shift | Optional | Variant | Specifies which way to shift the cells. Can be one of the following XlInsertShiftDirection constants: xlShiftToRight or xlShiftDown. If this argument is omitted, Microsoft Excel decides based on the shape of the range.
CopyOrigin | Optional | Variant | The copy origin.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertIndent Method (Excel)

 Copy code hover
[image]

Range.InsertIndent Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds an indent to the specified range.

Syntax

expression .InsertIndent(InsertAmount)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
InsertAmount | Required | Long | The amount to be added to the current indent.

Remarks

Using this method to set the indent level to a number less than 0 (zero) or greater than 15 causes an error.

Use the IndentLevel property to return the indent level for a range.

Example

This example decreases the indent level in cell A10.

VBA Copy code Copy code
With Range("a10")
 .InsertIndent -1
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Justify Method (Excel)

 Copy code hover
[image]

Range.Justify Method (Excel)
See also Send feedback

Published: July 16, 2012

Rearranges the text in a range so that it fills the range evenly.

Syntax

expression .Justify

expression A variable that represents a Range object.

Return Value

Variant

Remarks

If the range isn't large enough, Microsoft Excel displays a message telling you that text will extend below the range. If you click the OK button, justified text will replace the contents in cells that extend beyond the selected range. To prevent this message from appearing, set the DisplayAlerts property to False. After you set this property, text will always replace the contents in cells below the range.

Example

This example justifies the text in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Justify

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListNames Method (Excel)

 Copy code hover
[image]

Range.ListNames Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a list of all nonhidden names onto the worksheet, beginning with the first cell in the range.

Syntax

expression .ListNames

expression A variable that represents a Range object.

Return Value

Variant

Remarks

Use the Names property to return a collection of all the names on a worksheet.

Example

This example pastes a list of defined names into cell A1 on Sheet1. The example pastes both workbook-level names and sheet-level names defined on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").ListNames

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Merge Method (Excel)

 Copy code hover
[image]

Range.Merge Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a merged cell from the specified Range object.

Syntax

expression .Merge(Across)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Across | Optional | Variant | True to merge cells in each row of the specified range as separate merged cells. The default value is False.

Remarks

The value of a merged range is specified in the cell of the range's upper-left corner.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NavigateArrow Method (Excel)

 Copy code hover
[image]

Range.NavigateArrow Method (Excel)
See also Send feedback

Published: July 16, 2012

Navigates a tracer arrow for the specified range to the precedent, dependent, or error-causing cell or cells. Selects the precedent, dependent, or error cells and returns a Range object that represents the new selection. This method causes an error if it's applied to a cell without visible tracer arrows.

Syntax

expression .NavigateArrow(TowardPrecedent, ArrowNumber, LinkNumber)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
TowardPrecedent | Optional | Variant | Specifies the direction to navigate: True to navigate toward precedents, False to navigate toward dependent.
ArrowNumber | Optional | Variant | Specifies the arrow number to navigate; corresponds to the numbered reference in the cell's formula.
LinkNumber | Optional | Variant | If the arrow is an external reference arrow, this argument indicates which external reference to follow. If this argument is omitted, the first external reference is followed.

Return Value

Variant

Example

This example navigates along the first tracer arrow from cell A1 on Sheet1 toward the precedent cell. The example should be run on a worksheet containing a formula in cell A1 that includes references to cells D1, D2, and D3 (for example, the formula =D1*D2*D3). Before running the example, display the Auditing toolbar, select cell A1, and click the Trace Precedents button.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Range("A1").Select
ActiveCell.NavigateArrow True, 1

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NoteText Method (Excel)

 Copy code hover
[image]

Range.NoteText Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the cell note associated with the cell in the upper-left corner of the range. Read/write String. Cell notes have been replaced by range comments. For more information, see the Comment object.

Syntax

expression .NoteText(Text, Start, Length)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Optional | Variant | The text to add to the note (up to 255 characters). The text is inserted starting at position Start, replacing Length characters of the existing note. If this argument is omitted, this method returns the current text of the note starting at position Start, for Length characters.
Start | Optional | Variant | The starting position for the text that's set or returned. If this argument is omitted, this method starts at the first character. To append text to the note, specify a number larger than the number of characters in the existing note.
Length | Optional | Variant | The number of characters to be set or returned. If this argument is omitted, Microsoft Excel sets or returns characters from the starting position to the end of the note (up to 255 characters). If there are more than 255 characters from Start to the end of the note, this method returns only 255 characters.

Return Value

String

Remarks

To add a note that contains more than 255 characters, use this method once to specify the first 255 characters, and then use it again to append the remainder of the note (no more than 255 characters at a time).

Example

This example sets the cell note text for cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").NoteText "This may change!"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Parse Method (Excel)

 Copy code hover
[image]

Range.Parse Method (Excel)
See also Send feedback

Published: July 16, 2012

Parses a range of data and breaks it into multiple cells. Distributes the contents of the range to fill several adjacent columns; the range can be no more than one column wide.

Syntax

expression .Parse(ParseLine, Destination)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
ParseLine | Optional | Variant | A string that contains left and right brackets to indicate where the cells should be split.
Destination | Optional | Variant | A Range object that represents the upper-left corner of the destination range for the parsed data. If this argument is omitted, Microsoft Excel parses in place.

Return Value

Variant

Remarks

"[xxx][xxx]" would insert the first three characters into the first column of the destination range, and it would insert the next three characters into the second column. If this argument is omitted, Microsoft Excel guesses where to split the columns based on the spacing of the top left cell in the range. If you want to use a different range to guess the parse line, use a Range object as the ParseLine argument. That range must be one of the cells that's being parsed. The ParseLine argument cannot be longer than 255 characters, including the brackets and spaces.

Example

This example divides telephone numbers of the form 206-555-1212 into two columns. The first column contains only the area code, and the second column contains the seven-digit telephone number with the embedded hyphen.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("A").Parse _
 parseLine:="[xxx] [xxxxxxxx]", _
 destination:=Worksheets("Sheet1").Range("B1")

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteSpecial Method (Excel)

 Copy code hover
[image]

Range.PasteSpecial Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a Range from the Clipboard into the specified range.

Syntax

expression .PasteSpecial(Paste, Operation, SkipBlanks, Transpose)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Paste | Optional | XlPasteType | . The part of the range to be pasted.
Operation | Optional | XlPasteSpecialOperation | . The paste operation.
SkipBlanks | Optional | Variant | True to have blank cells in the range on the Clipboard not be pasted into the destination range. The default value is False.
Transpose | Optional | Variant | True to transpose rows and columns when the range is pasted.The default value is False.

Return Value

Variant

Example

This example replaces the data in cells D1:D5 on Sheet1 with the sum of the existing contents and cells C1:C5 on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1")
 .Range("C1:C5").Copy
 .Range("D1:D5").PasteSpecial _
 Operation:=xlPasteSpecialOperationAdd
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PrintOut Method (Excel)

 Copy code hover
[image]

Range.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PrintPreview Method (Excel)

 Copy code hover
[image]

Range.PrintPreview Method (Excel)
See also Send feedback

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Return Value

Variant

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Range Object

Other resources

Range Object Members


Range.RemoveDuplicates Method (Excel)

 Copy code hover
[image]

Range.RemoveDuplicates Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes duplicate values from a range of values.

Version Information

Version Added: Excel 2007

Syntax

expression .RemoveDuplicates(Columns, Header)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Columns | Optional | Variant | Array of indexes of the columns that contain the duplicate information. If nothing is passed then it assumes all columns contain duplicate information.
Header | Optional | XlYesNoGuess | Specifies whether the first row contains header information. xlNo is the default value; specify xlGuess if you want Excel to attempt to determine the header.

Example

The following code sample removes duplicates with all columns from a range.

Copy code Copy code
ActiveSheet.Range("A1:C100").RemoveDuplicates

The following code sample removes duplicates with the first 2 columns

Copy code Copy code
ActiveSheet.Range("A1:C100").RemoveDuplicates Columns:=Array(1,2), Header:=xlYes

See also

Concepts

Range Object

Other resources

Range Object Members


Range.RemoveSubtotal Method (Excel)

 Copy code hover
[image]

Range.RemoveSubtotal Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes subtotals from a list.

Syntax

expression .RemoveSubtotal

expression A variable that represents a Range object.

Return Value

Variant

Example

This example removes subtotals from the range A1:G37 on Sheet1. The example should be run on a list that has subtotals.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:G37").RemoveSubtotal

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Replace Method (Excel)

 Copy code hover
[image]

Range.Replace Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean indicating characters in cells within the specified range. Using this method doesn't change either the selection or the active cell.

Syntax

expression .Replace(What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | Variant | The string you want Microsoft Excel to search for.
Replacement | Required | Variant | The replacement string.
LookAt | Optional | Variant | Can be one of the following XlLookAt constants: xlWhole or xlPart.
SearchOrder | Optional | Variant | Can be one of the following XlSearchOrder constants: xlByRows or xlByColumns.
MatchCase | Optional | Variant | True to make the search case sensitive.
MatchByte | Optional | Variant | You can use this argument only if you've selected or installed double-byte language support in Microsoft Excel. True to have double-byte characters match only double-byte characters. False to have double-byte characters match their single-byte equivalents.
SearchFormat | Optional | Variant | The search format for the method.
ReplaceFormat | Optional | Variant | The replace format for the method.

Return Value

Boolean

Remarks

The settings for LookAt, SearchOrder, MatchCase, and MatchByte are saved each time you use this method. If you don't specify values for these arguments the next time you call the method, the saved values are used. Setting these arguments changes the settings in the Find dialog box, and changing the settings in the Find dialog box changes the saved values that are used if you omit the arguments. To avoid problems, set these arguments explicitly each time you use this method.

Example

This example replaces every occurrence of the trigonometric function SIN with the function COS. The replacement range is column A on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Columns("A").Replace _
 What:="SIN", Replacement:="COS", _
 SearchOrder:=xlByColumns, MatchCase:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.RowDifferences Method (Excel)

 Copy code hover
[image]

Range.RowDifferences Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells whose contents are different from those of the comparison cell in each row.

Syntax

expression .RowDifferences(Comparison)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Comparison | Required | Variant | A single cell to compare with the specified range.

Return Value

Range

Example

This example selects the cells in row one on Sheet1 whose contents are different from those of cell D1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Set c1 = ActiveSheet.Rows(1).RowDifferences( _
 comparison:=ActiveSheet.Range("D1"))
c1.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Run Method (Excel)

 Copy code hover
[image]

Range.Run Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs the Microsoft Excel macro at this location. The range must be on a macro sheet.

Syntax

expression .Run(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Arg30 | Optional | Variant | The arguments that should be passed to the function.

Return Value

Variant

Remarks

You cannot use named arguments with this method. Arguments must be passed by position.

The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Select Method (Excel)

 Copy code hover
[image]

Range.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Range object.

Return Value

Variant

Remarks

To select a cell or a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SetPhonetic Method (Excel)

 Copy code hover
[image]

Range.SetPhonetic Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates Phonetic objects for all the cells in the specified range.

Syntax

expression .SetPhonetic

expression A variable that represents a Range object.

Remarks

Any existing Phonetic objects in the specified range are automatically overwritten (deleted) by the new objects you add using this method.

Example

This example creates a Phonetic object for each cell in the range A1:A10 on the active worksheet.

VBA Copy code Copy code
ActiveSheet.Range("A1:A10").SetPhonetic

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Show Method (Excel)

 Copy code hover
[image]

Range.Show Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls through the contents of the active window to move the range into view. The range must consist of a single cell in the active document.

Syntax

expression .Show

expression A variable that represents a Range object.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShowDependents Method (Excel)

 Copy code hover
[image]

Range.ShowDependents Method (Excel)
See also Send feedback

Published: July 16, 2012

Draws tracer arrows to the direct dependents of the range.

Syntax

expression .ShowDependents(Remove)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Remove | Optional | Variant | True to remove one level of tracer arrows to direct dependents. False to expand one level of tracer arrows. The default value is False.

Return Value

Variant

Example

This example draws tracer arrows to dependents of the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.ShowDependents

This example removes the tracer arrow for one level of dependents of the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.ShowDependents Remove:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShowErrors Method (Excel)

 Copy code hover
[image]

Range.ShowErrors Method (Excel)
See also Send feedback

Published: July 16, 2012

Draws tracer arrows through the precedents tree to the cell that's the source of the error, and returns the range that contains that cell.

Syntax

expression .ShowErrors

expression A variable that represents a Range object.

Return Value

Variant

Example

This example displays a red tracer arrow if there's an error in the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
If IsError(ActiveCell.Value) Then
 ActiveCell.ShowErrors
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShowPrecedents Method (Excel)

 Copy code hover
[image]

Range.ShowPrecedents Method (Excel)
See also Send feedback

Draws tracer arrows to the direct precedents of the range.

Syntax

expression .ShowPrecedents(Remove)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Remove | Optional | Variant | True to remove one level of tracer arrows to direct precedents. False to expand one level of tracer arrows. The default value is False.

Return Value

Variant

Example

This example draws tracer arrows to the precedents of the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.ShowPrecedents

This example removes the tracer arrow for one level of precedents of the active cell on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.ShowPrecedents remove:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Sort Method (Excel)

 Copy code hover
[image]

Range.Sort Method (Excel)
See also Send feedback

Published: July 16, 2012

Sorts a range of values.

Syntax

expression .Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Key1 | Optional | Variant | Specifies the first sort field, either as a range name (String) or Range object; determines the values to be sorted.
Order1 | Optional | XlSortOrder | Determines the sort order for the values specified in Key1.
Key2 | Optional | Variant | Second sort field; cannot be used when sorting a pivot table.
Type | Optional | Variant | Specified which elements are to be sorted.
Order2 | Optional | XlSortOrder | Determines the sort order for the values specified in Key2.
Key3 | Optional | Variant | Third sort field; cannot be used when sorting a pivot table.
Order3 | Optional | XlSortOrder | Determines the sort order for the values specified in Key3.
Header | Optional | XlYesNoGuess | Specifies whether the first row contains header information. xlNo is the default value; specify xlGuess if you want Excel to attempt to determine the header.
OrderCustom | Optional | Variant | Specifies a one-based integer offset into the list of custom sort orders.
MatchCase | Optional | Variant | Set to True to perform a case-sensitive sort, False to perform non-case sensitive sort; cannot be used with pivot tables.
Orientation | Optional | XlSortOrientation | Specifies if the sort should be in acending or decending order.
SortMethod | Optional | XlSortMethod | Specifies the sort method.
DataOption1 | Optional | XlSortDataOption | Specifies how to sort text in the range specified in Key1; does not apply to pivot table sorting.
DataOption2 | Optional | XlSortDataOption | Specifies how to sort text in the range specified in Key2; does not apply to pivot table sorting.
DataOption3 | Optional | XlSortDataOption | Specifies how to sort text in the range specified in Key3; does not apply to pivot table sorting.

Return Value

Variant

Example

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example gets the value of the color of a cell in column A using the ColorIndex property, and then uses that value to sort the range by color.

VBA Copy code Copy code
Sub ColorSort()
   'Set up your variables and turn off screen updating.
   Dim iCounter As Integer
   Application.ScreenUpdating = False

   'For each cell in column A, go through and place the color index value of the cell in column C.
   For iCounter = 2 To 55
      Cells(iCounter, 3) = _
         Cells(iCounter, 1).Interior.ColorIndex
   Next iCounter

   'Sort the rows based on the data in column C
   Range("C1") = "Index"
   Columns("A:C").Sort key1:=Range("C2"), _
      order1:=xlAscending, header:=xlYes

   'Clear out the temporary sorting value in column C, and turn screen updating back on.
   Columns(3).ClearContents
   Application.ScreenUpdating = True
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SortSpecial Method (Excel)

 Copy code hover
[image]

Range.SortSpecial Method (Excel)
See also Send feedback

Published: July 16, 2012

Uses East Asian sorting methods to sort the range, a PivotTable report, or uses the method for the active region if the range contains only one cell. For example, Japanese sorts in the order of the Kana syllabary.

Syntax

expression .SortSpecial(SortMethod, Key1, Order1, Type, Key2, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, DataOption1, DataOption2, DataOption3)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
SortMethod | Optional | XlSortMethod | The type of sort. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
Key1 | Optional | Variant | The first sort field, as either text (a PivotTable field or range name) or a Range object ("Dept" or Cells(1, 1), for example).
Order1 | Optional | XlSortOrder | The sort order for the field or range specified in the Key1 argument.
Type | Optional | Variant | Specifies which elements are to be sorted. Use this argument only when sorting PivotTable reports.
Key2 | Optional | Variant | The second sort field, as either text (a PivotTable field or range name) or a Range object. If you omit this argument, there's no second sort field. Cannot be used when sorting PivotTable reports.
Order2 | Optional | XlSortOrder | The sort order for the field or range specified in the Key2 argument. Cannot be used when sorting PivotTable reports.
Key3 | Optional | Variant | The third sort field, as either text (a range name) or a Range object. If you omit this argument, there's no third sort field. Cannot be used when sorting PivotTable reports.
Order3 | Optional | XlSortOrder | The sort order for the field or range specified in the Key3 argument. Cannot be used when sorting PivotTable reports.
Header | Optional | XlYesNoGuess | Specifies whether or not the first row contains headers. Cannot be used when sorting PivotTable reports.
OrderCustom | Optional | Variant | This argument is a one-based integer offset to the list of custom sort orders. If you omit OrderCustom, (normal sort order) is used.
MatchCase | Optional | Variant | True to do a case-sensitive sort; False to do a sort that's not case sensitive. Cannot be used when sorting PivotTable reports.
Orientation | Optional | XlSortOrientation | The sort orientation.
DataOption1 | Optional | XlSortDataOption | Specifies how to sort text in Key1. Cannot be used when sorting PivotTable reports.
DataOption2 | Optional | XlSortDataOption | Specifies how to sort text in Key2. Cannot be used when sorting PivotTable reports.
DataOption3 | Optional | XlSortDataOption | Specifies how to sort text in Key3. Cannot be used when sorting PivotTable reports.

Return Value

Variant

Remarks

If no arguments are defined with the Sort method, Microsoft Excel will sort the selection, chosen to be sorted, in ascending order.

Example

This example sorts the range A1:A5 using Pin Yin (phonetic Chinese sort order for characters). In order to sort Chinese characters, this example assumes the user has Chinese language support for Microsoft Excel. Even without Chinese language support, Excel will default to sorting any numbers placed within the specified range for this example. This example assumes there is data contained in the range A1:A5.

VBA Copy code Copy code
Sub SpecialSort()

 Application.Range("A1:A5").SortSpecial SortMethod:=xlPinYin

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Speak Method (Excel)

 Copy code hover
[image]

Range.Speak Method (Excel)
See also Send feedback

Published: July 16, 2012

Causes the cells of the range to be spoken in row order or column order.

Syntax

expression .Speak(SpeakDirection, SpeakFormulas)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
SpeakDirection | Optional | Variant | The speak direction, by rows or columns.
SpeakFormulas | Optional | Variant | True will cause formulas to be sent to the Text-To-Speech (TTS) engine for cells that have formulas. The value is sent if the cells do not have formulas. False (default) will cause values to always be sent to the TTS engine.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SpecialCells Method (Excel)

 Copy code hover
[image]

Range.SpecialCells Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells that match the specified type and value.

Syntax

expression .SpecialCells(Type, Value)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlCellType | The cells to include.
Value | Optional | Variant | If Type is either xlCellTypeConstants or xlCellTypeFormulas, this argument is used to determine which types of cells to include in the result. These values can be added together to return more than one type. The default is to select all constants or formulas, no matter what the type.

Return Value

Range

Remarks

XlCellType constants | Value
xlCellTypeAllFormatConditions. Cells of any format | -4172
xlCellTypeAllValidation. Cells having validation criteria | -4174
xlCellTypeBlanks. Empty cells | 4
xlCellTypeComments. Cells containing notes | -4144
xlCellTypeConstants. Cells containing constants | 2
xlCellTypeFormulas. Cells containing formulas | -4123
xlCellTypeLastCell. The last cell in the used range | 11
xlCellTypeSameFormatConditions. Cells having the same format | -4173
xlCellTypeSameValidation. Cells having the same validation criteria | -4175
xlCellTypeVisible. All visible cells | 12
XlSpecialCellsValue constants | Value
xlErrors | 16
xlLogical | 4
xlNumbers | 1
xlTextValues | 2

Example

This example selects the last cell in the used range of Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SubscribeTo Method (Excel)

 Copy code hover
[image]

Range.SubscribeTo Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .SubscribeTo(Edition, Format)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Edition | Required | String | See help included with Microsoft Office Macintosh Edition.
Format | Optional | XlSubscribeToFormat | See help included with Microsoft Office Macintosh Edition.

Return Value

Variant

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Subtotal Method (Excel)

 Copy code hover
[image]

Range.Subtotal Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates subtotals for the range (or the current region, if the range is a single cell).

Syntax

expression .Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
GroupBy | Required | Long | The field to group by, as a one-based integer offset. For more information, see the example.
Function | Required | XlConsolidationFunction | . The subtotal function.
TotalList | Required | Variant | An array of 1-based field offsets, indicating the fields to which the subtotals are added. For more information, see the example.
Replace | Optional | Variant | True to replace existing subtotals. The default value is True.
PageBreaks | Optional | Variant | True to add page breaks after each group. The default value is False.
SummaryBelowData | Optional | XlSummaryRow | . Places the summary data relative to the subtotal.

Return Value

Variant

Example

This example creates subtotals for the selection on Sheet1. The subtotals are sums grouped by each change in field one, with the subtotals added to fields two and three.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Selection.Subtotal GroupBy:=1, Function:=xlSum, _
 TotalList:=Array(2, 3)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Table Method (Excel)

 Copy code hover
[image]

Range.Table Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a data table based on input values and formulas that you define on a worksheet.

Syntax

expression .Table(RowInput, ColumnInput)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
RowInput | Optional | Variant | A single cell to use as the row input for your table.
ColumnInput | Optional | Variant | A single cell to use as the column input for your table.

Return Value

Variant

Remarks

Use data tables to perform a what-if analysis by changing certain constant values on your worksheet to see how values in other cells are affected.

Example

This example creates a formatted multiplication table in cells A1:K11 on Sheet1.

VBA Copy code Copy code
Set dataTableRange = Worksheets("Sheet1").Range("A1:K11")
Set rowInputCell = Worksheets("Sheet1").Range("A12")
Set columnInputCell = Worksheets("Sheet1").Range("A13")

Worksheets("Sheet1").Range("A1").Formula = "=A12*A13"
For i = 2 To 11
 Worksheets("Sheet1").Cells(i, 1) = i - 1
 Worksheets("Sheet1").Cells(1, i) = i - 1
Next i
dataTableRange.Table rowInputCell, columnInputCell
With Worksheets("Sheet1").Range("A1").CurrentRegion
 .Rows(1).Font.Bold = True
 .Columns(1).Font.Bold = True
 .Columns.AutoFit
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TextToColumns Method (Excel)

 Copy code hover
[image]

Range.TextToColumns Method (Excel)
See also Send feedback

Published: July 16, 2012

Parses a column of cells that contain text into several columns.

Syntax

expression .TextToColumns(Destination, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Destination | Optional | Variant | A Range object that specifies where Microsoft Excel will place the results. If the range is larger than a single cell, the top left cell is used.
DataType | Optional | XlTextParsingType | The format of the text to be split into columns.
TextQualifier | Optional | XlTextQualifier | Specifies whether to use single, double or no quotes as the text qualifier.
ConsecutiveDelimiter | Optional | Variant | True to have Microsoft Excel consider consecutive delimiters as one delimiter. The default value is False.
Tab | Optional | Variant | True to have DataType be xlDelimited and to have the tab character be a delimiter. The default value is False.
Semicolon | Optional | Variant | True to have DataType be xlDelimited and to have the semicolon be a delimiter. The default value is False.
Comma | Optional | Variant | True to have DataType be xlDelimited and to have the comma be a delimiter. The default value is False.
Space | Optional | Variant | True to have DataType be xlDelimited and to have the space character be a delimiter. The default value is False.
Other | Optional | Variant | True to have DataType be xlDelimited and to have the character specified by the OtherChar argument be a delimiter. The default value is False.
OtherChar | Optional | Variant | (required if Other is True). The delimiter character when Other is True. If more than one character is specified, only the first character of the string is used; the remaining characters are ignored.
FieldInfo | Optional | Variant | An array containing parse information for the individual columns of data. The interpretation depends on the value of DataType. When the data is delimited, this argument is an array of two-element arrays, with each two-element array specifying the conversion options for a particular column. The first element is the column number (1-based), and the second element is one of the xlColumnDataType constants specifying how the column is parsed.
DecimalSeparator | Optional | Variant | The decimal separator that Microsoft Excel uses when recognizing numbers. The default setting is the system setting.
ThousandsSeparator | Optional | Variant | The thousands separator that Excel uses when recognizing numbers. The default setting is the system setting.
TrailingMinusNumbers | Optional | Variant | Numbers that begin with a minus character.

Return Value

Variant

Remarks

The following table shows the results of importing text into Excel for various import settings. Numeric results are displayed in the rightmost column.

System decimal separator | System thousands separator | Decimal separator value | Thousands separator value | Original text | Cell value (data type)
Period | Comma | Comma | Period | 123.123,45 | 123,123.45 (numeric)
Period | Comma | Comma | Comma | 123.123,45 | 123.123,45 (text)
Comma | Period | Comma | Period | 123,123.45 | 123,123.45 (numeric)
Period | Comma | Period | Comma | 123 123.45 | 123 123.45 (text)
Period | Comma | Period | Space | 123 123.45 | 123,123.45 (numeric)

XlColumnDataType can be one of these XlColumnDataType constants.

xlGeneralFormat. General

xlTextFormat. Text

xlMDYFormat. MDY Date

xlDMYFormat. DMY Date

xlYMDFormat. YMD Date

xlMYDFormat. MYD Date

xlDYMFormat. DYM Date

xlYDMFormat. YDM Date

xlEMDFormat. EMD Date

xlSkipColumn. Skip Column

You can use xlEMDFormat only if Taiwanese language support is installed and selected. The xlEMDFormat constant specifies that Taiwanese era dates are being used.

The column specifiers can be in any order. If a given column specifier is not present for a particular column in the input data, the column is parsed with the xlGeneralFormat setting. This example causes the third column to be skipped, the first column to be parsed as text, and the remaining columns in the source data to be parsed with the xlGeneralFormat setting.

Array(Array(3, 9), Array(1, 2))

If the source data has fixed-width columns, the first element of each two-element array specifies the starting character position in the column (as an integer; 0 (zero) is the first character). The second element of the two-element array specifies the parse option for the column as a number from 1 through 9, as listed above.

The following example parses two columns from a fixed-width file, with the first column starting at the beginning of the line and extending for 10 characters. The second column starts at position 15 and goes to the end of the line. To avoid including the characters between position 10 and position 15, Microsoft Excel adds a skipped column entry.

Array(Array(0, 1), Array(10, 9), Array(15, 1))

Example

This example converts the contents of the Clipboard, which contains a space-delimited text table, into separate columns on Sheet1. You can create a simple space-delimited table in Notepad or WordPad (or another text editor), copy the text table to the Clipboard, switch to Microsoft Excel, and then run this example.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.Paste
Selection.TextToColumns DataType:=xlDelimited, _
 ConsecutiveDelimiter:=True, Space:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Ungroup Method (Excel)

 Copy code hover
[image]

Range.Ungroup Method (Excel)
See also Send feedback

Published: July 16, 2012

Promotes a range in an outline (that is, decreases its outline level). The specified range must be a row or column, or a range of rows or columns. If the range is in a PivotTable report, this method ungroups the items contained in the range.

Syntax

expression .Ungroup

expression A variable that represents a Range object.

Return Value

Variant

Remarks

If the active cell is in a field header of a parent field, all the groups in that field are ungrouped and the field is removed from the PivotTable report. When the last group in a parent field is ungrouped, the entire field is removed from the report.

Example

This example ungroups the ORDER_DATE field.

VBA Copy code Copy code
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Set groupRange = pvtTable.PivotFields("ORDER_DATE").DataRange
groupRange.Cells(1).Ungroup

See also

Concepts

Range Object

Other resources

Range Object Members


Range.UnMerge Method (Excel)

 Copy code hover
[image]

Range.UnMerge Method (Excel)
See also Send feedback

Published: July 16, 2012

Separates a merged area into individual cells.

Syntax

expression .UnMerge

expression A variable that represents a Range object.

Example

This example separates the merged range that contains cell A3.

VBA Copy code Copy code
With Range("a3")
 If .MergeCells Then
 .MergeArea.UnMerge
 Else
 MsgBox "not merged"
 End If
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Ranges Object (Excel)

 Copy code hover
[image]

Ranges Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of Range objects.

Version Information

Version Added: Excel 2007

See also

Concepts

Excel Object Model Reference

Other resources

Ranges Object Members


Ranges Members (Excel)

 Copy code hover
[image]

Ranges Members (Excel)
Send feedback

Published: July 16, 2012

A collection of Range objects.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Range object that represents a range of items in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Ranges Properties (Excel)

 Copy code hover
[image]

Ranges Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Range object that represents a range of items in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


Ranges.Application Property (Excel)

 Copy code hover
[image]

Ranges.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Ranges object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Ranges Object

Other resources

Ranges Object Members


Ranges.Count Property (Excel)

 Copy code hover
[image]

Ranges.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a Ranges object.

See also

Concepts

Ranges Object

Other resources

Ranges Object Members


Ranges.Creator Property (Excel)

 Copy code hover
[image]

Ranges.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Ranges object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Ranges Object

Other resources

Ranges Object Members


Ranges.Item Property (Excel)

 Copy code hover
[image]

Ranges.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a range of items in a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a Ranges object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index value of the range item.

See also

Concepts

Ranges Object

Other resources

Ranges Object Members


Ranges.Parent Property (Excel)

 Copy code hover
[image]

Ranges.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Ranges object.

See also

Concepts

Ranges Object

Other resources

Ranges Object Members


RecentFile Object (Excel)

 Copy code hover
[image]

RecentFile Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a file in the list of recently used files.

Remarks

The RecentFile object is a member of the RecentFiles collection.

Example

Use RecentFiles(index), where index is the file number, to return a RecentFile object. The following example opens file two in the list of recently used files.

VBA Copy code Copy code
Application.RecentFiles(2).Open

See also

Concepts

Excel Object Model Reference

Other resources

RecentFile Object Members


RecentFile Members (Excel)

 Copy code hover
[image]

RecentFile Members (Excel)
Send feedback

Published: July 16, 2012

Represents a file in the list of recently used files.

Methods

Name | Description
Delete | Deletes the object.
Open | Opens a recent workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the workbook/file that this RecentFile object respresents .


RecentFile Properties (Excel)

 Copy code hover
[image]

RecentFile Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Path | Returns a String value that represents the complete path to the workbook/file that this RecentFile object respresents .


RecentFile.Application Property (Excel)

 Copy code hover
[image]

RecentFile.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a RecentFile object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Creator Property (Excel)

 Copy code hover
[image]

RecentFile.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a RecentFile object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Index Property (Excel)

 Copy code hover
[image]

RecentFile.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Name Property (Excel)

 Copy code hover
[image]

RecentFile.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Parent Property (Excel)

 Copy code hover
[image]

RecentFile.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Path Property (Excel)

 Copy code hover
[image]

RecentFile.Path Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the complete path to the workbook/file that this RecentFile object respresents .

Syntax

expression .Path

expression A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile Methods (Excel)

 Copy code hover
[image]

RecentFile Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Open | Opens a recent workbook.


RecentFile.Delete Method (Excel)

 Copy code hover
[image]

RecentFile.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Open Method (Excel)

 Copy code hover
[image]

RecentFile.Open Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens a recent workbook.

Syntax

expression .Open

expression A variable that represents a RecentFile object.

Return Value

A Workbook object that represents the opened workbook.

Example

This example opens the second workbook in the recently used list.

VBA Copy code Copy code
Application.RecentFiles(2).Open

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFiles Object (Excel)

 Copy code hover
[image]

RecentFiles Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the list of recently used files.

Remarks

Each file is represented by a RecentFile object.

Example

Use the RecentFiles property to return the RecentFiles collection. The following example sets the maximum number of files in the list of recently used files.

VBA Copy code Copy code
Application.RecentFiles.Maximum = 6

See also

Concepts

Excel Object Model Reference

Other resources

RecentFiles Object Members


RecentFiles Members (Excel)

 Copy code hover
[image]

RecentFiles Members (Excel)
Send feedback

Published: July 16, 2012

Represents the list of recently used files.

Methods

Name | Description
Add | Adds a file to the list of recently used files.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Maximum | Returns or sets the maximum number of files in the list of recently used files. Can be a value from 0 (zero) through 50. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.


RecentFiles Properties (Excel)

 Copy code hover
[image]

RecentFiles Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Maximum | Returns or sets the maximum number of files in the list of recently used files. Can be a value from 0 (zero) through 50. Read/write Long.
Parent | Returns the parent object for the specified object. Read-only.


RecentFiles.Application Property (Excel)

 Copy code hover
[image]

RecentFiles.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a RecentFiles object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles.Count Property (Excel)

 Copy code hover
[image]

RecentFiles.Count Property (Excel)
See also Send feedback

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a RecentFiles object.

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles.Creator Property (Excel)

 Copy code hover
[image]

RecentFiles.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a RecentFiles object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles.Item Property (Excel)

 Copy code hover
[image]

RecentFiles.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a RecentFiles object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example opens file two in the list of recently used files.

VBA Copy code Copy code
Application.RecentFiles.Item(2).Open

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles.Maximum Property (Excel)

 Copy code hover
[image]

RecentFiles.Maximum Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of files in the list of recently used files. Can be a value from 0 (zero) through 50. Read/write Long.

Syntax

expression .Maximum

expression A variable that represents a RecentFiles object.

Example

This example sets the maximum number of files in the list of recently used files to 6.

VBA Copy code Copy code
Application.RecentFiles.Maximum = 6

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles.Parent Property (Excel)

 Copy code hover
[image]

RecentFiles.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a RecentFiles object.

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RecentFiles Methods (Excel)

 Copy code hover
[image]

RecentFiles Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a file to the list of recently used files.


RecentFiles.Add Method (Excel)

 Copy code hover
[image]

RecentFiles.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a file to the list of recently used files.

Syntax

expression .Add(Name)

expression A variable that represents a RecentFiles object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The file name.

Return Value

A RecentFile object contained by the collection.

Example

This example adds Oscar.xls to the list of recently used files.

VBA Copy code Copy code
Application.RecentFiles.Add Name:="Oscar.xls"

See also

Concepts

RecentFiles Object

Other resources

RecentFiles Object Members


RectangularGradient Object (Excel)

 Copy code hover
[image]

RectangularGradient Object (Excel)
See also Send feedback

Published: July 16, 2012

The RectangularGradient object transitions through a series of colors in a linear manner along a specific angle.

Version Information

Version Added: Excel 2007

Remarks

  • Attempting to access a Gradient property of an Interior object that does not have an existing gradient fill will result in a Run Time Error. Be aware of the Interior.Pattern property before accessing the Gradient property.

  • If Interior.Pattern is changed from a gradient type to a non-gradient type, the Gradient object will populate with default values.

Note Note

Some things to consider when working with RectangularGradient objects

See also

Concepts

Excel Object Model Reference

Other resources

RectangularGradient Object Members


RectangularGradient Members (Excel)

 Copy code hover
[image]

RectangularGradient Members (Excel)
Send feedback

Published: July 16, 2012

The RectangularGradient object transitions through a series of colors in a linear manner along a specific angle.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
ColorStops | Returns the ColorStops collection for the RectangularGradient object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Parent | Returns the parent object for the specified object. Read-only
RectangleBottom | Represents the point or vector that the gradient fill converges to. Read/write
RectangleLeft | Represents the point or vector that the gradient fill converges to. Read/write
RectangleRight | Represents the point or vector that the gradient fill converges to. Read/write
RectangleTop | Represents the point or vector that the gradient fill converges to. Read/write


RectangularGradient Properties (Excel)

 Copy code hover
[image]

RectangularGradient Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
ColorStops | Returns the ColorStops collection for the RectangularGradient object. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long
Parent | Returns the parent object for the specified object. Read-only
RectangleBottom | Represents the point or vector that the gradient fill converges to. Read/write
RectangleLeft | Represents the point or vector that the gradient fill converges to. Read/write
RectangleRight | Represents the point or vector that the gradient fill converges to. Read/write
RectangleTop | Represents the point or vector that the gradient fill converges to. Read/write


RectangularGradient.Application Property (Excel)

 Copy code hover
[image]

RectangularGradient.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a RectangularGradient object.

Return Value

Application

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.ColorStops Property (Excel)

 Copy code hover
[image]

RectangularGradient.ColorStops Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ColorStops collection for the RectangularGradient object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .ColorStops

expression A variable that represents a RectangularGradient object.

Return Value

ColorStops

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.Creator Property (Excel)

 Copy code hover
[image]

RectangularGradient.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a RectangularGradient object.

Return Value

XlCreator

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.Parent Property (Excel)

 Copy code hover
[image]

RectangularGradient.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a RectangularGradient object.

Return Value

Object

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.RectangleBottom Property (Excel)

 Copy code hover
[image]

RectangularGradient.RectangleBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Represents the point or vector that the gradient fill converges to. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .RectangleBottom

expression A variable that represents a RectangularGradient object.

Return Value

Double

Remarks

Works with RectangleLeft, RectangleRight, and RectangleTop. Valid values are listed in the table below.

Property | Values
RectangleLeft | 0-1
RectangleRight | 0-1
RectangleTop | 0-1
RectangleBottom | 0-1

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.RectangleLeft Property (Excel)

 Copy code hover
[image]

RectangularGradient.RectangleLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Represents the point or vector that the gradient fill converges to. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .RectangleLeft

expression A variable that represents a RectangularGradient object.

Return Value

Double

Remarks

Works with RectangleRight, RectangleTop, and RectangleBottom. Valid values are listed in the table below.

Property | Values
RectangleLeft | 0-1
RectangleRight | 0-1
RectangleTop | 0-1
RectangleBottom | 0-1

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.RectangleRight Property (Excel)

 Copy code hover
[image]

RectangularGradient.RectangleRight Property (Excel)
See also Send feedback

Published: July 16, 2012

Represents the point or vector that the gradient fill converges to. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .RectangleRight

expression A variable that represents a RectangularGradient object.

Return Value

Double

Remarks

Works with RectangleLeft, RectangleTop, and RectangleBottom. Valid values are listed in the table below.

Property | Values
RectangleLeft | 0-1
RectangleRight | 0-1
RectangleTop | 0-1
RectangleBottom | 0-1

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


RectangularGradient.RectangleTop Property (Excel)

 Copy code hover
[image]

RectangularGradient.RectangleTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Represents the point or vector that the gradient fill converges to. Read/write

Version Information

Version Added: Excel 2007

Syntax

expression .RectangleTop

expression A variable that represents a RectangularGradient object.

Return Value

Double

Remarks

Works with RectangleLeft, RectangleRight, and RectangleBottom. Valid values are listed in the table below.

Property | Values
RectangleLeft | 0-1
RectangleRight | 0-1
RectangleTop | 0-1
RectangleBottom | 0-1

See also

Concepts

RectangularGradient Object

Other resources

RectangularGradient Object Members


Research Object (Excel)

 Copy code hover
[image]

Research Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the controls of a Research query.

Remarks

When working with Research queries, you must have an existing GUID that corresponds to a live data source. If the data source is unavailable or does not exist, a run-time error occurs.

Example

The following example returns data from an existing data source and translates the information into working content.

VBA Copy code Copy code
Worksheets("Sheet1").Research.Translate = True

See also

Concepts

Excel Object Model Reference

Other resources

Research Object Members


Research Members (Excel)

 Copy code hover
[image]

Research Members (Excel)
Send feedback

Published: July 16, 2012

Represents the controls of a Research query.

Methods

Name | Description
IsResearchService | Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.
Query | Specifies a research query.
SetLanguagePair | Sets the languages for the translation service.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Research Properties (Excel)

 Copy code hover
[image]

Research Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Research.Application Property (Excel)

 Copy code hover
[image]

Research.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Research object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Creator Property (Excel)

 Copy code hover
[image]

Research.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Research object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Parent Property (Excel)

 Copy code hover
[image]

Research.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Research object.

See also

Concepts

Research Object

Other resources

Research Object Members


Research Methods (Excel)

 Copy code hover
[image]

Research Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IsResearchService | Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.
Query | Specifies a research query.
SetLanguagePair | Sets the languages for the translation service.


Research.IsResearchService Method (Excel)

 Copy code hover
[image]

Research.IsResearchService Method (Excel)
See also Send feedback

Published: July 16, 2012

Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.

Version Information

Version Added: Excel 2007

Syntax

expression .IsResearchService(ServiceID)

expression A variable that represents a Research object.

Parameters

Name | Required/Optional | Data Type | Description
ServiceID | Required | String | Specifies a GUID that identifies the research service.

Return Value

Boolean

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Query Method (Excel)

 Copy code hover
[image]

Research.Query Method (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a research query.

Version Information

Version Added: Excel 2007

Syntax

expression .Query(ServiceID, QueryString, QueryLanguage, UseSelection, RequeryContextXML, NewQueryContextXML, LaunchQuery)

expression A variable that represents a Research object.

Parameters

Name | Required/Optional | Data Type | Description
ServiceID | Required | String | Specifies a GUID that identifies the research service.
QueryString | Optional | Variant | Specifies the query string.
QueryLanguage | Optional | Variant | Specifies the query language of the query string.
UseSelection | Optional | Boolean | True to use the current selection as the query string. This overrides the QueryString parameter if set. Default value is False.
RequeryContextXML | Optional | Variant | Specifies the xml file containing the requested content.
NewQueryContextXML | Optional | Variant | Specifies the XML file containing the new query content.
LaunchQuery | Optional | Boolean | True launches the query. False displays the Research task pane scoped to search the specified research service.

Return Value

Variant

See also

Concepts

Research Object

Other resources

Research Object Members


Research.SetLanguagePair Method (Excel)

 Copy code hover
[image]

Research.SetLanguagePair Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the languages for the translation service.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLanguagePair(LanguageFrom, LanguageTo)

expression A variable that represents a Research object.

Parameters

Name | Required/Optional | Data Type | Description
LanguageFrom | Required | Long | Specifies the language to translate from.
LanguageTo | Required | Long | Specifies the langauge to translate to.

Return Value

Variant

See also

Concepts

Research Object

Other resources

Research Object Members


RoutingSlip Object (Excel)

 Copy code hover
[image]

RoutingSlip Object (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

Excel Object Model Reference

Other resources

RoutingSlip Object Members


RoutingSlip Members (Excel)

 Copy code hover
[image]

RoutingSlip Members (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Methods

Name | Description
Reset | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Properties

Name | Description
Application | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Creator | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Delivery | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Message | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Parent | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Recipients | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
ReturnWhenDone | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Status | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Subject | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
TrackStatus | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


RoutingSlip Properties (Excel)

 Copy code hover
[image]

RoutingSlip Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Creator | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Delivery | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Message | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Parent | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Recipients | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
ReturnWhenDone | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Status | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Subject | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
TrackStatus | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


RoutingSlip.Application Property (Excel)

 Copy code hover
[image]

RoutingSlip.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Creator Property (Excel)

 Copy code hover
[image]

RoutingSlip.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Delivery Property (Excel)

 Copy code hover
[image]

RoutingSlip.Delivery Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Message Property (Excel)

 Copy code hover
[image]

RoutingSlip.Message Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Parent Property (Excel)

 Copy code hover
[image]

RoutingSlip.Parent Property (Excel)
See also Send feedback

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Recipients Property (Excel)

 Copy code hover
[image]

RoutingSlip.Recipients Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.ReturnWhenDone Property (Excel)

 Copy code hover
[image]

RoutingSlip.ReturnWhenDone Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Status Property (Excel)

 Copy code hover
[image]

RoutingSlip.Status Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.Subject Property (Excel)

 Copy code hover
[image]

RoutingSlip.Subject Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip.TrackStatus Property (Excel)

 Copy code hover
[image]

RoutingSlip.TrackStatus Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RoutingSlip Methods (Excel)

 Copy code hover
[image]

RoutingSlip Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Reset | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


RoutingSlip.Reset Method (Excel)

 Copy code hover
[image]

RoutingSlip.Reset Method (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

RoutingSlip Object

Other resources

RoutingSlip Object Members


RTD Object (Excel)

 Copy code hover
[image]

RTD Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a real-time data object.

Remarks

Use the RTD property of the Application object to return a RTD object.

See also

Concepts

Excel Object Model Reference

Other resources

RTD Object Members


RTD Members (Excel)

 Copy code hover
[image]

RTD Members (Excel)
Send feedback

Published: July 16, 2012

Represents a real-time data object.

Methods

Name | Description
RefreshData | Requests an update of real-time data from the real-time data server.
RestartServers | Reconnects to a real-time data server (RTD).

Properties

Name | Description
ThrottleInterval | Returns or sets a Long indicating the time interval between updates. Read/write.


RTD Properties (Excel)

 Copy code hover
[image]

RTD Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ThrottleInterval | Returns or sets a Long indicating the time interval between updates. Read/write.


RTD.ThrottleInterval Property (Excel)

 Copy code hover
[image]

RTD.ThrottleInterval Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long indicating the time interval between updates. Read/write.

Syntax

expression .ThrottleInterval

expression A variable that represents a RTD object.

Remarks

The default value is 2000 milliseconds. If this value is changed, the new value will persist when Microsoft Excel is restarted.

See also

Concepts

RTD Object

Other resources

RTD Object Members


RTD Methods (Excel)

 Copy code hover
[image]

RTD Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
RefreshData | Requests an update of real-time data from the real-time data server.
RestartServers | Reconnects to a real-time data server (RTD).


RTD.RefreshData Method (Excel)

 Copy code hover
[image]

RTD.RefreshData Method (Excel)
See also Send feedback

Published: July 16, 2012

Requests an update of real-time data from the real-time data server.

Syntax

expression .RefreshData

expression A variable that represents a RTD object.

Remarks

Avoid using the RefreshData method in user-defined functions because this method will fail if it is called during recalculation.

See also

Concepts

RTD Object

Other resources

RTD Object Members


RTD.RestartServers Method (Excel)

 Copy code hover
[image]

RTD.RestartServers Method (Excel)
See also Send feedback

Published: July 16, 2012

Reconnects to a real-time data server (RTD).

Syntax

expression .RestartServers

expression A variable that represents a RTD object.

See also

Concepts

RTD Object

Other resources

RTD Object Members


Scenario Object (Excel)

 Copy code hover
[image]

Scenario Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a scenario on a worksheet.

Remarks

A scenario is a group of input values (called changing cells) that's named and saved. The Scenario object is a member of the Scenarios collection. The Scenarios collection contains all the defined scenarios for a worksheet.

Example

Use Scenarios(index), where index is the scenario name or index number, to return a single Scenario object. The following example shows the scenario named "Typical" on the worksheet named "Options."

VBA Copy code Copy code
Worksheets("options").Scenarios("typical").Show

See also

Concepts

Excel Object Model Reference

Other resources

Scenario Object Members


Scenario Members (Excel)

 Copy code hover
[image]

Scenario Members (Excel)
Send feedback

Published: July 16, 2012

Represents a scenario on a worksheet.

Methods

Name | Description
ChangeScenario | Changes the scenario to have a new set of changing cells and (optionally) scenario values.
Delete | Deletes the object.
Show | Shows the scenario by inserting its values on the worksheet. The affected cells are the changing cells of the scenario.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ChangingCells | Returns a Range object that represents the changing cells for a scenario. Read-only.
Comment | Returns or sets a String value that represents the comment associated with the scenario.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Hidden | Returns or sets a Boolean value that indicates if the scenario is hidden.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Values | Returns a Variant array that contains the current values of the changing cells for the scenario.


Scenario Properties (Excel)

 Copy code hover
[image]

Scenario Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ChangingCells | Returns a Range object that represents the changing cells for a scenario. Read-only.
Comment | Returns or sets a String value that represents the comment associated with the scenario.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Hidden | Returns or sets a Boolean value that indicates if the scenario is hidden.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
Values | Returns a Variant array that contains the current values of the changing cells for the scenario.


Scenario.Application Property (Excel)

 Copy code hover
[image]

Scenario.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Scenario object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.ChangingCells Property (Excel)

 Copy code hover
[image]

Scenario.ChangingCells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the changing cells for a scenario. Read-only.

Syntax

expression .ChangingCells

expression A variable that represents a Scenario object.

Example

This example selects the changing cells for scenario one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.Scenarios(1).ChangingCells.Select

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Comment Property (Excel)

 Copy code hover
[image]

Scenario.Comment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the comment associated with the scenario.

Syntax

expression .Comment

expression A variable that represents a Scenario object.

Remarks

The comment text cannot exceed 255 characters.

Example

This example sets the comment for scenario one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Scenarios(1).Comment = _
 "Worst case July 1993 sales"

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Creator Property (Excel)

 Copy code hover
[image]

Scenario.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Scenario object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Hidden Property (Excel)

 Copy code hover
[image]

Scenario.Hidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the scenario is hidden.

Syntax

expression .Hidden

expression A variable that represents a Scenario object.

Remarks

The default value for this property is False.

Don't confuse this property with the FormulaHidden property.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Index Property (Excel)

 Copy code hover
[image]

Scenario.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Scenario object.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Locked Property (Excel)

 Copy code hover
[image]

Scenario.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a Scenario object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Name Property (Excel)

 Copy code hover
[image]

Scenario.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Scenario object.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Parent Property (Excel)

 Copy code hover
[image]

Scenario.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Scenario object.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Values Property (Excel)

 Copy code hover
[image]

Scenario.Values Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant array that contains the current values of the changing cells for the scenario.

Syntax

expression .Values(Index)

expression A variable that represents a Scenario object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The position of the value.

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario Methods (Excel)

 Copy code hover
[image]

Scenario Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ChangeScenario | Changes the scenario to have a new set of changing cells and (optionally) scenario values.
Delete | Deletes the object.
Show | Shows the scenario by inserting its values on the worksheet. The affected cells are the changing cells of the scenario.


Scenario.ChangeScenario Method (Excel)

 Copy code hover
[image]

Scenario.ChangeScenario Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the scenario to have a new set of changing cells and (optionally) scenario values.

Syntax

expression .ChangeScenario(ChangingCells, Values)

expression A variable that represents a Scenario object.

Parameters

Name | Required/Optional | Data Type | Description
ChangingCells | Required | Variant | A Range object that specifies the new set of changing cells for the scenario. The changing cells must be on the same sheet as the scenario.
Values | Optional | Variant | An array that contains the new scenario values for the changing cells. If this argument is omitted, the scenario values are assumed to be the current values in the changing cells.

Return Value

Variant

Remarks

If you specify Values, the array must contain an element for each cell in the ChangingCells range; otherwise, Microsoft Excel generates an error.

Example

This example sets the changing cells for scenario one to the range A1:A10 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Scenarios(1).ChangeScenario _
 Worksheets("Sheet1").Range("A1:A10")

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Delete Method (Excel)

 Copy code hover
[image]

Scenario.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Scenario object.

Return Value

Variant

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenario.Show Method (Excel)

 Copy code hover
[image]

Scenario.Show Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows the scenario by inserting its values on the worksheet. The affected cells are the changing cells of the scenario.

Syntax

expression .Show

expression A variable that represents a Scenario object.

Return Value

Variant

See also

Concepts

Scenario Object

Other resources

Scenario Object Members


Scenarios Object (Excel)

 Copy code hover
[image]

Scenarios Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Scenario objects on the specified worksheet.

Remarks

A scenario is a group of input values (called changing cells) that's named and saved.

Example

Use the Scenarios method to return the Scenarios collection. The following example creates a summary for the scenarios on the worksheet named "Options," using cells J10 and J20 as the result cells.

VBA Copy code Copy code
Worksheets("options").Scenarios.CreateSummary _
 resultCells:=Worksheets("options").Range("j10,j20")

Use the Add method to create a new scenario and add it to the collection. The following example adds a new scenario named "Typical" to the worksheet named "Options." The new scenario has two changing cells, A2 and A12, with the respective values 55 and 60.

VBA Copy code Copy code
Worksheets("options").Scenarios.Add name:="Typical", _
 changingCells:=Worksheets("options").Range("A2,A12"), _
 values:=Array("55", "60")

Use Scenarios(index), where index is the scenario name or index number, to return a single Scenario object. The following example shows the scenario named "Typical" on the worksheet named "Options."

VBA Copy code Copy code
Worksheets("options").Scenarios("typical").Show

See also

Concepts

Excel Object Model Reference

Other resources

Scenarios Object Members


Scenarios Members (Excel)

 Copy code hover
[image]

Scenarios Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Scenario objects on the specified worksheet.

Methods

Name | Description
Add | Creates a new scenario and adds it to the list of scenarios that are available for the current worksheet.
CreateSummary | Creates a new worksheet that contains a summary report for the scenarios on the specified worksheet. Variant.
Item | Returns a single object from a collection.
Merge | Merges the scenarios from another sheet into the Scenarios collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Scenarios Properties (Excel)

 Copy code hover
[image]

Scenarios Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Scenarios.Application Property (Excel)

 Copy code hover
[image]

Scenarios.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Scenarios object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.Count Property (Excel)

 Copy code hover
[image]

Scenarios.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Scenarios object.

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.Creator Property (Excel)

 Copy code hover
[image]

Scenarios.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Scenarios object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.Parent Property (Excel)

 Copy code hover
[image]

Scenarios.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Scenarios object.

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios Methods (Excel)

 Copy code hover
[image]

Scenarios Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new scenario and adds it to the list of scenarios that are available for the current worksheet.
CreateSummary | Creates a new worksheet that contains a summary report for the scenarios on the specified worksheet. Variant.
Item | Returns a single object from a collection.
Merge | Merges the scenarios from another sheet into the Scenarios collection.


Scenarios.Add Method (Excel)

 Copy code hover
[image]

Scenarios.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new scenario and adds it to the list of scenarios that are available for the current worksheet.

Syntax

expression .Add(Name, ChangingCells, Values, Comment, Locked, Hidden)

expression A variable that represents a Scenarios object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The scenario name.
ChangingCells | Required | Variant | A Range object that refers to the changing cells for the scenario.
Values | Optional | Variant | An array that contains the scenario values for the cells in ChangingCells. If this argument is omitted, the scenario values are assumed to be the current values in the cells inChangingCells.
Comment | Optional | Variant | A string that specifies comment text for the scenario. When a new scenario is added, the author's name and date are automatically added at the beginning of the comment text.
Locked | Optional | Variant | True to lock the scenario to prevent changes. The default value is True.
Hidden | Optional | Variant | True to hide the scenario. The default value is False.

Return Value

A Scenario object that represents the new scenario.

Remarks

A scenario name must be unique; Microsoft Excel generates an error if you try to create a scenario with a name that's already in use.

Example

This example adds a new scenario to Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Scenarios.Add Name:="Best Case", _
 ChangingCells:=Worksheets("Sheet1").Range("A1:A4"), _
 Values:=Array(23, 5, 6, 21), _
 Comment:="Most favorable outcome."

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.CreateSummary Method (Excel)

 Copy code hover
[image]

Scenarios.CreateSummary Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new worksheet that contains a summary report for the scenarios on the specified worksheet. Variant.

Syntax

expression .CreateSummary(ReportType, ResultCells)

expression A variable that represents a Scenarios object.

Parameters

Name | Required/Optional | Data Type | Description
ReportType | Optional | XlSummaryReportType | Specifies whether the summary report is a PivotTable or standard summary.
ResultCells | Optional | Variant | A Range object that represents the result cells on the specified worksheet. Normally, this range refers to one or more cells containing the formulas that depend on the changing cell values for your model — that is, the cells that show the results of a particular scenario. If this argument is omitted, there are no result cells included in the report.

Return Value

Variant

Example

This example creates a summary of the scenarios on Sheet1, with result cells in the range C4:C9 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Scenarios.CreateSummary _
 ResultCells := Worksheets("Sheet1").Range("C4:C9")

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.Item Method (Excel)

 Copy code hover
[image]

Scenarios.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Scenarios object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Scenario object contained by the collection.

Example

This example shows the scenario named Typical on the worksheet named Options.

VBA Copy code Copy code
Worksheets("options").Scenarios.Item("typical").Show

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Scenarios.Merge Method (Excel)

 Copy code hover
[image]

Scenarios.Merge Method (Excel)
See also Send feedback

Published: July 16, 2012

Merges the scenarios from another sheet into the Scenarios collection.

Syntax

expression .Merge(Source)

expression A variable that represents a Scenarios object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The name of the sheet that contains scenarios to be merged, or a Worksheet object that represents that sheet.

Return Value

Variant

Remarks

The value of a merged range is specified in the cell of the range's upper-left corner.

See also

Concepts

Scenarios Object

Other resources

Scenarios Object Members


Series Object (Excel)

 Copy code hover
[image]

Series Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a series in a chart.

Remarks

The Series object is a member of the SeriesCollection collection.

Example

Use SeriesCollection(index), where index is the series index number or name, to return a single Series object. The following example sets the color of the interior for the first series in embedded chart one on Sheet1.

The series index number indicates the order in which the series were added to the chart. SeriesCollection(1) is the first series added to the chart, and SeriesCollection(SeriesCollection.Count) is the last one added.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart. _
 SeriesCollection(1).Interior.Color = RGB(255, 0, 0)

See also

Concepts

Excel Object Model Reference

Other resources

Series Object Members


Series Members (Excel)

 Copy code hover
[image]

Series Members (Excel)
Send feedback

Represents a series in a chart.

Methods

Name | Description
ApplyDataLabels | Applies data labels to a series.
ClearFormats | Clears the formatting of the object.
Copy | If the series has a picture fill, then this method copies the picture to the Clipboard.
DataLabels | Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).
Delete | Deletes the object.
ErrorBar | Applies error bars to the series. Variant.
Paste | Pastes a picture from the Clipboard as the marker on the selected series.
Points | Returns an object that represents a single point (a Point object) or a collection of all the points (a Points collection) in the series. Read-only
Select | Selects the object.
Trendlines | Returns an object that represents a single trendline (a Trendline object) or a collection of all the trendlines (a Trendlines collection) for the series.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
AxisGroup | Returns or sets the group for the specified series. Read/write
BarShape | Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.
BubbleSizes | Returns or sets a string that refers to the worksheet cells containing the x-value, y-value and size data for the bubble chart. When you return the cell reference, it will return a string describing the cells in A1-style notation. To set the size data for the bubble chart, you must use R1C1-style notation. Applies only to bubble charts. Read/write Variant.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorBars | Returns an ErrorBars object that represents the error bars for the series. Read-only.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Has3DEffect | True if the series has a three-dimensional appearance. Read/write Boolean.
HasDataLabels | True if the series has data labels. Read/write Boolean.
HasErrorBars | True if the series has error bars. This property isn't available for 3-D charts. Read/write Boolean.
HasLeaderLines | True if the series has leader lines. Read/write Boolean.
InvertColor | Returns or sets the fill color for negative data points in a series. Read/write
InvertColorIndex | Returns or sets the fill color for negative data points in a series. Read/write
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
IsFiltered | This setting controls whether the series has been filtered out from the chart. The default value is False. Boolean Read/Write.
LeaderLines | Returns a LeaderLines object that represents the leader lines for the series. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
PlotColorIndex | Returns an index value that is used internally to associate series formatting with chart elements. Read-only
PlotOrder | Returns or sets the plot order for the selected series within the chart group. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Smooth | True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter charts. Read/write.
Type | Returns or sets a Long value that represents the series type.
Values | Returns or sets a Variant value that represents a collection of all the values in the series.
XValues | Returns or sets an array of x values for a chart series. The XValues property can be set to a range on a worksheet or to an array of values, but it cannot be a combination of both. Read/write Variant.


Series Properties (Excel)

 Copy code hover
[image]

Series Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
AxisGroup | Returns or sets the group for the specified series. Read/write
BarShape | Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.
BubbleSizes | Returns or sets a string that refers to the worksheet cells containing the x-value, y-value and size data for the bubble chart. When you return the cell reference, it will return a string describing the cells in A1-style notation. To set the size data for the bubble chart, you must use R1C1-style notation. Applies only to bubble charts. Read/write Variant.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorBars | Returns an ErrorBars object that represents the error bars for the series. Read-only.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.
Format | Returns the ChartFormat object. Read-only.
Formula | Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Has3DEffect | True if the series has a three-dimensional appearance. Read/write Boolean.
HasDataLabels | True if the series has data labels. Read/write Boolean.
HasErrorBars | True if the series has error bars. This property isn't available for 3-D charts. Read/write Boolean.
HasLeaderLines | True if the series has leader lines. Read/write Boolean.
InvertColor | Returns or sets the fill color for negative data points in a series. Read/write
InvertColorIndex | Returns or sets the fill color for negative data points in a series. Read/write
InvertIfNegative | True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.
IsFiltered | This setting controls whether the series has been filtered out from the chart. The default value is False. Boolean Read/Write.
LeaderLines | Returns a LeaderLines object that represents the leader lines for the series. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns or sets a String value representing the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
PlotColorIndex | Returns an index value that is used internally to associate series formatting with chart elements. Read-only
PlotOrder | Returns or sets the plot order for the selected series within the chart group. Read/write Long.
Shadow | Returns or sets a Boolean value that determines if the object has a shadow.
Smooth | True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter charts. Read/write.
Type | Returns or sets a Long value that represents the series type.
Values | Returns or sets a Variant value that represents a collection of all the values in the series.
XValues | Returns or sets an array of x values for a chart series. The XValues property can be set to a range on a worksheet or to an array of values, but it cannot be a combination of both. Read/write Variant.


Series.Application Property (Excel)

 Copy code hover
[image]

Series.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Series object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToEnd Property (Excel)

 Copy code hover
[image]

Series.ApplyPictToEnd Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToEnd

expression A variable that represents a Series object.

Example

This example applies pictures to the end of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToEnd = True

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToFront Property (Excel)

 Copy code hover
[image]

Series.ApplyPictToFront Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToFront

expression A variable that represents a Series object.

Example

This example applies pictures to the front of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToFront = True

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToSides Property (Excel)

 Copy code hover
[image]

Series.ApplyPictToSides Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.

Syntax

expression .ApplyPictToSides

expression A variable that represents a Series object.

Example

This example applies pictures to the sides of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
Charts(1).SeriesCollection(1).ApplyPictToSides = True

See also

Concepts

Series Object

Other resources

Series Object Members


Series.AxisGroup Property (Excel)

 Copy code hover
[image]

Series.AxisGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the group for the specified series. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AxisGroup

expression A variable that represents a Series object.

Return Value

XlAxisGroup

See also

Concepts

Series Object

Other resources

Series Object Members


Series.BarShape Property (Excel)

 Copy code hover
[image]

Series.BarShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape used with the 3-D bar or column chart. Read/write XlBarShape.

Syntax

expression .BarShape

expression A variable that represents a Series object.

Example

This example sets the shape used with series one on chart one.

VBA Copy code Copy code
Charts(1).SeriesCollection(1).BarShape = xlConeToPoint

See also

Concepts

Series Object

Other resources

Series Object Members


Series.BubbleSizes Property (Excel)

 Copy code hover
[image]

Series.BubbleSizes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that refers to the worksheet cells containing the x-value, y-value and size data for the bubble chart. When you return the cell reference, it will return a string describing the cells in A1-style notation. To set the size data for the bubble chart, you must use R1C1-style notation. Applies only to bubble charts. Read/write Variant.

Syntax

expression .BubbleSizes

expression A variable that represents a Series object.

Example

This example displays the cell reference for the cells that contain the bubble chart x-value, y-value and size data.

VBA Copy code Copy code
MsgBox Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).BubbleSizes

This example shows how to set this property using R1C1-style notation.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).BubbleSizes = "=Sheet1!r1c5:r5c5"

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ChartType Property (Excel)

 Copy code hover
[image]

Series.ChartType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart type. Read/write XlChartType.

Syntax

expression .ChartType

expression A variable that represents a Series object.

Remarks

Some chart types aren't available for PivotChart reports.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Creator Property (Excel)

 Copy code hover
[image]

Series.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Series object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ErrorBars Property (Excel)

 Copy code hover
[image]

Series.ErrorBars Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an ErrorBars object that represents the error bars for the series. Read-only.

Syntax

expression .ErrorBars

expression A variable that represents a Series object.

Example

This example sets the error bar color for series one in Chart1. The example should be run on a 2-D line chart that has error bars for series one.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1)
 .ErrorBars.Border.ColorIndex = 8
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Explosion Property (Excel)

 Copy code hover
[image]

Series.Explosion Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.

Syntax

expression .Explosion

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Format Property (Excel)

 Copy code hover
[image]

Series.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Formula Property (Excel)

 Copy code hover
[image]

Series.Formula Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.

Syntax

expression .Formula

expression A variable that represents a Series object.

Remarks

This property is not available for OLAP data sources.

If the cell contains a constant, this property returns the constant. If the cell is empty, this Formula property returns an empty string. If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Microsoft Excel changes the number format to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula for a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaLocal Property (Excel)

 Copy code hover
[image]

Series.FormulaLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Syntax

expression .FormulaLocal

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaR1C1 Property (Excel)

 Copy code hover
[image]

Series.FormulaR1C1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.

Syntax

expression .FormulaR1C1

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaR1C1Local Property (Excel)

 Copy code hover
[image]

Series.FormulaR1C1Local Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Syntax

expression .FormulaR1C1Local

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Has3DEffect Property (Excel)

 Copy code hover
[image]

Series.Has3DEffect Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the series has a three-dimensional appearance. Read/write Boolean.

Syntax

expression .Has3DEffect

expression A variable that represents a Series object.

Remarks

This property applies to bubble charts only.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasDataLabels Property (Excel)

 Copy code hover
[image]

Series.HasDataLabels Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the series has data labels. Read/write Boolean.

Syntax

expression .HasDataLabels

expression A variable that represents a Series object.

Example

This example turns on data labels for series three in Chart1.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(3)
 .HasDataLabels = True
 .ApplyDataLabels Type:=xlValue
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasErrorBars Property (Excel)

 Copy code hover
[image]

Series.HasErrorBars Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the series has error bars. This property isn't available for 3-D charts. Read/write Boolean.

Syntax

expression .HasErrorBars

expression A variable that represents a Series object.

Example

This example removes error bars from series one in Chart1. The example should be run on a 2-D line chart that has error bars for series one.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).HasErrorBars = False

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasLeaderLines Property (Excel)

 Copy code hover
[image]

Series.HasLeaderLines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the series has leader lines. Read/write Boolean.

Syntax

expression .HasLeaderLines

expression A variable that represents a Series object.

Remarks

This property applies only to pie charts.

Example

This example adds data labels and blue leader lines to series one on the pie chart. If no leader lines are visible this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertColor Property (Excel)

 Copy code hover
[image]

Series.InvertColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the fill color for negative data points in a series. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .InvertColor

expression A variable that represents a Series object.

Return Value

Integer

Remarks

The InvertColor property enables you to set the fill color for negative data points as a specific numeric, hexadecimal, octal, or RGB color value. To set the value as an RBG value, use the Visual Basic RGB function. Instead of using the InvertColor property, you can use the InvertColorIndex property, which uses a simplier set of integer values from the current color palette.

For the InvertColor property to have an effect, the InvertIfNegative property of the Series object must also be set to True.

Example

The following code example sets the fill color of negative data points in the first series of "Chart 2" to magenta.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection(1).InvertIfNegative = True
ActiveChart.SeriesCollection(1).InvertColor = RGB(255, 0, 255)

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertColorIndex Property (Excel)

 Copy code hover
[image]

Series.InvertColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the fill color for negative data points in a series. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .InvertColorIndex

expression A variable that represents a Series object.

Return Value

Integer

Remarks

The InvertColorIndex property enables you to set the fill color for negative data points as a color index value from 0 to 56. For more information about color index values, see Adding Color to Excel 2007 Worksheets by Using the ColorIndex Property. Instead of using the InvertColorIndex property, you can use the InvertColor property, which enables you to set the color as a specific numeric, hexadecimal, octal, or RGB color value.

For the InvertColorIndex property to have an effect, the InvertIfNegative property of the Series object must also be set to True.

Example

The following code example sets the fill color of negative data points in the first series of "Chart 2" to magenta.

VBA Copy code Copy code
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection(1).InvertIfNegative = True
ActiveChart.SeriesCollection(1).InvertColorIndex = 7

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertIfNegative Property (Excel)

 Copy code hover
[image]

Series.InvertIfNegative Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean.

Syntax

expression .InvertIfNegative

expression A variable that represents a Series object.

Example

This example inverts the pattern for negative values in series one in Chart1. The example should be run on a 2-D column chart.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).InvertIfNegative = True

See also

Concepts

Series Object

Other resources

Series Object Members


Series.IsFiltered Property (Excel)

 Copy code hover
[image]

Series.IsFiltered Property (Excel)
See also Send feedback

Published: July 16, 2012

This setting controls whether the series has been filtered out from the chart. The default value is False. Boolean Read/Write.

Version information

Version Added: Excel 2013

Syntax

expression .IsFiltered

expression A variable that represents a Series object.

Remarks

When a user filters out a series, the series IsFiltered property switches to True, and the series is transferred out of its parent SeriesCollection. However, that series still remains in its parent FullSeriesCollection. When a user filters the series back in, it is inserted back in its original place in the SeriesCollection.

Property value

BOOL

See also

Concepts

Series Object

Other resources

Series Object Members


Series.LeaderLines Property (Excel)

 Copy code hover
[image]

Series.LeaderLines Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LeaderLines object that represents the leader lines for the series. Read-only.

Syntax

expression .LeaderLines

expression A variable that represents a Series object.

Remarks

This property applies only to pie charts.

Example

This example adds data labels and blue leader lines to series one on the pie chart. If no leader lines are visible this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerBackgroundColor Property (Excel)

 Copy code hover
[image]

Series.MarkerBackgroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerBackgroundColorIndex Property (Excel)

 Copy code hover
[image]

Series.MarkerBackgroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerForegroundColor Property (Excel)

 Copy code hover
[image]

Series.MarkerForegroundColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColor

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerForegroundColorIndex Property (Excel)

 Copy code hover
[image]

Series.MarkerForegroundColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerSize Property (Excel)

 Copy code hover
[image]

Series.MarkerSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Can be a value from 2 through 72. Read/write Long.

Syntax

expression .MarkerSize

expression A variable that represents a Series object.

Example

This example sets the data-marker size for all data markers on series one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).MarkerSize = 10

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerStyle Property (Excel)

 Copy code hover
[image]

Series.MarkerStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Syntax

expression .MarkerStyle

expression A variable that represents a Series object.

Remarks

XlMarkerStyle can be one of these XlMarkerStyle constants.

xlMarkerStyleAutomatic. Automatic markers

xlMarkerStyleCircle. Circular markers

xlMarkerStyleDash. Long bar markers

xlMarkerStyleDiamond. Diamond-shaped markers

xlMarkerStyleDot. Short bar markers

xlMarkerStyleNone. No markers

xlMarkerStylePicture. Picture markers

xlMarkerStylePlus. Square markers with a plus sign

xlMarkerStyleSquare. Square markers

xlMarkerStyleStar. Square markers with an asterisk

xlMarkerStyleTriangle. Triangular markers

xlMarkerStyleX. Square markers with an X

Example

This example sets the marker style for series one in Chart1. The example should be run on a 2-D line chart.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1) _
 .MarkerStyle = xlMarkerStyleCircle

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Name Property (Excel)

 Copy code hover
[image]

Series.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Series object.

Remarks

You can reference using R1C1 notation, for example, "=Sheet1!R1C1".

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Parent Property (Excel)

 Copy code hover
[image]

Series.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PictureType Property (Excel)

 Copy code hover
[image]

Series.PictureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlChartPictureType value that represents the way pictures are displayed on a column or bar picture chart.

Syntax

expression .PictureType

expression A variable that represents a Series object.

Example

This example sets series one in Chart1 to stretch pictures. The example should be run on a 2-D column chart with picture data markers.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).PictureType = xlStretch

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PictureUnit2 Property (Excel)

 Copy code hover
[image]

Series.PictureUnit2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .PictureUnit2

expression A variable that represents a Series object.

Example

This example sets series one in Chart1 to stack pictures and uses each picture to represent five units. The example should be run on a 2-D column chart with picture data markers.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1)
 .PictureType = xlScale
 .PictureUnit2 = 5
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PlotColorIndex Property (Excel)

 Copy code hover
[image]

Series.PlotColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an index value that is used internally to associate series formatting with chart elements. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PlotColorIndex

expression A variable that represents a Series object.

Return Value

Integer

Remarks

This property is used internally by Excel and is not intended to be called from your code.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PlotOrder Property (Excel)

 Copy code hover
[image]

Series.PlotOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the plot order for the selected series within the chart group. Read/write Long.

Syntax

expression .PlotOrder

expression A variable that represents a Series object.

Remarks

You can set plot order only within a chart group (you cannot set the plot order for the entire chart if you have more than one chart type). A chart group is a collection of series with the same chart type.

Changing the plot order of one series will cause the plot orders of the other series in the chart group to be adjusted, as necessary.

Example

This example makes series two in Chart1 appear third in the plot order. The example should be run on a 2-D column chart that contains three or more series.

VBA Copy code Copy code
Charts("Chart1").ChartGroups(1).SeriesCollection(2).PlotOrder = 3

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Shadow Property (Excel)

 Copy code hover
[image]

Series.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if the object has a shadow.

Syntax

expression .Shadow

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Smooth Property (Excel)

 Copy code hover
[image]

Series.Smooth Property (Excel)
See also Send feedback

Published: July 16, 2012

True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter charts. Read/write.

Syntax

expression .Smooth

expression A variable that represents a Series object.

Example

This example turns on curve smoothing for series one in Chart1. The example should be run on a 2-D line chart.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Smooth = True

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Type Property (Excel)

 Copy code hover
[image]

Series.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the series type.

Syntax

expression .Type

expression A variable that represents a Series object.

Remarks

The following constants can be used for this property.

xlColumn

xlBar

xl3DBar

xlLine

xlPie

xlXYScatter

xlArea

xl3DArea

xlDoughnut

xlRadar

xl3DSurface

xl3DColumn

xl3DBar

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Values Property (Excel)

 Copy code hover
[image]

Series.Values Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents a collection of all the values in the series.

Syntax

expression .Values

expression A variable that represents a Series object.

Remarks

The value of this property can be a range on a worksheet or an array of constant values, but not a combination of both. See the examples for details.

Example

This example sets the series values from a range.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Values = _
 Worksheets("Sheet1").Range("C5:T5")

To assign a constant value to each individual data point, you must use an array.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Values = _
 Array(1, 3, 5, 7, 11, 13, 17, 19)

See also

Concepts

Series Object

Other resources

Series Object Members


Series.XValues Property (Excel)

 Copy code hover
[image]

Series.XValues Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an array of x values for a chart series. The XValues property can be set to a range on a worksheet or to an array of values, but it cannot be a combination of both. Read/write Variant.

Syntax

expression .XValues

expression A variable that represents a Series object.

Remarks

For PivotChart reports, this property is read-only.

Example

This example sets the x values for series one in Chart1 to the range B1:B5 on Sheet1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).XValues = _
 Worksheets("Sheet1").Range("B1:B5")

This example uses an array to set values for the individual points in series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).XValues = _
 Array(5.0, 6.3, 12.6, 28, 50)

See also

Concepts

Series Object

Other resources

Series Object Members


Series Methods (Excel)

 Copy code hover
[image]

Series Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyDataLabels | Applies data labels to a series.
ClearFormats | Clears the formatting of the object.
Copy | If the series has a picture fill, then this method copies the picture to the Clipboard.
DataLabels | Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).
Delete | Deletes the object.
ErrorBar | Applies error bars to the series. Variant.
Paste | Pastes a picture from the Clipboard as the marker on the selected series.
Points | Returns an object that represents a single point (a Point object) or a collection of all the points (a Points collection) in the series. Read-only
Select | Selects the object.
Trendlines | Returns an object that represents a single trendline (a Trendline object) or a collection of all the trendlines (a Trendlines collection) for the series.


Series.ApplyDataLabels Method (Excel)

 Copy code hover
[image]

Series.ApplyDataLabels Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies data labels to a series.

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | The type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default value is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | Pass a boolean value to enable or disable the series name for the data label.
ShowCategoryName | Optional | Variant | Pass a boolean value to enable or disable the category name for the data label.
ShowValue | Optional | Variant | Pass a boolean value to enable or disable the value for the data label.
ShowPercentage | Optional | Variant | Pass a boolean value to enable or disable the percentage for the data label.
ShowBubbleSize | Optional | Variant | Pass a boolean value to enable or disable the bubble size for the data label.
Separator | Optional | Variant | The separator for the data label.

Remarks

XlDataLabelsType can be one of these XlDataLabelsType constants.

xlDataLabelsShowBubbleSizes. The bubble size for the data label.

xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.

xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowLabel. Category for the point.

xlDataLabelsShowNone. No data labels.

xlDataLabelsShowValue. default. Value for the point (assumed if this argument isn't specified).

Example

This example applies category labels to series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ClearFormats Method (Excel)

 Copy code hover
[image]

Series.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Series object.

Return Value

Variant

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Copy Method (Excel)

 Copy code hover
[image]

Series.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

If the series has a picture fill, then this method copies the picture to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a Series object.

Return Value

Variant

See also

Concepts

Series Object

Other resources

Series Object Members


Series.DataLabels Method (Excel)

 Copy code hover
[image]

Series.DataLabels Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).

Syntax

expression .DataLabels(Index)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number of the data label.

Return Value

Object

Remarks

If the series has the Show Value option turned on for the data labels, the returned collection can contain up to one label for each point. Data labels can be turned on or off for individual points in the series.

If the series is on an area chart and has the Show Label option turned on for the data labels, the returned collection contains only a single label, which is the label for the area series.

Example

This example sets the data labels for series one in Chart1 to show their key, assuming that their values are visible when the example runs.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1)
 .HasDataLabels = True
 With .DataLabels
 .ShowLegendKey = True
 .Type = xlValue
 End With
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Delete Method (Excel)

 Copy code hover
[image]

Series.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Series object.

Return Value

Variant

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ErrorBar Method (Excel)

 Copy code hover
[image]

Series.ErrorBar Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies error bars to the series. Variant.

Syntax

expression .ErrorBar(Direction, Include, Type, Amount, MinusValues)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | XlErrorBarDirection | The error bar direction.
Include | Required | XlErrorBarInclude | The error bar parts to include.
Type | Required | XlErrorBarType | The error bar type.
Amount | Optional | Variant | The error amount. Used for only the positive error amount when Type is xlErrorBarTypeCustom.
MinusValues | Optional | Variant | The negative error amount when Type is xlErrorBarTypeCustom.

Return Value

Variant

Example

This example applies standard error bars in the Y direction for series one in Chart1. The error bars are applied in the positive and negative directions. The example should be run on a 2-D line chart.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).ErrorBar _
 Direction:=xlY, Include:=xlErrorBarIncludeBoth, _
 Type:=xlErrorBarTypeStError

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Paste Method (Excel)

 Copy code hover
[image]

Series.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard as the marker on the selected series.

Syntax

expression .Paste

expression A variable that represents a Series object.

Return Value

Variant

Remarks

This method can be used on column, bar, line, or radar charts, and it sets the MarkerStyle property to xlMarkerStylePicture.

Example

This example pastes a picture from the Clipboard into series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Paste

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Points Method (Excel)

 Copy code hover
[image]

Series.Points Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents a single point (a Point object) or a collection of all the points (a Points collection) in the series. Read-only

Syntax

expression .Points(Index)

expression An expression that returns a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the point.

Return Value

Object

Example

This example applies a data label to point one in series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Points(1).ApplyDataLabels

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Select Method (Excel)

 Copy code hover
[image]

Series.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Series object.

Return Value

Variant

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Trendlines Method (Excel)

 Copy code hover
[image]

Series.Trendlines Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents a single trendline (a Trendline object) or a collection of all the trendlines (a Trendlines collection) for the series.

Syntax

expression .Trendlines(Index)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the trendline.

Return Value

Object

Example

This example adds a linear trendline to series one in Chart1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Trendlines.Add Type:=xlLinear

See also

Concepts

Series Object

Other resources

Series Object Members


SeriesCollection Object (Excel)

 Copy code hover
[image]

SeriesCollection Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Series objects in the specified chart or chart group.

Remarks

Use the SeriesCollection method to return the SeriesCollection collection.

Example

The following example adds the data in cells C1:C10 on worksheet one to an existing series in the series collection in embedded chart one.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection.Extend Worksheets(1).Range("c1:c10")

Use the Add method to create a new series and add it to the chart. The following example adds the data from cells A1:A19 as a new series on the chart sheet named "Chart1."

VBA Copy code Copy code
Charts("chart1").SeriesCollection.Add _
 source:=Worksheets("sheet1").Range("a1:a19")

Use SeriesCollection(index), where index is the series index number or name, to return a single Series object. The following example sets the color of the interior for the first series in embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart. _
 SeriesCollection(1).Interior.Color = RGB(255, 0, 0)

See also

Concepts

Excel Object Model Reference

Other resources

SeriesCollection Object Members


SeriesCollection Members (Excel)

 Copy code hover
[image]

SeriesCollection Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Series objects in the specified chart or chart group.

Methods

Name | Description
Add | Adds one or more new series to the SeriesCollection collection.
Extend | Adds new data points to an existing series collection.
Item | Returns a single object from a collection.
NewSeries | Creates a new series. Returns a Series object that represents the new series.
Paste | Pastes data from the Clipboard into the specified series collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


SeriesCollection Properties (Excel)

 Copy code hover
[image]

SeriesCollection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


SeriesCollection.Application Property (Excel)

 Copy code hover
[image]

SeriesCollection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a SeriesCollection object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Count Property (Excel)

 Copy code hover
[image]

SeriesCollection.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a SeriesCollection object.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Creator Property (Excel)

 Copy code hover
[image]

SeriesCollection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SeriesCollection object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Parent Property (Excel)

 Copy code hover
[image]

SeriesCollection.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a SeriesCollection object.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection Methods (Excel)

 Copy code hover
[image]

SeriesCollection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds one or more new series to the SeriesCollection collection.
Extend | Adds new data points to an existing series collection.
Item | Returns a single object from a collection.
NewSeries | Creates a new series. Returns a Series object that represents the new series.
Paste | Pastes data from the Clipboard into the specified series collection.


SeriesCollection.Add Method (Excel)

 Copy code hover
[image]

SeriesCollection.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds one or more new series to the SeriesCollection collection.

Syntax

expression .Add(Source, Rowcol, SeriesLabels, CategoryLabels, Replace)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The new data as a Range object.
Rowcol | Optional | XlRowCol | . Specifies whether the new values are in the rows or columns of the specified range.
SeriesLabels | Optional | Variant | True if the first row or column contains the name of the data series. False if the first row or column contains the first data point of the series. If this argument is omitted, Microsoft Excel attempts to determine the location of the series name from the contents of the first row or column.
CategoryLabels | Optional | Variant | True if the first row or column contains the name of the category labels. False if the first row or column contains the first data point of the series. If this argument is omitted, Microsoft Excel attempts to determine the location of the category label from the contents of the first row or column.
Replace | Optional | Variant | If CategoryLabels is True and Replace is True, the specified categories replace the categories that currently exist for the series. If Replace is False, the existing categories will not be replaced. The default value is False.

Return Value

A Series object that represents the new series.

Remarks

This method does not actually return a Series object as stated in the Object Browser. This method is not available for PivotChart reports.

Example

This example creates a new series in Chart1. The data source for the new series is range B1:B10 on Sheet1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection.Add _
 Source:=ActiveWorkbook.Worksheets("Sheet1").Range("B1:B10")

This example creates a new series on the embedded chart on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Activate
ActiveChart.SeriesCollection.Add _
 Source:=Worksheets("Sheet1").Range("B1:B10")

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Extend Method (Excel)

 Copy code hover
[image]

SeriesCollection.Extend Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds new data points to an existing series collection.

Syntax

expression .Extend(Source, Rowcol, CategoryLabels)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The new data to be added to the SeriesCollection object as a Range object.
Rowcol | Optional | Variant | Specifies whether the new values are in the rows or columns of the given range source. Can be one of the following XlRowCol constants: xlRows or xlColumns. If this argument is omitted, Microsoft Excel attempts to determine where the values are by the size and orientation of the selected range or by the dimensions of the array.
CategoryLabels | Optional | Variant | True to have the first row or column contain the name of the category labels. False to have the first row or column contain the first data point of the series. If this argument is omitted, Microsoft Excel attempts to determine the location of the category label from the contents of the first row or column.

Return Value

Variant

Remarks

This method is not available for PivotChart reports.

Example

This example extends the series on Chart1 by adding the data in cells B1:B6 on Sheet1.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection.Extend _
        Source:=Worksheets("Sheet1").Range("B1:B6")

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Item Method (Excel)

 Copy code hover
[image]

SeriesCollection.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Series object contained by the collection.

Example

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection.Item(1).Trendlines.Item(1)
 .Forward = 5
 .Backward = .5
End With

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.NewSeries Method (Excel)

 Copy code hover
[image]

SeriesCollection.NewSeries Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new series. Returns a Series object that represents the new series.

Syntax

expression .NewSeries

expression A variable that represents a SeriesCollection object.

Return Value

Series

Remarks

This method isn't available for PivotChart reports.

Example

This example adds a new series to chart one.

VBA Copy code Copy code
Set ns = Charts(1).SeriesCollection.NewSeries

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Paste Method (Excel)

 Copy code hover
[image]

SeriesCollection.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes data from the Clipboard into the specified series collection.

Syntax

expression .Paste(Rowcol, SeriesLabels, CategoryLabels, Replace, NewSeries)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Rowcol | Optional | XlRowCol | . Specifies whether the values corresponding to a particular data series are in rows or columns.
SeriesLabels | Optional | Variant | True to use the contents of the cell in the first column of each row (or the first row of each column) as the name of the data series in that row (or column). False to use the contents of the cell in the first column of each row (or the first row of each column) as the first data point in the data series. The default value is False.
CategoryLabels | Optional | Variant | True to use the contents of the first row (or column) of the selection as the categories for the chart. False to use the contents of the first row (or column) as the first data series in the chart. The default value is False.
Replace | Optional | Variant | True to apply categories while replacing existing categories with information from the copied range. False to insert new categories without replacing any old ones. The default value is True.
NewSeries | Optional | Variant | True to paste the data as a new series. False to paste the data as new points in an existing series. The default value is True.

Return Value

Variant

Example

This example pastes data from the Clipboard into a new series in Chart1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("C1:C5").Copy
Charts("Chart1").SeriesCollection.Paste

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesLines Object (Excel)

 Copy code hover
[image]

SeriesLines Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents series lines in a chart group.

Remarks

Series lines connect the data values from each series. Only 2-D stacked bar, 2-D stacked column, pie of pie, or bar of pie charts can have series lines. This object isn't a collection. There's no object that represents a single series line; you either have series lines turned on for all points in a chart group or you have them turned off.

If the HasSeriesLines property is False, most properties of the SeriesLines object are disabled.

Example

Use the SeriesLines property to return a SeriesLines object. The following example adds series lines to chart group one in embedded chart one on worksheet one (the chart must be a 2-D stacked bar or column chart).

VBA Copy code Copy code
With Worksheets(1).ChartObjects(1).Chart.ChartGroups(1)
 .HasSeriesLines = True
 .SeriesLines.Border.Color = RGB(0, 0, 255)
End With

See also

Concepts

Excel Object Model Reference

Other resources

SeriesLines Object Members


SeriesLines Members (Excel)

 Copy code hover
[image]

SeriesLines Members (Excel)
Send feedback

Published: July 16, 2012

Represents series lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


SeriesLines Properties (Excel)

 Copy code hover
[image]

SeriesLines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


SeriesLines.Application Property (Excel)

 Copy code hover
[image]

SeriesLines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a SeriesLines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Border Property (Excel)

 Copy code hover
[image]

SeriesLines.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Creator Property (Excel)

 Copy code hover
[image]

SeriesLines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SeriesLines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Format Property (Excel)

 Copy code hover
[image]

SeriesLines.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Name Property (Excel)

 Copy code hover
[image]

SeriesLines.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Parent Property (Excel)

 Copy code hover
[image]

SeriesLines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines Methods (Excel)

 Copy code hover
[image]

SeriesLines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


SeriesLines.Delete Method (Excel)

 Copy code hover
[image]

SeriesLines.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a SeriesLines object.

Return Value

Variant

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Select Method (Excel)

 Copy code hover
[image]

SeriesLines.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a SeriesLines object.

Return Value

Variant

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


ServerViewableItems Object (Excel)

 Copy code hover
[image]

ServerViewableItems Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of objects that have been marked as viewable on the server.

Version Information

Version Added: Excel 2007

Remarks

This is a collection of references to objects in the workbook. Only objects in this collection will be shown on the server. By default, the entire workbook (including all worksheets) is shown.

Only one ServerViewableItems object can exist per workbook. This collection is not indexable by name because there is no guarantee that the names of objects that are marked as viewable on the server are unique.

In the Excel user interface, you can view the collection of objects that are marked as viewable on the server in the Excel Services Options dialog box.

See also

Concepts

Excel Object Model Reference

Other resources

ServerViewableItems Object Members


ServerViewableItems Members (Excel)

 Copy code hover
[image]

ServerViewableItems Members (Excel)
Send feedback

Published: July 16, 2012

A collection of objects that have been marked as viewable on the server.

Methods

Name | Description
Add | Adds a reference to the ServerViewableItems collection.
Delete | Deletes a reference to an object in the ServerViewableItems collection in the workbook.
DeleteAll | Deletes references to all the objects in the ServerViewableItems collection in the workbook.
Item | Returns a single object from the ServerViewableItems collection.

Properties

Name | Description
Application | Returns an Application object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ServerViewableItems Properties (Excel)

 Copy code hover
[image]

ServerViewableItems Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ServerViewableItems.Application Property (Excel)

 Copy code hover
[image]

ServerViewableItems.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a ServerViewableItems object.

Remarks

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.Count Property (Excel)

 Copy code hover
[image]

ServerViewableItems.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a ServerViewableItems object.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.Creator Property (Excel)

 Copy code hover
[image]

ServerViewableItems.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ServerViewableItems object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.Parent Property (Excel)

 Copy code hover
[image]

ServerViewableItems.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a ServerViewableItems object.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems Methods (Excel)

 Copy code hover
[image]

ServerViewableItems Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a reference to the ServerViewableItems collection.
Delete | Deletes a reference to an object in the ServerViewableItems collection in the workbook.
DeleteAll | Deletes references to all the objects in the ServerViewableItems collection in the workbook.
Item | Returns a single object from the ServerViewableItems collection.


ServerViewableItems.Add Method (Excel)

 Copy code hover
[image]

ServerViewableItems.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a reference to the ServerViewableItems collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Add(Obj)

expression A variable that represents a ServerViewableItems object.

Parameters

Name | Required/Optional | Data Type | Description
Obj | Required | Variant | The reference to an object. The object can be a reference to sheets or named items (for example, named ranges, charts, tables, and PivotTables). You cannot have both sheets and named items in the same collection.

Return Value

Object

Remarks

If you try to add a mix of both sheets and named items to the ServerViewableItems collection, an error is returned. The ServerViewableItems collection can contain references only to sheets, or references only to named items, but not both in the same call.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.Delete Method (Excel)

 Copy code hover
[image]

ServerViewableItems.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes a reference to an object in the ServerViewableItems collection in the workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete(Index)

expression A variable that represents a ServerViewableItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index of the object you want to delete.

Remarks

If you do not want a particular object to be viewable in Excel Services, use this method to remove that object.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.DeleteAll Method (Excel)

 Copy code hover
[image]

ServerViewableItems.DeleteAll Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes references to all the objects in the ServerViewableItems collection in the workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .DeleteAll

expression A variable that represents a ServerViewableItems object.

Remarks

If you do not want any of the objects in the ServerViewableItems collection to be viewable on the server, use this method to remove them all at once.

Note Note

If the ServerViewableItems collection does not contain at least one object, you will see the message "Unable to Display Specified Named Range or Item" when viewing the workbook in Excel Services.

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ServerViewableItems.Item Method (Excel)

 Copy code hover
[image]

ServerViewableItems.Item Method (Excel)
See also Send feedback

Returns a single object from the ServerViewableItems collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a ServerViewableItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index of the object to be returned.

Return Value

Object

See also

Concepts

ServerViewableItems Object

Other resources

ServerViewableItems Object Members


ShadowFormat Object (Excel)

 Copy code hover
[image]

ShadowFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents shadow formatting for a shape.

Remarks

Use the Shadow property to return a ShadowFormat object.

Example

The following example adds a shadowed rectangle to myDocument. The semitransparent, blue shadow is offset 5 points to the right of the rectangle and 3 points above it.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 50, 50, 100, 200).Shadow
 .ForeColor.RGB = RGB(0, 0, 128)
 .OffsetX = 5
 .OffsetY = -3
 .Transparency = 0.5
 .Visible = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

ShadowFormat Object Members


ShadowFormat Members (Excel)

 Copy code hover
[image]

ShadowFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents shadow formatting for a shape.

Methods

Name | Description
IncrementOffsetX | Changes the horizontal offset of the shadow by the specified number of points. Use the OffsetX property to set the absolute horizontal shadow offset.
IncrementOffsetY | Changes the vertical offset of the shadow by the specified number of points. Use the OffsetY property to set the absolute vertical shadow offset.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Blur | Returns or sets the degree of blurriness of the specified shadow. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
Obscured | True if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. False if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.
OffsetX | Returns or sets the horizontal offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
OffsetY | Returns or sets the vertical offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
RotateWithShape | Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets the size of the specified shadow. Read/write Single.
Style | Returns or sets the style of the specified shadow. Read/write MsoShadowStyle.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Type | Returns or sets a MsoShadowType value that represents the shadow format type.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.


ShadowFormat Properties (Excel)

 Copy code hover
[image]

ShadowFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Blur | Returns or sets the degree of blurriness of the specified shadow. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.
Obscured | True if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. False if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.
OffsetX | Returns or sets the horizontal offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
OffsetY | Returns or sets the vertical offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
RotateWithShape | Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets the size of the specified shadow. Read/write Single.
Style | Returns or sets the style of the specified shadow. Read/write MsoShadowStyle.
Transparency | Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.
Type | Returns or sets a MsoShadowType value that represents the shadow format type.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.


ShadowFormat.Application Property (Excel)

 Copy code hover
[image]

ShadowFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ShadowFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Blur Property (Excel)

 Copy code hover
[image]

ShadowFormat.Blur Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of blurriness of the specified shadow. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .Blur

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Creator Property (Excel)

 Copy code hover
[image]

ShadowFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ShadowFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.ForeColor Property (Excel)

 Copy code hover
[image]

ShadowFormat.ForeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the specified foreground fill or solid color.

Syntax

expression .ForeColor

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Obscured Property (Excel)

 Copy code hover
[image]

ShadowFormat.Obscured Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. False if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.

Syntax

expression .Obscured

expression A variable that represents a ShadowFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse The shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill.

msoTriStateMixed

msoTriStateToggle

msoTrue The shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it. The shadow will be filled in and obscured by the shape, even if the shape has no fill.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
 .Obscured = msoTrue
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.OffsetX Property (Excel)

 Copy code hover
[image]

ShadowFormat.OffsetX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.

Syntax

expression .OffsetX

expression A variable that represents a ShadowFormat object.

Remarks

If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX method or the IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.OffsetY Property (Excel)

 Copy code hover
[image]

ShadowFormat.OffsetY Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical offset of the shadow from the specified shape, in points. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.

Syntax

expression .OffsetY

expression A variable that represents a ShadowFormat object.

Remarks

If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX method or the IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Parent Property (Excel)

 Copy code hover
[image]

ShadowFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.RotateWithShape Property (Excel)

 Copy code hover
[image]

ShadowFormat.RotateWithShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .RotateWithShape

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Size Property (Excel)

 Copy code hover
[image]

ShadowFormat.Size Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the specified shadow. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .Size

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Style Property (Excel)

 Copy code hover
[image]

ShadowFormat.Style Property (Excel)
See also Send feedback

Returns or sets the style of the specified shadow. Read/write MsoShadowStyle.

Version Information

Version Added: Excel 2007

Syntax

expression .Style

expression A variable that represents a ShadowFormat object.

Remarks

MsoShadowStyle can be one of these MsoShadowStyle constants.

msoShadowStyleInnerShadow

msoShadowStyleMixed

msoShadowStyleOuterShadow

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Transparency Property (Excel)

 Copy code hover
[image]

ShadowFormat.Transparency Property (Excel)
See also Send feedback

Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). Read/write Double.

Syntax

expression .Transparency

expression A variable that represents a ShadowFormat object.

Remarks

The value of this property affects the appearance of solid-colored fills and lines only; it has no effect on the appearance of patterned lines or patterned, gradient, picture, or textured fills.

Example

This example sets the shadow of shape three on worksheet one to semitransparent red. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
With Worksheets(1).Shapes(3).Shadow
 .Visible = True
 .ForeColor.RGB = RGB(255, 0, 0)
 .Transparency = 0.5
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Type Property (Excel)

 Copy code hover
[image]

ShadowFormat.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoShadowType value that represents the shadow format type.

Syntax

expression .Type

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Visible Property (Excel)

 Copy code hover
[image]

ShadowFormat.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat Methods (Excel)

 Copy code hover
[image]

ShadowFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementOffsetX | Changes the horizontal offset of the shadow by the specified number of points. Use the OffsetX property to set the absolute horizontal shadow offset.
IncrementOffsetY | Changes the vertical offset of the shadow by the specified number of points. Use the OffsetY property to set the absolute vertical shadow offset.


ShadowFormat.IncrementOffsetX Method (Excel)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetX Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the horizontal offset of the shadow by the specified number of points. Use the OffsetX property to set the absolute horizontal shadow offset.

Syntax

expression .IncrementOffsetX(Increment)

expression A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shadow offset is to be moved horizontally, in points. A positive value moves the shadow to the right; a negative value moves it to the left.

Example

This example moves the shadow on shape three on myDocument to the left by 3 points.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).Shadow.IncrementOffsetX -3

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.IncrementOffsetY Method (Excel)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetY Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the vertical offset of the shadow by the specified number of points. Use the OffsetY property to set the absolute vertical shadow offset.

Syntax

expression .IncrementOffsetY(Increment)

expression A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shadow offset is to be moved vertically, in points. A positive value moves the shadow down; a negative value moves it up.

Example

This example moves the shadow on shape three on myDocument up by 3 points.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).Shadow.IncrementOffsetY -3

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


Shape Object (Excel)

 Copy code hover
[image]

Shape Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Remarks

The Shape object is a member of the Shapes collection. The Shapes collection contains all the shapes in a workbook.

Note Note

There are three objects that represent shapes: the Shapes collection, which represents all the shapes on a workbook; the ShapeRange collection, which represents a specified subset of the shapes on a workbook (for example, a ShapeRange object could represent shapes one and four in the workbook, or it could represent all the selected shapes in the workbook); and the Shape object, which represents a single shape on a worksheet. If you want to work with several shapes at the same time or with shapes within the selection, use a ShapeRange collection.

Using the Shape Object

The following sections describes how to:

  • Return the shapes attached to the ends of a connector.

  • Return a newly created freeform.

  • Return a single shape from within a group.

  • Return a newly formed group of shapes.

  • Return an existing shape.

  • Return a shape within the selection.

Returning the Shapes Attached to the Ends of a Connector

To return a Shape object that represents one of the shapes attached by a connector, use the BeginConnectedShape or EndConnectedShape property.

Returning a newly created freeform

Use the BuildFreeform and AddNodes methods to define the geometry of a new freeform, and use the ConvertToShape method to create the freeform and return the Shape object that represents it.

Returning a Single Shape from Within a Group

Use GroupItems(index), where index is the shape name or the index number within the group, to return a Shape object that represents a single shape in a grouped shape.

Returning a Newly Formed Group of Shapes

Use the Group or Regroup method to group a range of shapes and return a single Shape object that represents the newly formed group. After a group has been formed, you can work with the group the same way you work with any other shape.

Returning an Existing Shape

Use Shapes(index), where index is the shape name or the index number, to return a Shape object that represents a shape.

Returning a Shape Within the Selection

Use Selection.ShapeRange(index), where index is the shape name or the index number, to return a Shape object that represents a shape within the selection.

Example

The following example horizontally flips shape one and the shape named Rectangle 1 on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Flip msoFlipHorizontal
myDocument.Shapes("Rectangle 1").Flip msoFlipHorizontal

Each shape is assigned a default name when you add it to the Shapes collection. To give the shape a more meaningful name, use the Name property. The following example adds a rectangle to myDocument, gives it the name Red Square, and then sets its foreground color and line style.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 144, 144, 72, 72)
 .Name = "Red Square"
 .Fill.ForeColor.RGB = RGB(255, 0, 0)
 .Line.DashStyle = msoLineDashDot
End With

The following example sets the fill for the first shape in the selection in the active window, assuming that there's at least one shape in the selection.

VBA Copy code Copy code
ActiveWindow.Selection.ShapeRange(1).Fill.ForeColor.RGB = _
 RGB(255, 0, 0)

See also

Concepts

Excel Object Model Reference

Other resources

Shape Object Members


Shape Members (Excel)

 Copy code hover
[image]

Shape Members (Excel)
Send feedback

Published: July 16, 2012

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Methods

Name | Description
Apply | Applies to the specified shape formatting that's been copied by using the PickUp method.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Flip | Flips the specified shape around its horizontal or vertical axis.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.
IncrementTop | Moves the specified shape vertically by the specified number of points.
PickUp | Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.
RerouteConnections | This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.
Select | Selects the object.
SetShapesDefaultProperties | Makes the formatting of the specified shape the default formatting for the shape.
Ungroup | Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any Shape object that represents an AutoShape, WordArt, or a connector.
AlternativeText | Returns or sets the descriptive (alternative) text string for a Shape object when the object is saved to a Web page. Read/write String.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.
BackgroundStyle | Returns or sets the background style. Read/write MsoBackgroundStyleIndex.
BlackWhiteMode | Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a Shape object that represent line callouts. Read-only.
Chart | Returns a Chart object that represents the chart contained in the shape. Read-only.
Child | Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
ConnectionSiteCount | Returns the number of connection sites on the specified shape. Read-only Long.
Connector | True if the specified shape is a connector. Read-only MsoTriState.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to a Shape that represent connectors. Read-only.
ControlFormat | Returns a ControlFormat object that contains Microsoft Excel control properties. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.
FormControlType | Returns the Microsoft Excel control type. Read-only XlFormControl.
Glow | Returns a GlowFormat object for a specified shape that contains glow formatting properties for the shape. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to Shape objects that represent grouped shapes. Read-only.
HasChart | Returns whether a shape contains a chart. Read-only MsoTriState.
HasSmartArt | Returns whether there is a SmartArt diagram present on the specified shape. Read-only
Height | Returns or sets a Single value that represents the height, in points, of the object.
HorizontalFlip | True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink for the shape.
ID | Returns a Long value that represents the type for the specified object.
Left | Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.
LinkFormat | Returns a LinkFormat object that contains linked OLE object properties. Read-only.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
OLEFormat | Returns an OLEFormat object that contains OLE object properties. Read-only.
OnAction | Returns or sets the name of a macro that's run when the specified object is clicked. Read/write String.
Parent | Returns the parent object for the specified object. Read-only.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a Shape object that represent pictures or OLE objects. Read-only.
Placement | Returns or sets an XlPlacement value that represents the way the object is attached to the cells below it.
Reflection | Returns a ReflectionFormat object for a specified shape that contains reflection formatting properties for the shape. Read-only.
Rotation | Returns or sets the rotation of the shape, in degrees. Read/write Single.
Shadow | Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.
ShapeStyle | Returns or sets an MsoShapeStyleIndex that represents the shape style of shape range. Read/write.
SmartArt | Returns an object that represents the SmartArt associated with the shape. Read-only
SoftEdge | Returns a SoftEdgeFormat object for a specified shape that contains soft edge formatting properties for the shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified shape. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.
Title | Returns or sets the title of the alternative text associated with the specified shape. Read/write
Top | Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Type | Returns or sets a MsoShapeType value that represents the shape type.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Width | Returns or sets a Single value that represents the width, in points, of the object.
ZOrderPosition | Returns the position of the specified shape in the z-order. Read-only Long.Read-only


Shape Properties (Excel)

 Copy code hover
[image]

Shape Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any Shape object that represents an AutoShape, WordArt, or a connector.
AlternativeText | Returns or sets the descriptive (alternative) text string for a Shape object when the object is saved to a Web page. Read/write String.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.
BackgroundStyle | Returns or sets the background style. Read/write MsoBackgroundStyleIndex.
BlackWhiteMode | Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.
BottomRightCell | Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a Shape object that represent line callouts. Read-only.
Chart | Returns a Chart object that represents the chart contained in the shape. Read-only.
Child | Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
ConnectionSiteCount | Returns the number of connection sites on the specified shape. Read-only Long.
Connector | True if the specified shape is a connector. Read-only MsoTriState.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to a Shape that represent connectors. Read-only.
ControlFormat | Returns a ControlFormat object that contains Microsoft Excel control properties. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.
FormControlType | Returns the Microsoft Excel control type. Read-only XlFormControl.
Glow | Returns a GlowFormat object for a specified shape that contains glow formatting properties for the shape. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to Shape objects that represent grouped shapes. Read-only.
HasChart | Returns whether a shape contains a chart. Read-only MsoTriState.
HasSmartArt | Returns whether there is a SmartArt diagram present on the specified shape. Read-only
Height | Returns or sets a Single value that represents the height, in points, of the object.
HorizontalFlip | True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink for the shape.
ID | Returns a Long value that represents the type for the specified object.
Left | Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.
LinkFormat | Returns a LinkFormat object that contains linked OLE object properties. Read-only.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
Name | Returns or sets a String value representing the name of the object.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
OLEFormat | Returns an OLEFormat object that contains OLE object properties. Read-only.
OnAction | Returns or sets the name of a macro that's run when the specified object is clicked. Read/write String.
Parent | Returns the parent object for the specified object. Read-only.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a Shape object that represent pictures or OLE objects. Read-only.
Placement | Returns or sets an XlPlacement value that represents the way the object is attached to the cells below it.
Reflection | Returns a ReflectionFormat object for a specified shape that contains reflection formatting properties for the shape. Read-only.
Rotation | Returns or sets the rotation of the shape, in degrees. Read/write Single.
Shadow | Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.
ShapeStyle | Returns or sets an MsoShapeStyleIndex that represents the shape style of shape range. Read/write.
SmartArt | Returns an object that represents the SmartArt associated with the shape. Read-only
SoftEdge | Returns a SoftEdgeFormat object for a specified shape that contains soft edge formatting properties for the shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified shape. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.
Title | Returns or sets the title of the alternative text associated with the specified shape. Read/write
Top | Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.
TopLeftCell | Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.
Type | Returns or sets a MsoShapeType value that represents the shape type.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Width | Returns or sets a Single value that represents the width, in points, of the object.
ZOrderPosition | Returns the position of the specified shape in the z-order. Read-only Long.Read-only


Shape.Adjustments Property (Excel)

 Copy code hover
[image]

Shape.Adjustments Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any Shape object that represents an AutoShape, WordArt, or a connector.

Syntax

expression .Adjustments

expression A variable that represents a Shape object.

Example

This example sets to 0.25 the value of adjustment one on shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Adjustments(1) = 0.25

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.AlternativeText Property (Excel)

 Copy code hover
[image]

Shape.AlternativeText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the descriptive (alternative) text string for a Shape object when the object is saved to a Web page. Read/write String.

Syntax

expression .AlternativeText

expression A variable that represents a Shape object.

Remarks

The alternative text can be displayed either in place of the shape's image in the Web browser , or directly over the image when the mouse pointer hovers over the image (in browsers that support these features).

Example

This example sets the alternative text for the first shape on the first worksheet to a description of the shape.

VBA Copy code Copy code
Worksheets(1).Shapes(1).AlternativeText = "Concentric circles"

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Application Property (Excel)

 Copy code hover
[image]

Shape.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Shape object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.AutoShapeType Property (Excel)

 Copy code hover
[image]

Shape.AutoShapeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.

Syntax

expression .AutoShapeType

expression A variable that represents a Shape object.

Remarks

When you change the type of a shape, the shape retains its size, color, and other attributes.

Use the Type property of the ConnectorFormat object to set or return the connector type.

Example

This example replaces all 16-point stars with 32-point stars in myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.AutoShapeType = msoShape16pointStar Then
        s.AutoShapeType = msoShape32pointStar
    End If
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.BackgroundStyle Property (Excel)

 Copy code hover
[image]

Shape.BackgroundStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the background style. Read/write MsoBackgroundStyleIndex.

Version Information

Version Added: Excel 2007

Syntax

expression .BackgroundStyle

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.BlackWhiteMode Property (Excel)

 Copy code hover
[image]

Shape.BlackWhiteMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.

Syntax

expression .BlackWhiteMode

expression A variable that represents a Shape object.

Example

This example sets shape one on wksOne to appear in black-and-white mode. When you view the presentation in black-and-white mode, shape one will appear black regardless of what color it is in color mode.

VBA Copy code Copy code
Sub UseBlackWhiteMode()

    Dim wksOne As Worksheet
    Set wksOne = Application.Worksheets(1)
    wksOne.Shapes(1).BlackWhiteMode = msoBlackWhiteGrayOutline

End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.BottomRightCell Property (Excel)

 Copy code hover
[image]

Shape.BottomRightCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the lower-right corner of the object. Read-only.

Syntax

expression .BottomRightCell

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Callout Property (Excel)

 Copy code hover
[image]

Shape.Callout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a Shape object that represent line callouts. Read-only.

Syntax

expression .Callout

expression A variable that represents a Shape object.

Example

This example adds to myDocument an oval and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
 .TextFrame.Characters.Text = "My oval"
 With .Callout
 .Accent = True
 .Border = False
 End With
 End With
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Chart Property (Excel)

 Copy code hover
[image]

Shape.Chart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the chart contained in the shape. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Chart

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Child Property (Excel)

 Copy code hover
[image]

Shape.Child Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.

Syntax

expression .Child

expression A variable that represents a Shape object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. If the selected shape is not a child shape.

msoTriStateMixed. If only some of the selected shapes are child shapes.

msoTriStateToggle. Does not apply to this property.

msoTrue. If the selected shape is a child shape.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ConnectionSiteCount Property (Excel)

 Copy code hover
[image]

Shape.ConnectionSiteCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of connection sites on the specified shape. Read-only Long.

Syntax

expression .ConnectionSiteCount

expression An expression that returns a Shape object.

Example

This example adds two rectangles to myDocument and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, _
 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, _
 300, 300, 200, 100)
lastsite = secondRect.ConnectionSiteCount
With s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100).ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, _
 ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, _
 ConnectionSite:=1
End With
With s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100).ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, _
 ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, _
 ConnectionSite:=lastsite
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Connector Property (Excel)

 Copy code hover
[image]

Shape.Connector Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape is a connector. Read-only MsoTriState.

Syntax

expression .Connector

expression An expression that returns a Shape object.

Example

This example deletes all connectors on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
    For i = .Count To 1 Step -1
        With .Item(i)
            If .Connector Then .Delete
        End With
    Next
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ConnectorFormat Property (Excel)

 Copy code hover
[image]

Shape.ConnectorFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ConnectorFormat object that contains connector formatting properties. Applies to a Shape that represent connectors. Read-only.

Syntax

expression .ConnectorFormat

expression An expression that returns a Shape object.

Example

This example adds two rectangles to myDocument, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Set c = s.AddConnector(msoConnectorCurve, 0, 0, 0, 0)
with c.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
 c.RerouteConnections
 .BeginDisconnect
 .EndDisconnect
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ControlFormat Property (Excel)

 Copy code hover
[image]

Shape.ControlFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ControlFormat object that contains Microsoft Excel control properties. Read-only.

Syntax

expression .ControlFormat

expression A variable that represents a Shape object.

Example

This example removes the selected item from a list box. If Shapes(2) doesn't represent a list box, this example fails.

VBA Copy code Copy code
Set lbcf = Worksheets(1).Shapes(2).ControlFormat
lbcf.RemoveItem lbcf.ListIndex

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Creator Property (Excel)

 Copy code hover
[image]

Shape.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Shape object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Fill Property (Excel)

 Copy code hover
[image]

Shape.Fill Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.

Syntax

expression .Fill

expression A variable that represents a Shape object.

Example

This example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
        90, 90, 90, 50).Fill
    .ForeColor.RGB = RGB(128, 0, 0)
    .BackColor.RGB = RGB(170, 170, 170)
    .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.FormControlType Property (Excel)

 Copy code hover
[image]

Shape.FormControlType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Microsoft Excel control type. Read-only XlFormControl.

Syntax

expression .FormControlType

expression A variable that represents a Shape object.

Remarks

You cannot use this property with ActiveX controls (the Type property for the Shape object must return msoFormControl).

Example

This example clears all the Microsoft Excel check boxes on worksheet one.

VBA Copy code Copy code
For Each s In Worksheets(1).Shapes
 If s.Type = msoFormControl Then
 If s.FormControlType = xlCheckBox Then _
 s.ControlFormat.Value = False
 End If
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Glow Property (Excel)

 Copy code hover
[image]

Shape.Glow Property (Excel)
See also Send feedback

Returns a GlowFormat object for a specified shape that contains glow formatting properties for the shape. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Glow

expression A variable that represents a Shape object.

Remarks

The glow effect adds a vibrant colored edge to graphics.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.GroupItems Property (Excel)

 Copy code hover
[image]

Shape.GroupItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to Shape objects that represent grouped shapes. Read-only.

Syntax

expression .GroupItems

expression A variable that represents a Shape object.

Example

This example adds three triangles to myDocument, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 10, 10, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 150, 10, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 300, 10, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HasChart Property (Excel)

 Copy code hover
[image]

Shape.HasChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether a shape contains a chart. Read-only MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .HasChart

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HasSmartArt Property (Excel)

 Copy code hover
[image]

Shape.HasSmartArt Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether there is a SmartArt diagram present on the specified shape. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .HasSmartArt

expression A variable that represents a Shape object.

Return Value

MsoTriState

Remarks

msoTrue (-1) if there is a SmartArt diagram present on the shape; otherwise msoFalse (0).

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Height Property (Excel)

 Copy code hover
[image]

Shape.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HorizontalFlip Property (Excel)

 Copy code hover
[image]

Shape.HorizontalFlip Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.

Syntax

expression .HorizontalFlip

expression A variable that represents a Shape object.

Example

This example restores each shape on myDocument to its original state if it's been flipped horizontally or vertically.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.HorizontalFlip Then s.Flip msoFlipHorizontal
    If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Hyperlink Property (Excel)

 Copy code hover
[image]

Shape.Hyperlink Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlink object that represents the hyperlink for the shape.

Syntax

expression .Hyperlink

expression A variable that represents a Shape object.

Example

This example loads the document attached to the hyperlink on shape one.

VBA Copy code Copy code
Worksheets(1).Shapes(1).Hyperlink.Follow NewWindow:=True

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ID Property (Excel)

 Copy code hover
[image]

Shape.ID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the type for the specified object.

Syntax

expression .ID

expression A variable that represents a Shape object.

Remarks

You can use an ID label as a hyperlink reference in other HTML documents or on the same Web page.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Left Property (Excel)

 Copy code hover
[image]

Shape.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Line Property (Excel)

 Copy code hover
[image]

Shape.Line Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.

Syntax

expression .Line

expression A variable that represents a Shape object.

Example

This example adds a blue dashed line to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

This example adds a cross to myDocument and then sets its border to be 8 points thick and red.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeCross, 10, 10, 50, 70).Line
 .Weight = 8
 .ForeColor.RGB = RGB(255, 0, 0)
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LinkFormat Property (Excel)

 Copy code hover
[image]

Shape.LinkFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LinkFormat object that contains linked OLE object properties. Read-only.

Syntax

expression .LinkFormat

expression A variable that represents a Shape object.

Example

This example updates all linked OLE objects on worksheet one.

VBA Copy code Copy code
For Each s In Worksheets(1).Shapes
 If s.Type = msoLinkedOLEObject Then s.LinkFormat.Update
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LockAspectRatio Property (Excel)

 Copy code hover
[image]

Shape.LockAspectRatio Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression A variable that represents a Shape object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse. You can change the height and width of the shape independently of one another when you resize it.

msoTriStateMixed

msoTriStateToggle

msoTrue. The specified shape retains its original proportions when you resize it.

Example

This example adds a cube to myDocument. The cube can be moved and resized, but not reproportioned.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddShape(msoShapeCube, _
    50, 50, 100, 200).LockAspectRatio = msoTrue

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Locked Property (Excel)

 Copy code hover
[image]

Shape.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a Shape object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Name Property (Excel)

 Copy code hover
[image]

Shape.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Nodes Property (Excel)

 Copy code hover
[image]

Shape.Nodes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeNodes collection that represents the geometric description of the specified shape.

Syntax

expression .Nodes

expression A variable that represents a Shape object.

Remarks

This property applies to Shape or ShapeRange objects that represent freeform drawings.

Example

This example adds a smooth node with a curved segment after node four in shape three on myDocument. Shape three must be a freeform drawing with at least four nodes.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 .Insert 4, msoSegmentCurve, msoEditingSmooth, 210, 100
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.OLEFormat Property (Excel)

 Copy code hover
[image]

Shape.OLEFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an OLEFormat object that contains OLE object properties. Read-only.

Syntax

expression .OLEFormat

expression A variable that represents a Shape object.

Example

This example activates an OLE object. If Shapes(1) doesn't represent an embedded OLE object, this example fails..

VBA Copy code Copy code
Worksheets(1).Shapes(1).OLEFormat.Activate

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.OnAction Property (Excel)

 Copy code hover
[image]

Shape.OnAction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of a macro that's run when the specified object is clicked. Read/write String.

Syntax

expression .OnAction

expression A variable that represents a Shape object.

Remarks

Setting this property for a menu item overrides any custom help information set up for the menu item with the information set up for the assigned macro.

Example

This example causes Microsoft Excel to run the ShapeClick procedure whenever shape one is clicked.

VBA Copy code Copy code
Worksheets(1).Shapes(1).OnAction = "ShapeClick"

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Parent Property (Excel)

 Copy code hover
[image]

Shape.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ParentGroup Property (Excel)

 Copy code hover
[image]

Shape.ParentGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

Syntax

expression .ParentGroup

expression A variable that represents a Shape object.

Example

In this example, Microsoft Excel adds two shapes to the active worksheet and then removes both shapes by deleting the parent shape of the group.

VBA Copy code Copy code
Sub ParentGroup()

 Dim pgShape As Shape

 With ActiveSheet.Shapes
 .AddShape Type:=1, Left:=10, Top:=10, _
 Width:=100, Height:=100
 .AddShape Type:=2, Left:=110, Top:=120, _
 Width:=100, Height:=100
 .Range(Array(1, 2)).Group
 End With

 ' Using the child shape in the group get the Parent shape.
 Set pgShape = ActiveSheet.Shapes(1).GroupItems(1).ParentGroup

 MsgBox "The two shapes will now be deleted."

 ' Delete the parent shape.
 pgShape.Delete

End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.PictureFormat Property (Excel)

 Copy code hover
[image]

Shape.PictureFormat Property (Excel)
See also Send feedback

Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a Shape object that represent pictures or OLE objects. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a Shape object.

Example

This example sets the brightness and contrast for shape one on myDocument. Shape one must be a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).PictureFormat
 .Brightness = 0.3
 .Contrast = .75
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Placement Property (Excel)

 Copy code hover
[image]

Shape.Placement Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlPlacement value that represents the way the object is attached to the cells below it.

Syntax

expression .Placement

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Reflection Property (Excel)

 Copy code hover
[image]

Shape.Reflection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object for a specified shape that contains reflection formatting properties for the shape. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Reflection

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Rotation Property (Excel)

 Copy code hover
[image]

Shape.Rotation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the shape, in degrees. Read/write Single.

Syntax

expression .Rotation

expression A variable that represents a Shape object.

Remarks

Rotations are always rounded to the nearest integer.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Shadow Property (Excel)

 Copy code hover
[image]

Shape.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.

Syntax

expression .Shadow

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ShapeStyle Property (Excel)

 Copy code hover
[image]

Shape.ShapeStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoShapeStyleIndex that represents the shape style of shape range. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .ShapeStyle

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SmartArt Property (Excel)

 Copy code hover
[image]

Shape.SmartArt Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the SmartArt associated with the shape. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SmartArt

expression A variable that represents a Shape object.

Return Value

SmartArt

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SoftEdge Property (Excel)

 Copy code hover
[image]

Shape.SoftEdge Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object for a specified shape that contains soft edge formatting properties for the shape. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SoftEdge

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextEffect Property (Excel)

 Copy code hover
[image]

Shape.TextEffect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.

Syntax

expression .TextEffect

expression A variable that represents a Shape object.

Example

This example sets the font style to bold for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontBold = True
 End If
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextFrame Property (Excel)

 Copy code hover
[image]

Shape.TextFrame Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.

Syntax

expression .TextFrame

expression A variable that represents a Shape object.

Example

This example causes text in the text frame in shape one to be justified. If shape one doesn't have a text frame, this example fails.

VBA Copy code Copy code
Worksheets(1).Shapes(1).TextFrame _
 .HorizontalAlignment = xlHAlignJustify

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextFrame2 Property (Excel)

 Copy code hover
[image]

Shape.TextFrame2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame2 object that contains text formatting for the specified shape. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TextFrame2

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ThreeD Property (Excel)

 Copy code hover
[image]

Shape.ThreeD Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.

Syntax

expression .ThreeD

expression A variable that represents a Shape object.

Example

This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 ' RGB value for purple
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Title Property (Excel)

 Copy code hover
[image]

Shape.Title Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the alternative text associated with the specified shape. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Title

expression A variable that represents a Shape object.

Return Value

String

Remarks

To set the descriptive text string of the alternative text for a shape, use the AlternativeText property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Top Property (Excel)

 Copy code hover
[image]

Shape.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.

Syntax

expression .Top

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TopLeftCell Property (Excel)

 Copy code hover
[image]

Shape.TopLeftCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cell that lies under the upper-left corner of the specified object. Read-only.

Syntax

expression .TopLeftCell

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Type Property (Excel)

 Copy code hover
[image]

Shape.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoShapeType value that represents the shape type.

Syntax

expression .Type

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.VerticalFlip Property (Excel)

 Copy code hover
[image]

Shape.VerticalFlip Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.

Syntax

expression .VerticalFlip

expression A variable that represents a Shape object.

Example

This example restores each shape on myDocument to its original state if it's been flipped horizontally or vertically.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.HorizontalFlip Then s.Flip msoFlipHorizontal
    If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Vertices Property (Excel)

 Copy code hover
[image]

Shape.Vertices Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.

Syntax

expression .Vertices

expression A variable that represents a Shape object.

Remarks

The following table shows how the Vertices property associates the values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element | Contains
vertArray(1, 1) | The horizontal distance from the first vertex to the left side of the document
vertArray(1, 2) | The vertical distance from the first vertex to the top of the document
vertArray(2, 1) | The horizontal distance from the second vertex to the left side of the document
vertArray(2, 2) | The vertical distance from the second vertex to the top of the document
vertArray(3, 1) | The horizontal distance from the third vertex to the left side of the document
vertArray(3, 2) | The vertical distance from the third vertex to the top of the document

Example

This example assigns the vertex coordinates for shape one on myDocument to the array variable vertArray() and displays the coordinates for the first vertex.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1)
 vertArray = .Vertices
 x1 = vertArray(1, 1)
 y1 = vertArray(1, 2)
 MsgBox "First vertex coordinates: " & x1 & ", " & y1
End With

This example creates a curve that has the same geometric description as shape one on myDocument. Shape one must contain 3n+1 vertices for this example to succeed.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddCurve .Item(1).Vertices
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Visible Property (Excel)

 Copy code hover
[image]

Shape.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Width Property (Excel)

 Copy code hover
[image]

Shape.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ZOrderPosition Property (Excel)

 Copy code hover
[image]

Shape.ZOrderPosition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the position of the specified shape in the z-order. Read-only Long.Read-only

Syntax

expression .ZOrderPosition

expression A variable that represents a Shape object.

Remarks

To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on myDocument, the expression myDocument.Shapes(1) returns the shape at the back of the z-order, and the expression myDocument.Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it's added to the front of the z-order by default.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)
 While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Wend
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape Methods (Excel)

 Copy code hover
[image]

Shape Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Apply | Applies to the specified shape formatting that's been copied by using the PickUp method.
Copy | Copies the object to the Clipboard.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Cut | Cuts the object to the Clipboard.
Delete | Deletes the object.
Duplicate | Duplicates the object and returns a reference to the new copy.
Flip | Flips the specified shape around its horizontal or vertical axis.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.
IncrementTop | Moves the specified shape vertically by the specified number of points.
PickUp | Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.
RerouteConnections | This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.
Select | Selects the object.
SetShapesDefaultProperties | Makes the formatting of the specified shape the default formatting for the shape.
Ungroup | Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).


Shape.Apply Method (Excel)

 Copy code hover
[image]

Shape.Apply Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies to the specified shape formatting that's been copied by using the PickUp method.

Syntax

expression .Apply

expression A variable that represents a Shape object.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Copy Method (Excel)

 Copy code hover
[image]

Shape.Copy Method (Excel)
See also Send feedback

Copies the object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CopyPicture Method (Excel)

 Copy code hover
[image]

Shape.CopyPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture.

Syntax

expression .CopyPicture(Appearance, Format)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | Variant | A XlPictureAppearance constant that specifies how the picture should be copied. The default value is xlScreen.
Format | Optional | Variant | A XlCopyPictureFormat constant that specifies the format of the picture. The default value is xlPicture.

Remarks

If you copy a range, it must be made up of adjacent cells.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Cut Method (Excel)

 Copy code hover
[image]

Shape.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the object to the Clipboard.

Syntax

expression .Cut

expression A variable that represents a Shape object.

Return Value

Nothing

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Delete Method (Excel)

 Copy code hover
[image]

Shape.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Duplicate Method (Excel)

 Copy code hover
[image]

Shape.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents a Shape object.

Return Value

Shape

Example

This example duplicates embedded chart one on Sheet1 and then selects the copy.

VBA Copy code Copy code
Set dChart = Worksheets("Sheet1").ChartObjects(1).Duplicate
dChart.Select

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Flip Method (Excel)

 Copy code hover
[image]

Shape.Flip Method (Excel)
See also Send feedback

Flips the specified shape around its horizontal or vertical axis.

Syntax

expression .Flip(FlipCmd)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | Specifies whether the shape is to be flipped horizontally or vertically.

Example

This example adds a triangle to myDocument, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRightTriangle, _
        10, 10, 50, 50).Duplicate
    .Fill.ForeColor.RGB = RGB(255, 0, 0)
    .Flip msoFlipVertical
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementLeft Method (Excel)

 Copy code hover
[image]

Shape.IncrementLeft Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape horizontally by the specified number of points.

Syntax

expression .IncrementLeft(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be moved horizontally, in points. A positive value moves the shape to the right; a negative value moves it to the left.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementRotation Method (Excel)

 Copy code hover
[image]

Shape.IncrementRotation Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.

Syntax

expression .IncrementRotation(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated horizontally, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise.

Remarks

To rotate a three-dimensional shape around the x-axis or the y-axis, use the IncrementRotationX method or the IncrementRotationY method.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementTop Method (Excel)

 Copy code hover
[image]

Shape.IncrementTop Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape vertically by the specified number of points.

Syntax

expression .IncrementTop(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape object is to be moved vertically, in points. A positive value moves the shape down; a negative value moves it up.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.PickUp Method (Excel)

 Copy code hover
[image]

Shape.PickUp Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.

Syntax

expression .PickUp

expression A variable that represents a Shape object.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.RerouteConnections Method (Excel)

 Copy code hover
[image]

Shape.RerouteConnections Method (Excel)
See also Send feedback

Published: July 16, 2012

This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.

Syntax

expression .RerouteConnections

expression A variable that represents a Shape object.

Remarks

Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.

If this method is applied to a connector, only that connector will be rerouted. If this method is applied to a connected shape, all connectors to that shape will be rerouted.

Example

This example adds two rectangles to myDocument, connects them with a curved connector, and then reroutes the connector so that it takes the shortest possible path between the two rectangles. Note that the RerouteConnections method adjusts the size and position of the connector and determines which connecting sites it attaches to, so the values you initially specify for the ConnectionSite arguments used with the BeginConnect and EndConnect methods are irrelevant.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, _
 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, _
 300, 300, 200, 100)
Set newConnector = s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100)
With newConnector.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
End With
newConnector.RerouteConnections

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ScaleHeight Method (Excel)

 Copy code hover
[image]

Shape.ScaleHeight Method (Excel)
See also Send feedback

Published: July 16, 2012

Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, Scale)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | msoTrue to scale the shape relative to its original size. msoFalse to scale it relative to its current size. You can specify msoTrue for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | Variant | One of the constants of MsoScaleFrom which specifies which part of the shape retains its position when the shape is scaled.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. Scale the shape relative to its current size.

msoTriStateMixed. Does not apply to this property.

msoTriStateToggle. Does not apply to this property.

msoTrue. Scale the shape relative to its original size.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    Select Case s.Type
    Case msoEmbeddedOLEObject, _
            msoLinkedOLEObject, _
            msoOLEControlObject, _
            msoLinkedPicture, msoPicture
        s.ScaleHeight 1.75, msoTrue
        s.ScaleWidth 1.75, msoTrue
    Case Else
        s.ScaleHeight 1.75, msoFalse
        s.ScaleWidth 1.75, msoFalse
    End Select
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ScaleWidth Method (Excel)

 Copy code hover
[image]

Shape.ScaleWidth Method (Excel)
See also Send feedback

Published: July 16, 2012

Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, Scale)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | Variant | One of the constants of MsoScaleFrom which specifies which part of the shape retains its position when the shape is scaled.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. To scale it relative to its current size.

msoTriStateMixed. Does not apply to this property.

msoTriStateToggle. Does not apply to this property.

msoTrue. Can only use this argument if the specified shape is a picture or an OLE object.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    Select Case s.Type
    Case msoEmbeddedOLEObject, _
            msoLinkedOLEObject, _
            msoOLEControlObject, _
            msoLinkedPicture, msoPicture
        s.ScaleHeight 1.75, msoTrue
        s.ScaleWidth 1.75, ,msoTrue
    Case Else
        s.ScaleHeight 1.75, msoFalse
        s.ScaleWidth 1.75, msoFalse
    End Select
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Select Method (Excel)

 Copy code hover
[image]

Shape.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SetShapesDefaultProperties Method (Excel)

 Copy code hover
[image]

Shape.SetShapesDefaultProperties Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes the formatting of the specified shape the default formatting for the shape.

Syntax

expression .SetShapesDefaultProperties

expression A variable that represents a Shape object.

Example

This example adds a rectangle to myDocument, formats the rectangle's fill, sets the rectangle's formatting as the default shape formatting, and then adds another smaller rectangle to the document. The second rectangle has the same fill as the first one.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 With .AddShape(msoShapeRectangle, 5, 5, 80, 60)
 With .Fill
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(0, 204, 255)
 .Patterned msoPatternHorizontalBrick
 End With
 ' Set formatting as default formatting
 .SetShapesDefaultProperties
 End With
 ' Create new shape with default formatting
 .AddShape msoShapeRectangle, 90, 90, 40, 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Ungroup Method (Excel)

 Copy code hover
[image]

Shape.Ungroup Method (Excel)
See also Send feedback

Published: July 16, 2012

Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.

Syntax

expression .Ungroup

expression A variable that represents a Shape object.

Return Value

A ShapeRange object that represents the ungrouped shapes.

Remarks

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example ungroups any grouped shapes and disassembles any pictures or OLE objects on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 s.Ungroup
Next

This example ungroups any grouped shapes on myDocument without disassembling pictures or OLE objects on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 If s.Type = msoGroup Then s.Ungroup

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ZOrder Method (Excel)

 Copy code hover
[image]

Shape.ZOrder Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape relative to the other shapes.

Remarks

MsoZOrderCmd can be one of these MsoZOrderCmd constants.

msoBringForward

msoBringInFrontOfText. Used only in Microsoft Word.

msoBringToFront

msoSendBackward

msoSendBehindText. Used only in Microsoft Word.

msoSendToBack

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)
    While .ZOrderPosition > 2
        .ZOrder msoSendBackward
    Wend
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


ShapeNode Object (Excel)

 Copy code hover
[image]

ShapeNode Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform.

Remarks

Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

Example

Use Nodes(index), where index is the node index number, to return a single ShapeNode object. If node one in shape three on myDocument is a corner point, the following example makes it a smooth point. For this example to work, shape three must be a freeform.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType 1, msoEditingSmooth
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

ShapeNode Object Members


ShapeNode Members (Excel)

 Copy code hover
[image]

ShapeNode Members (Excel)
Send feedback

Published: July 16, 2012

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EditingType | If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType.
Parent | Returns the parent object for the specified object. Read-only.
Points | Returns the position of the specified node as a coordinate pair. Each coordinate is expressed in points. Read-only Variant.
SegmentType | Returns a value that indicates whether the segment associated with the specified node is straight or curved. If the specified node is a control point for a curved segment, this property returns msoSegmentCurve. Read-only MsoSegmentType .


ShapeNode Properties (Excel)

 Copy code hover
[image]

ShapeNode Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
EditingType | If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType.
Parent | Returns the parent object for the specified object. Read-only.
Points | Returns the position of the specified node as a coordinate pair. Each coordinate is expressed in points. Read-only Variant.
SegmentType | Returns a value that indicates whether the segment associated with the specified node is straight or curved. If the specified node is a control point for a curved segment, this property returns msoSegmentCurve. Read-only MsoSegmentType .


ShapeNode.Application Property (Excel)

 Copy code hover
[image]

ShapeNode.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ShapeNode object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Creator Property (Excel)

 Copy code hover
[image]

ShapeNode.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ShapeNode object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.EditingType Property (Excel)

 Copy code hover
[image]

ShapeNode.EditingType Property (Excel)
See also Send feedback

Published: July 16, 2012

If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType.

Syntax

expression .EditingType

expression A variable that represents a ShapeNode object.

Remarks

This property is read-only. Use the SetEditingType method to set the value of this property.

Example

This example changes all corner nodes to smooth nodes in shape three on myDocument. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
    For n = 1 to .Count
        If .Item(n).EditingType = msoEditingCorner Then
            .SetEditingType n, msoEditingSmooth
        End If
    Next
End With

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Parent Property (Excel)

 Copy code hover
[image]

ShapeNode.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeNode object.

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Points Property (Excel)

 Copy code hover
[image]

ShapeNode.Points Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the position of the specified node as a coordinate pair. Each coordinate is expressed in points. Read-only Variant.

Syntax

expression .Points

expression An expression that returns a ShapeNode object.

Return Value

Variant

Remarks

This property is read-only. Use the SetPosition method to set the value of this property.

Example

This example moves node two in shape three on myDocument to the right 200 points and down 300 points. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 pointsArray = .Item(2).Points
 currXvalue = pointsArray(1, 1)
 currYvalue = pointsArray(1, 2)
 .SetPosition 2, currXvalue + 200, currYvalue + 300
End With

See also

Concepts

SparklineGroup Object
ShapeNode Object

Other resources

ShapeNode Object Members
SparklineGroup Object Members


ShapeNode.SegmentType Property (Excel)

 Copy code hover
[image]

ShapeNode.SegmentType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates whether the segment associated with the specified node is straight or curved. If the specified node is a control point for a curved segment, this property returns msoSegmentCurve. Read-only MsoSegmentType .

Syntax

expression .SegmentType

expression A variable that represents a ShapeNode object.

Remarks

MsoSegmentType can be one of these MsoSegmentType constants.

msoSegmentCurve

msoSegmentLine

Use the SetSegmentType method to set the value of this property.

Example

This example changes all straight segments to curved segments in shape three on myDocument. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 n = 1
 While n <= .Count
 If .Item(n).SegmentType = msoSegmentLine Then
 .SetSegmentType n, msoSegmentCurve
 End If
 n = n + 1
 Wend
End With

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNodes Object (Excel)

 Copy code hover
[image]

ShapeNodes Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the ShapeNode objects in the specified freeform.

Remarks

Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform. You can create a freeform manually or by using the BuildFreeform and ConvertToShape methods.

Example

Use the Nodes property to return the ShapeNodes collection. The following example deletes node four in shape three on myDocument. For this example to work, shape three must be a freeform with at least four nodes.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(3).Nodes.Delete 4

Use the Insert method to create a new node and add it to the ShapeNodes collection. The following example adds a smooth node with a curved segment after node four in shape three on myDocument. For this example to work, shape three must be a freeform with at least four nodes.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 .Insert 4, msoSegmentCurve, msoEditingSmooth, 210, 100
End With

Use Nodes(index), where index is the node index number, to return a single ShapeNode object. If node one in shape three on myDocument is a corner point, the following example makes it a smooth point. For this example to work, shape three must be a freeform.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType 1, msoEditingSmooth
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

ShapeNodes Object Members


ShapeNodes Members (Excel)

 Copy code hover
[image]

ShapeNodes Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ShapeNode objects in the specified freeform.

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a node into a freeform shape.
Item | Returns a single object from a collection.
SetEditingType | Sets the editing type of the node specified by Index. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Note that, depending on the editing type, this method may affect the position of adjacent nodes.
SetPosition | Sets the location of the node specified by Index. Note that, depending on the editing type of the node, this method may affect the position of adjacent nodes.
SetSegmentType | Sets the segment type of the segment that follows the node specified by Index. If the node is a control point for a curved segment, this method sets the segment type for that curve. Note that this may affect the total number of nodes by inserting or deleting adjacent nodes.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ShapeNodes Properties (Excel)

 Copy code hover
[image]

ShapeNodes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns an Integer value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


ShapeNodes.Application Property (Excel)

 Copy code hover
[image]

ShapeNodes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ShapeNodes object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.Count Property (Excel)

 Copy code hover
[image]

ShapeNodes.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Integer value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ShapeNodes object.

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.Creator Property (Excel)

 Copy code hover
[image]

ShapeNodes.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ShapeNodes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.Parent Property (Excel)

 Copy code hover
[image]

ShapeNodes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeNodes object.

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes Methods (Excel)

 Copy code hover
[image]

ShapeNodes Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a node into a freeform shape.
Item | Returns a single object from a collection.
SetEditingType | Sets the editing type of the node specified by Index. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Note that, depending on the editing type, this method may affect the position of adjacent nodes.
SetPosition | Sets the location of the node specified by Index. Note that, depending on the editing type of the node, this method may affect the position of adjacent nodes.
SetSegmentType | Sets the segment type of the segment that follows the node specified by Index. If the node is a control point for a curved segment, this method sets the segment type for that curve. Note that this may affect the total number of nodes by inserting or deleting adjacent nodes.


ShapeNodes.Delete Method (Excel)

 Copy code hover
[image]

ShapeNodes.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete(Index)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The index of the object to delete.

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.Insert Method (Excel)

 Copy code hover
[image]

ShapeNodes.Insert Method (Excel)
See also Send feedback

Inserts a node into a freeform shape.

Syntax

expression .Insert(Index, SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | Long. The number of the shape node after which to insert a new node.
SegmentType | Required | MsoSegmentType | The segment type.
EditingType | Required | MsoEditingType | The editing type.
X1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
Y1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
X2 | Required | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 | Required | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
X3 | Required | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 | Required | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Example

This example selects the third shape in the active document, checks whether the shape is a Freeform object, and if it is, inserts a node. This example assumes three shapes exist on the active worksheet.

VBA Copy code Copy code
Sub InsertShapeNode()
    ActiveSheet.Shapes(3).Select
    With Selection.ShapeRange
        If .Type = msoFreeform Then
            .Nodes.Insert _
                Index:=3, SegmentType:=msoSegmentCurve, _
                EditingType:=msoEditingSymmetric, X1:=35, Y1:=100
            .Fill.ForeColor.RGB = RGB(0, 0, 200)
            .Fill.Visible = msoTrue
        Else
            MsgBox "This shape is not a Freeform object."
        End If
    End With
End Sub

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.Item Method (Excel)

 Copy code hover
[image]

ShapeNodes.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A ShapeNode object contained by the collection.

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetEditingType Method (Excel)

 Copy code hover
[image]

ShapeNodes.SetEditingType Method (Excel)
See also Send feedback

Sets the editing type of the node specified by Index. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Note that, depending on the editing type, this method may affect the position of adjacent nodes.

Syntax

expression .SetEditingType(Index, EditingType)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose editing type is to be set.
EditingType | Required | MsoEditingType | The editing property of the vertex.

Example

This example changes all corner nodes to smooth nodes in shape three on myDocument. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
    For n = 1 to .Count
        If .Item(n).EditingType = msoEditingCorner Then
            .SetEditingType n, msoEditingSmooth
        End If
    Next
End With

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetPosition Method (Excel)

 Copy code hover
[image]

ShapeNodes.SetPosition Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the location of the node specified by Index. Note that, depending on the editing type of the node, this method may affect the position of adjacent nodes.

Syntax

expression .SetPosition(Index, X1, Y1)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose position is to be set.
X1 | Required | Single | The position (in points) of the new node relative to the upper-left corner of the document.
Y1 | Required | Single | The position (in points) of the new node relative to the upper-left corner of the document.

Example

This example moves node two in shape three on myDocument to the right 200 points and down 300 points. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 pointsArray = .Item(2).Points
 currXvalue = pointsArray(0, 0)
 currYvalue = pointsArray(0, 1)
 .SetPosition 2, currXvalue + 200, currYvalue + 300
End With

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetSegmentType Method (Excel)

 Copy code hover
[image]

ShapeNodes.SetSegmentType Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the segment type of the segment that follows the node specified by Index. If the node is a control point for a curved segment, this method sets the segment type for that curve. Note that this may affect the total number of nodes by inserting or deleting adjacent nodes.

Syntax

expression .SetSegmentType(Index, SegmentType)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose segment type is to be set.
SegmentType | Required | MsoSegmentType | Specifies if the segment is straight or curved.

Example

This example changes all straight segments to curved segments in shape three on myDocument. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
    n = 1
    While n <= .Count
        If .Item(n).SegmentType = msoSegmentLine Then
            .SetSegmentType n, msoSegmentCurve
        End If
        n = n + 1
    Wend
End With

See also

Concepts

ShapeNodes Object

Other resources

ShapeNodes Object Members


ShapeRange Object (Excel)

 Copy code hover
[image]

ShapeRange Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a shape range, which is a set of shapes on a document.

Remarks

A shape range can contain as few as a single shape or as many as all the shapes on the document. You can include whichever shapes you want — chosen from among all the shapes on the document or all the shapes in the selection — to construct a shape range. For example, you could construct a ShapeRange collection that contains the first three shapes on a document, all the selected shapes on a document, or all the freeforms on a document.

Example

Returning a Set of Shapes You Specify by Name or Index Number

Use Shapes.Range(index), where index is the name or index number of the shape or an array that contains either names or index numbers of shapes, to return a ShapeRange collection that represents a set of shapes on a document. You can use the Array function to construct an array of names or index numbers. The following example sets the fill pattern for shapes one and three on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.Range(Array(1, 3)).Fill.Patterned _
 msoPatternHorizontalBrick

The following example sets the fill pattern for the shapes named Oval 4 and Rectangle 5 on myDocument.

Although you can use the Range property to return any number of shapes or slides, it's simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myRange = myDocument.Shapes.Range(Array("Oval 4", _
 "Rectangle 5"))
myRange.Fill.Patterned msoPatternHorizontalBrick

Returning All or Some of the Selected Shapes on a Document

Use the ShapeRange property of the Selection object to return all the shapes in the selection. The following example sets the fill foreground color for all the shapes in the selection in window one, assuming that there's at least one shape in the selection.

VBA Copy code Copy code
Windows(1).Selection.ShapeRange.Fill.ForeColor.RGB = _
 RGB(255, 0, 255)

Use Selection.ShapeRange(index), where index is the shape name or the index number, to return a single shape within the selection. The following example sets the fill foreground color for shape two in the collection of selected shapes in window one, assuming that there are at least two shapes in the selection.

VBA Copy code Copy code
Windows(1).Selection.ShapeRange(2).Fill.ForeColor.RGB = _
 RGB(255, 0, 255)

See also

Concepts

Excel Object Model Reference

Other resources

ShapeRange Object Members


ShapeRange Members (Excel)

 Copy code hover
[image]

ShapeRange Members (Excel)
Send feedback

Published: July 16, 2012

Represents a shape range, which is a set of shapes on a document.

Methods

Name | Description
Align | Aligns the shapes in the specified range of shapes.
Apply | Applies to the specified shape formatting that's been copied by using the PickUp method.
Delete | Deletes the object.
Distribute | Horizontally or vertically distributes the shapes in the specified range of shapes.
Duplicate | Duplicates the object and returns a reference to the new copy.
Flip | Flips the specified shape around its horizontal or vertical axis.
Group | Groups the shapes in the specified range.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.
IncrementTop | Moves the specified shape vertically by the specified number of points.
Item | Returns a single object from a collection.
PickUp | Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.
Regroup | Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.
RerouteConnections | This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.
Select | Selects the object.
SetShapesDefaultProperties | Makes the formatting of the specified shape the default formatting for the shape.
Ungroup | Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any ShapeRange object that represents an AutoShape, WordArt, or a connector.
AlternativeText | Returns or sets the descriptive (alternative) text string for a ShapeRange object when the object is saved to a Web page. Read/write String.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.
BackgroundStyle | Returns or sets the background style. Read/write MsoBackgroundStyleIndex.
BlackWhiteMode | Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a ShapeRange object that represent line callouts. Read-only.
Chart | Returns a Chart object that represents the chart contained in the shape range. Read-only.
Child | Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
ConnectionSiteCount | Returns the number of connection sites on the specified shape. Read-only Long.
Connector | True if the specified shape is a connector. Read-only MsoTriState.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to a ShapeRange objects that represent connectors. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.
Glow | Returns a GlowFormat object for a specified shape range that contains glow formatting properties for the shape range. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to ShapeRange objects that represent grouped shapes. Read-only.
HasChart | Returns whether a shape range contains a chart. Read-only MsoTriState.
Height | Returns or sets a Single value that represents the height, in points, of the object.
HorizontalFlip | True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.
ID | Returns a Long value that represents the type for the specified object.
Left | Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets a String value representing the name of the object.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
Parent | Returns the parent object for the specified object. Read-only.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a ShapeRange object that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object for a specified shape range that contains reflection formatting properties for the shape range. Read-only.
Rotation | Returns or sets the rotation of the shape, in degrees. Read/write Single.
Shadow | Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.
ShapeStyle | Returns or sets an MsoShapeStyleIndex that represents shape style of shape range. Read/write.
SoftEdge | Returns a SoftEdgeFormat object for a specified shape range that contains soft edge formatting properties for the shape range. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified shape range. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.
Title | Returns or sets the title of the alternative text associated with the specified shape range. Read/write
Top | Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.
Type | Returns a MsoShapeType value that represents the shape type.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Width | Returns or sets a Single value that represents the width, in points, of the object.
ZOrderPosition | Returns the position of the specified shape in the z-order. Read-only Long.Read-only


ShapeRange Properties (Excel)

 Copy code hover
[image]

ShapeRange Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any ShapeRange object that represents an AutoShape, WordArt, or a connector.
AlternativeText | Returns or sets the descriptive (alternative) text string for a ShapeRange object when the object is saved to a Web page. Read/write String.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.
BackgroundStyle | Returns or sets the background style. Read/write MsoBackgroundStyleIndex.
BlackWhiteMode | Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a ShapeRange object that represent line callouts. Read-only.
Chart | Returns a Chart object that represents the chart contained in the shape range. Read-only.
Child | Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
ConnectionSiteCount | Returns the number of connection sites on the specified shape. Read-only Long.
Connector | True if the specified shape is a connector. Read-only MsoTriState.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to a ShapeRange objects that represent connectors. Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Fill | Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.
Glow | Returns a GlowFormat object for a specified shape range that contains glow formatting properties for the shape range. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to ShapeRange objects that represent grouped shapes. Read-only.
HasChart | Returns whether a shape range contains a chart. Read-only MsoTriState.
Height | Returns or sets a Single value that represents the height, in points, of the object.
HorizontalFlip | True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.
ID | Returns a Long value that represents the type for the specified object.
Left | Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.
LockAspectRatio | True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets a String value representing the name of the object.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
Parent | Returns the parent object for the specified object. Read-only.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a ShapeRange object that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object for a specified shape range that contains reflection formatting properties for the shape range. Read-only.
Rotation | Returns or sets the rotation of the shape, in degrees. Read/write Single.
Shadow | Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.
ShapeStyle | Returns or sets an MsoShapeStyleIndex that represents shape style of shape range. Read/write.
SoftEdge | Returns a SoftEdgeFormat object for a specified shape range that contains soft edge formatting properties for the shape range. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.
TextFrame2 | Returns a TextFrame2 object that contains text formatting for the specified shape range. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.
Title | Returns or sets the title of the alternative text associated with the specified shape range. Read/write
Top | Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.
Type | Returns a MsoShapeType value that represents the shape type.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Width | Returns or sets a Single value that represents the width, in points, of the object.
ZOrderPosition | Returns the position of the specified shape in the z-order. Read-only Long.Read-only


ShapeRange.Adjustments Property (Excel)

 Copy code hover
[image]

ShapeRange.Adjustments Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments object that contains adjustment values for all the adjustments in the specified shape. Applies to any ShapeRange object that represents an AutoShape, WordArt, or a connector.

Syntax

expression .Adjustments

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.AlternativeText Property (Excel)

 Copy code hover
[image]

ShapeRange.AlternativeText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the descriptive (alternative) text string for a ShapeRange object when the object is saved to a Web page. Read/write String.

Syntax

expression .AlternativeText

expression A variable that represents a ShapeRange object.

Remarks

The alternative text can be displayed either in place of the shape's image in the Web browser , or directly over the image when the mouse pointer hovers over the image (in browsers that support these features).

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Application Property (Excel)

 Copy code hover
[image]

ShapeRange.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ShapeRange object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.AutoShapeType Property (Excel)

 Copy code hover
[image]

ShapeRange.AutoShapeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape type for the specified Shape or ShapeRange object, which must represent an AutoShape other than a line, freeform drawing, or connector. Read/write MsoAutoShapeType.

Syntax

expression .AutoShapeType

expression A variable that represents a ShapeRange object.

Remarks

When you change the type of a shape, the shape retains its size, color, and other attributes.

Use the Type property of the ConnectorFormat object to set or return the connector type.

Example

This example replaces all 16-point stars with 32-point stars in myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.AutoShapeType = msoShape16pointStar Then
        s.AutoShapeType = msoShape32pointStar
    End If
Next

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.BackgroundStyle Property (Excel)

 Copy code hover
[image]

ShapeRange.BackgroundStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the background style. Read/write MsoBackgroundStyleIndex.

Version Information

Version Added: Excel 2007

Syntax

expression .BackgroundStyle

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.BlackWhiteMode Property (Excel)

 Copy code hover
[image]

ShapeRange.BlackWhiteMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates how the specified shape appears when the presentation is viewed in black-and-white mode. Read/write MsoBlackWhiteMode.

Syntax

expression .BlackWhiteMode

expression A variable that represents a ShapeRange object.

Example

This example sets shape one on wksOne to appear in black-and-white mode. When you view the presentation in black-and-white mode, shape one will appear black regardless of what color it is in color mode.

VBA Copy code Copy code
Sub UseBlackWhiteMode()

    Dim wksOne As Worksheet
    Set wksOne = Application.Worksheets(1)
    wksOne.Shapes(1).BlackWhiteMode = msoBlackWhiteGrayOutline

End Sub

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Callout Property (Excel)

 Copy code hover
[image]

ShapeRange.Callout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Applies to a ShapeRange object that represent line callouts. Read-only.

Syntax

expression .Callout

expression A variable that represents a ShapeRange object.

Example

This example adds to myDocument an oval and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
 .TextFrame.Characters.Text = "My oval"
 With .Callout
 .Accent = True
 .Border = False
 End With
 End With
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Chart Property (Excel)

 Copy code hover
[image]

ShapeRange.Chart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the chart contained in the shape range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Chart

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Child Property (Excel)

 Copy code hover
[image]

ShapeRange.Child Property (Excel)
See also Send feedback

Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.

Syntax

expression .Child

expression A variable that represents a ShapeRange object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. If the selected shape is not a child shape.

msoTriStateMixed. If only some of the selected shapes are child shapes.

msoTriStateToggle. Does not apply to this property.

msoTrue. If the selected shape is a child shape.

Example

This example selects the first shape in the canvas, and if the selected shape is a child shape, fills the shape with the specified color. This example assumes that a drawing canvas contains multiple shapes on the active worksheet.

VBA Copy code Copy code
Sub FillChildShape()

    'Select the first shape in the drawing canvas.
    ActiveSheet.Shapes(1).CanvasItems(1).Select

    'Fill selected shape if it is a child shape.
    If Selection.ShapeRange.Child = msoTrue Then
        Selection.ShapeRange.Fill.ForeColor.RGB = RGB(100, 0, 200)
    Else
        MsgBox "This shape is not a child shape."
    End If

End Sub

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ConnectionSiteCount Property (Excel)

 Copy code hover
[image]

ShapeRange.ConnectionSiteCount Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of connection sites on the specified shape. Read-only Long.

Syntax

expression .ConnectionSiteCount

expression An expression that returns a ShapeRange object.

Example

This example adds two rectangles to myDocument and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, _
 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, _
 300, 300, 200, 100)
lastsite = secondRect.ConnectionSiteCount
With s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100).ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, _
 ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, _
 ConnectionSite:=1
End With
With s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100).ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, _
 ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, _
 ConnectionSite:=lastsite
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Connector Property (Excel)

 Copy code hover
[image]

ShapeRange.Connector Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape is a connector. Read-only MsoTriState.

Syntax

expression .Connector

expression An expression that returns a ShapeRange object.

Example

This example deletes all connectors on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
    For i = .Count To 1 Step -1
        With .Item(i)
            If .Connector Then .Delete
        End With
    Next
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ConnectorFormat Property (Excel)

 Copy code hover
[image]

ShapeRange.ConnectorFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ConnectorFormat object that contains connector formatting properties. Applies to a ShapeRange objects that represent connectors. Read-only.

Syntax

expression .ConnectorFormat

expression An expression that returns a ShapeRange object.

Example

This example adds two rectangles to myDocument, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
Set c = s.AddConnector(msoConnectorCurve, 0, 0, 0, 0)
with c.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
 c.RerouteConnections
 .BeginDisconnect
 .EndDisconnect
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Count Property (Excel)

 Copy code hover
[image]

ShapeRange.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Creator Property (Excel)

 Copy code hover
[image]

ShapeRange.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ShapeRange object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Fill Property (Excel)

 Copy code hover
[image]

ShapeRange.Fill Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object for a specified shape or a ChartFillFormat object for a specified chart that contains fill formatting properties for the shape or chart. Read-only.

Syntax

expression .Fill

expression A variable that represents a ShapeRange object.

Example

This example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
        90, 90, 90, 50).Fill
    .ForeColor.RGB = RGB(128, 0, 0)
    .BackColor.RGB = RGB(170, 170, 170)
    .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Glow Property (Excel)

 Copy code hover
[image]

ShapeRange.Glow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object for a specified shape range that contains glow formatting properties for the shape range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Glow

expression A variable that represents a ShapeRange object.

Remarks

The glow effect adds a vibrant colored edge to graphics.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.GroupItems Property (Excel)

 Copy code hover
[image]

ShapeRange.GroupItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a GroupShapes object that represents the individual shapes in the specified group. Use the Item method of the GroupShapes object to return a single shape from the group. Applies to ShapeRange objects that represent grouped shapes. Read-only.

Syntax

expression .GroupItems

expression A variable that represents a ShapeRange object.

Example

This example adds three triangles to myDocument, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 10, 10, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 150, 10, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 300, 10, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.HasChart Property (Excel)

 Copy code hover
[image]

ShapeRange.HasChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether a shape range contains a chart. Read-only MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .HasChart

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Height Property (Excel)

 Copy code hover
[image]

ShapeRange.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the height, in points, of the object.

Syntax

expression .Height

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.HorizontalFlip Property (Excel)

 Copy code hover
[image]

ShapeRange.HorizontalFlip Property (Excel)
See also Send feedback

True if the specified shape is flipped around the horizontal axis. Read-only MsoTriState.

Syntax

expression .HorizontalFlip

expression A variable that represents a ShapeRange object.

Example

This example restores each shape on myDocument to its original state if it's been flipped horizontally or vertically.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.HorizontalFlip Then s.Flip msoFlipHorizontal
    If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ID Property (Excel)

 Copy code hover
[image]

ShapeRange.ID Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the type for the specified object.

Syntax

expression .ID

expression A variable that represents a ShapeRange object.

Remarks

You can use an ID label as a hyperlink reference in other HTML documents or on the same Web page.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Left Property (Excel)

 Copy code hover
[image]

ShapeRange.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Syntax

expression .Left

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Line Property (Excel)

 Copy code hover
[image]

ShapeRange.Line Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border). Read-only.

Syntax

expression .Line

expression A variable that represents a ShapeRange object.

Example

This example adds a blue dashed line to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

This example adds a cross to myDocument and then sets its border to be 8 points thick and red.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeCross, 10, 10, 50, 70).Line
 .Weight = 8
 .ForeColor.RGB = RGB(255, 0, 0)
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.LockAspectRatio Property (Excel)

 Copy code hover
[image]

ShapeRange.LockAspectRatio Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape retains its original proportions when you resize it. False if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression A variable that represents a ShapeRange object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse. You can change the height and width of the shape independently of one another when you resize it.

msoTriStateMixed

msoTriStateToggle

msoTrue. The specified shape retains its original proportions when you resize it.

Example

This example adds a cube to myDocument. The cube can be moved and resized, but not reproportioned.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddShape(msoShapeCube, _
    50, 50, 100, 200).LockAspectRatio = msoTrue

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Name Property (Excel)

 Copy code hover
[image]

ShapeRange.Name Property (Excel)
See also Send feedback

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Nodes Property (Excel)

 Copy code hover
[image]

ShapeRange.Nodes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeNodes collection that represents the geometric description of the specified shape.

Syntax

expression .Nodes

expression A variable that represents a ShapeRange object.

Remarks

This property applies to Shape or ShapeRange objects that represent freeform drawings.

Example

This example adds a smooth node with a curved segment after node four in shape three on myDocument. Shape three must be a freeform drawing with at least four nodes.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3).Nodes
 .Insert 4, msoSegmentCurve, msoEditingSmooth, 210, 100
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Parent Property (Excel)

 Copy code hover
[image]

ShapeRange.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ParentGroup Property (Excel)

 Copy code hover
[image]

ShapeRange.ParentGroup Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

Syntax

expression .ParentGroup

expression A variable that represents a ShapeRange object.

Example

In this example, Microsoft Excel adds two shapes to the active worksheet and then removes both shapes by deleting the parent shape of the group.

VBA Copy code Copy code
Sub ParentGroup()

 Dim pgShape As Shape

 With ActiveSheet.Shapes
 .AddShape Type:=1, Left:=10, Top:=10, _
 Width:=100, Height:=100
 .AddShape Type:=2, Left:=110, Top:=120, _
 Width:=100, Height:=100
 .Range(Array(1, 2)).Group
 End With

 ' Using the child shape in the group get the Parent shape.
 Set pgShape = ActiveSheet.Shapes(1).GroupItems(1).ParentGroup

 MsgBox "The two shapes will now be deleted."

 ' Delete the parent shape.
 pgShape.Delete

End Sub

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.PictureFormat Property (Excel)

 Copy code hover
[image]

ShapeRange.PictureFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object that contains picture formatting properties for the specified shape. Applies to a ShapeRange object that represent pictures or OLE objects. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a ShapeRange object.

Example

This example sets the brightness and contrast for shape one on myDocument. Shape one must be a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).PictureFormat
 .Brightness = 0.3
 .Contrast = .75
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Reflection Property (Excel)

 Copy code hover
[image]

ShapeRange.Reflection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object for a specified shape range that contains reflection formatting properties for the shape range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Reflection

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Rotation Property (Excel)

 Copy code hover
[image]

ShapeRange.Rotation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the shape, in degrees. Read/write Single.

Syntax

expression .Rotation

expression A variable that represents a ShapeRange object.

Remarks

Rotations are always rounded to the nearest integer.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Shadow Property (Excel)

 Copy code hover
[image]

ShapeRange.Shadow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a read-only ShadowFormat object that contains shadow formatting properties for the specified shape or shapes.

Syntax

expression .Shadow

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ShapeStyle Property (Excel)

 Copy code hover
[image]

ShapeRange.ShapeStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoShapeStyleIndex that represents shape style of shape range. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .ShapeStyle

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.SoftEdge Property (Excel)

 Copy code hover
[image]

ShapeRange.SoftEdge Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object for a specified shape range that contains soft edge formatting properties for the shape range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SoftEdge

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.TextEffect Property (Excel)

 Copy code hover
[image]

ShapeRange.TextEffect Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.

Syntax

expression .TextEffect

expression A variable that represents a ShapeRange object.

Example

This example sets the font style to bold for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontBold = True
 End If
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.TextFrame Property (Excel)

 Copy code hover
[image]

ShapeRange.TextFrame Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape. Read-only.

Syntax

expression .TextFrame

expression A variable that represents a ShapeRange object.

Example

This example causes text in the text frame in shape one to be justified. If shape one doesn't have a text frame, this example fails.

VBA Copy code Copy code
Worksheets(1).Shapes(1).TextFrame _
 .HorizontalAlignment = xlHAlignJustify

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.TextFrame2 Property (Excel)

 Copy code hover
[image]

ShapeRange.TextFrame2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame2 object that contains text formatting for the specified shape range. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TextFrame2

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ThreeD Property (Excel)

 Copy code hover
[image]

ShapeRange.ThreeD Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D - effect formatting properties for the specified shape. Read-only.

Syntax

expression .ThreeD

expression A variable that represents a ShapeRange object.

Example

This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 ' RGB value for purple
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Title Property (Excel)

 Copy code hover
[image]

ShapeRange.Title Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the alternative text associated with the specified shape range. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Title

expression A variable that represents a ShapeRange object.

Return Value

String

Remarks

To set the descriptive text string of the alternative text for a shape range, use the AlternativeText property.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Top Property (Excel)

 Copy code hover
[image]

ShapeRange.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the distance, in points, from the top edge of the topmost shape in the shape range to the top edge of the worksheet.

Syntax

expression .Top

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Type Property (Excel)

 Copy code hover
[image]

ShapeRange.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a MsoShapeType value that represents the shape type.

Syntax

expression .Type

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.VerticalFlip Property (Excel)

 Copy code hover
[image]

ShapeRange.VerticalFlip Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.

Syntax

expression .VerticalFlip

expression A variable that represents a ShapeRange object.

Example

This example restores each shape on myDocument to its original state if it's been flipped horizontally or vertically.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    If s.HorizontalFlip Then s.Flip msoFlipHorizontal
    If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Vertices Property (Excel)

 Copy code hover
[image]

ShapeRange.Vertices Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument to the AddCurve method or AddPolyLine method. Read-only Variant.

Syntax

expression .Vertices

expression A variable that represents a ShapeRange object.

Remarks

The following table shows how the Vertices property associates the values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element | Contains
vertArray(1, 1) | The horizontal distance from the first vertex to the left side of the document
vertArray(1, 2) | The vertical distance from the first vertex to the top of the document
vertArray(2, 1) | The horizontal distance from the second vertex to the left side of the document
vertArray(2, 2) | The vertical distance from the second vertex to the top of the document
vertArray(3, 1) | The horizontal distance from the third vertex to the left side of the document
vertArray(3, 2) | The vertical distance from the third vertex to the top of the document

Example

This example assigns the vertex coordinates for shape one on myDocument to the array variable vertArray() and displays the coordinates for the first vertex.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1)
 vertArray = .Vertices
 x1 = vertArray(1, 1)
 y1 = vertArray(1, 2)
 MsgBox "First vertex coordinates: " & x1 & ", " & y1
End With

This example creates a curve that has the same geometric description as shape one on myDocument. Shape one must contain 3n+1 vertices for this example to succeed.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 .AddCurve .Item(1).Vertices
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Visible Property (Excel)

 Copy code hover
[image]

ShapeRange.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Width Property (Excel)

 Copy code hover
[image]

ShapeRange.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the width, in points, of the object.

Syntax

expression .Width

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ZOrderPosition Property (Excel)

 Copy code hover
[image]

ShapeRange.ZOrderPosition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the position of the specified shape in the z-order. Read-only Long.Read-only

Syntax

expression .ZOrderPosition

expression A variable that represents a ShapeRange object.

Remarks

To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on myDocument, the expression myDocument.Shapes(1) returns the shape at the back of the z-order, and the expression myDocument.Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it's added to the front of the z-order by default.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)
 While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Wend
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange Methods (Excel)

 Copy code hover
[image]

ShapeRange Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Align | Aligns the shapes in the specified range of shapes.
Apply | Applies to the specified shape formatting that's been copied by using the PickUp method.
Delete | Deletes the object.
Distribute | Horizontally or vertically distributes the shapes in the specified range of shapes.
Duplicate | Duplicates the object and returns a reference to the new copy.
Flip | Flips the specified shape around its horizontal or vertical axis.
Group | Groups the shapes in the specified range.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.
IncrementTop | Moves the specified shape vertically by the specified number of points.
Item | Returns a single object from a collection.
PickUp | Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.
Regroup | Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.
RerouteConnections | This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.
Select | Selects the object.
SetShapesDefaultProperties | Makes the formatting of the specified shape the default formatting for the shape.
Ungroup | Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).


ShapeRange.Align Method (Excel)

 Copy code hover
[image]

ShapeRange.Align Method (Excel)
See also Send feedback

Published: July 16, 2012

Aligns the shapes in the specified range of shapes.

Syntax

expression .Align(AlignCmd, RelativeTo)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
AlignCmd | Required | MsoAlignCmd | Specifies the way the shapes in the specified shape range are to be aligned.
RelativeTo | Required | MsoTriState | Not used in Microsoft Excel. Must be False.

Example

This example aligns the left edges of all the shapes in the specified range in myDocument with the left edge of the leftmost shape in the range.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
Selection.ShapeRange.Align msoAlignLefts, False

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Apply Method (Excel)

 Copy code hover
[image]

ShapeRange.Apply Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies to the specified shape formatting that's been copied by using the PickUp method.

Syntax

expression .Apply

expression A variable that represents a ShapeRange object.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Delete Method (Excel)

 Copy code hover
[image]

ShapeRange.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Distribute Method (Excel)

 Copy code hover
[image]

ShapeRange.Distribute Method (Excel)
See also Send feedback

Published: July 16, 2012

Horizontally or vertically distributes the shapes in the specified range of shapes.

Syntax

expression .Distribute(DistributeCmd, RelativeTo)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
DistributeCmd | Required | MsoDistributeCmd | Specifies whether shapes in the range are to be distributed horizontally or vertically.
RelativeTo | Required | MsoTriState | Not used in Microsoft Excel. Must be False.

Example

This example defines a shape range that contains all the AutoShapes on myDocument and then horizontally distributes the shapes in this range. The leftmost shape retains its position.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
    numShapes = .Count
    If numShapes > 1 Then
        numAutoShapes = 0
        ReDim autoShpArray(1 To numShapes)
        For i = 1 To numShapes
            If .Item(i).Type = msoAutoShape Then
                numAutoShapes = numAutoShapes + 1
                autoShpArray(numAutoShapes) = .Item(i).Name
            End If
        Next
        If numAutoShapes > 1 Then
            ReDim Preserve autoShpArray(1 To numAutoShapes)
            Set asRange = .Range(autoShpArray)
            asRange.Distribute msoDistributeHorizontally, False
        End If
    End If
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Duplicate Method (Excel)

 Copy code hover
[image]

ShapeRange.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the object and returns a reference to the new copy.

Syntax

expression .Duplicate

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Flip Method (Excel)

 Copy code hover
[image]

ShapeRange.Flip Method (Excel)
See also Send feedback

Published: July 16, 2012

Flips the specified shape around its horizontal or vertical axis.

Syntax

expression .Flip(FlipCmd)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | Specifies whether the shape is to be flipped horizontally or vertically.

Example

This example adds a triangle to myDocument, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRightTriangle, _
        10, 10, 50, 50).Duplicate
    .Fill.ForeColor.RGB = RGB(255, 0, 0)
    .Flip msoFlipVertical
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Group Method (Excel)

 Copy code hover
[image]

ShapeRange.Group Method (Excel)
See also Send feedback

Published: July 16, 2012

Groups the shapes in the specified range.

Syntax

expression .Group

expression A variable that represents a ShapeRange object.

Return Value

A Shape object that represents the grouped shape.

Remarks

Because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

The Range object must be a single cell in the PivotTable field's data range. If you attempt to apply this method to more than one cell, it will fail (without displaying an error message).

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementLeft Method (Excel)

 Copy code hover
[image]

ShapeRange.IncrementLeft Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape horizontally by the specified number of points.

Syntax

expression .IncrementLeft(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be moved horizontally, in points. A positive value moves the shape to the right; a negative value moves it to the left.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementRotation Method (Excel)

 Copy code hover
[image]

ShapeRange.IncrementRotation Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the z-axis by the specified number of degrees. Use the Rotation property to set the absolute rotation of the shape.

Syntax

expression .IncrementRotation(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated horizontally, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise.

Remarks

To rotate a three-dimensional shape around the x-axis or the y-axis, use the IncrementRotationX method or the IncrementRotationY method.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementTop Method (Excel)

 Copy code hover
[image]

ShapeRange.IncrementTop Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape vertically by the specified number of points.

Syntax

expression .IncrementTop(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape object is to be moved vertically, in points. A positive value moves the shape down; a negative value moves it up.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Item Method (Excel)

 Copy code hover
[image]

ShapeRange.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Shape object contained by the collection.

Example

This example sets the OnAction property for shape two in a shape range. If the sr variable doesn't represent a ShapeRange object, this example fails.

VBA Copy code Copy code
Dim sr As Shape
sr.Item(2).OnAction = "ShapeAction"

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.PickUp Method (Excel)

 Copy code hover
[image]

ShapeRange.PickUp Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the formatting of the specified shape. Use the Apply method to apply the copied formatting to another shape.

Syntax

expression .PickUp

expression A variable that represents a ShapeRange object.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Regroup Method (Excel)

 Copy code hover
[image]

ShapeRange.Regroup Method (Excel)
See also Send feedback

Published: July 16, 2012

Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.

Syntax

expression .Regroup

expression A variable that represents a ShapeRange object.

Return Value

Shape

Remarks

The Regroup method only restores the group for the first previously grouped shape it finds in the specified ShapeRange collection. Therefore, if the specified shape range contains shapes that previously belonged to different groups, only one of the groups will be restored.

Note that because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example regroups the shapes in the selection in the active window. If the shapes haven't been previously grouped and ungrouped, this example will fail.

VBA Copy code Copy code
ActiveWindow.Selection.ShapeRange.Regroup

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.RerouteConnections Method (Excel)

 Copy code hover
[image]

ShapeRange.RerouteConnections Method (Excel)
See also Send feedback

Published: July 16, 2012

This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it's rerouted.

Syntax

expression .RerouteConnections

expression A variable that represents a ShapeRange object.

Remarks

Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.

If this method is applied to a connector, only that connector will be rerouted. If this method is applied to a connected shape, all connectors to that shape will be rerouted.

Example

This example adds two rectangles to myDocument, connects them with a curved connector, and then reroutes the connector so that it takes the shortest possible path between the two rectangles. Note that the RerouteConnections method adjusts the size and position of the connector and determines which connecting sites it attaches to, so the values you initially specify for the ConnectionSite arguments used with the BeginConnect and EndConnect methods are irrelevant.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, _
 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, _
 300, 300, 200, 100)
Set newConnector = s.AddConnector(msoConnectorCurve, _
 0, 0, 100, 100)
With newConnector.ConnectorFormat
 .BeginConnect firstRect, 1
 .EndConnect secondRect, 1
End With
newConnector.RerouteConnections

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ScaleHeight Method (Excel)

 Copy code hover
[image]

ShapeRange.ScaleHeight Method (Excel)
See also Send feedback

Published: July 16, 2012

Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, Scale)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | msoTrue to scale the shape relative to its original size. msoFalse to scale it relative to its current size. You can specify msoTrue for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | Variant | One of the constants of MsoScaleFrom which specifies which part of the shape retains its position when the shape is scaled.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. Scale the shape relative to its current size.

msoTriStateMixed. Does not apply to this property.

msoTriStateToggle. Does not apply to this property.

msoTrue. Scale the shape relative to its original size.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    Select Case s.Type
    Case msoEmbeddedOLEObject, _
            msoLinkedOLEObject, _
            msoOLEControlObject, _
            msoLinkedPicture, msoPicture
        s.ScaleHeight 1.75, msoTrue
        s.ScaleWidth 1.75, msoTrue
    Case Else
        s.ScaleHeight 1.75, msoFalse
        s.ScaleWidth 1.75, msoFalse
    End Select
Next

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ScaleWidth Method (Excel)

 Copy code hover
[image]

ShapeRange.ScaleWidth Method (Excel)
See also Send feedback

Published: July 16, 2012

Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, Scale)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | Variant | One of the constants of MsoScaleFrom which specifies which part of the shape retains its position when the shape is scaled.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue. Does not apply to this property.

msoFalse. To scale it relative to its current size.

msoTriStateMixed. Does not apply to this property.

msoTriStateToggle. Does not apply to this property.

msoTrue. Can only use this argument if the specified shape is a picture or an OLE object.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
    Select Case s.Type
    Case msoEmbeddedOLEObject, _
            msoLinkedOLEObject, _
            msoOLEControlObject, _
            msoLinkedPicture, msoPicture
        s.ScaleHeight 1.75, msoTrue
        s.ScaleWidth 1.75, ,msoTrue
    Case Else
        s.ScaleHeight 1.75, msoFalse
        s.ScaleWidth 1.75, msoFalse
    End Select
Next

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Select Method (Excel)

 Copy code hover
[image]

ShapeRange.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.SetShapesDefaultProperties Method (Excel)

 Copy code hover
[image]

ShapeRange.SetShapesDefaultProperties Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes the formatting of the specified shape the default formatting for the shape.

Syntax

expression .SetShapesDefaultProperties

expression A variable that represents a ShapeRange object.

Example

This example adds a rectangle to myDocument, formats the rectangle's fill, sets the rectangle's formatting as the default shape formatting, and then adds another smaller rectangle to the document. The second rectangle has the same fill as the first one.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 With .AddShape(msoShapeRectangle, 5, 5, 80, 60)
 With .Fill
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(0, 204, 255)
 .Patterned msoPatternHorizontalBrick
 End With
 ' Set formatting as default formatting
 .SetShapesDefaultProperties
 End With
 ' Create new shape with default formatting
 .AddShape msoShapeRectangle, 90, 90, 40, 30
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.Ungroup Method (Excel)

 Copy code hover
[image]

ShapeRange.Ungroup Method (Excel)
See also Send feedback

Published: July 16, 2012

Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes.

Syntax

expression .Ungroup

expression A variable that represents a ShapeRange object.

Return Value

A ShapeRange object that represents the ungrouped shapes.

Remarks

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example ungroups any grouped shapes and disassembles any pictures or OLE objects on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 s.Ungroup
Next

This example ungroups any grouped shapes on myDocument without disassembling pictures or OLE objects on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 If s.Type = msoGroup Then s.Ungroup

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ShapeRange.ZOrder Method (Excel)

 Copy code hover
[image]

ShapeRange.ZOrder Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape relative to the other shapes.

Remarks

MsoZOrderCmd can be one of these MsoZOrderCmd constants.

msoBringForward

msoBringInFrontOfText. Used only in Microsoft Word.

msoBringToFront

msoSendBackward

msoSendBehindText. Used only in Microsoft Word.

msoSendToBack

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)
    While .ZOrderPosition > 2
        .ZOrder msoSendBackward
    Wend
End With

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


Shapes Object (Excel)

 Copy code hover
[image]

Shapes Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Shape objects on the specified sheet.

Remarks

Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Note Note

If you want to work with a subset of the shapes on a document — for example, to do something to only the AutoShapes on the document or to only the selected shapes — you must construct a ShapeRange collection that contains the shapes you want to work with.

Example

Use the Shapes property to return the Shapes collection.The following example selects all the shapes on myDocument.

Note Note

If you want to do something (like delete or set a property) to all the shapes on a sheet at the same time, select all the shapes and then use the ShapeRange property on the selection to create a ShapeRange object that contains all the shapes on the sheet, and then apply the appropriate property or method to the ShapeRange object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll

Use Shapes(index), where index is the shape's name or index number, to return a single Shape object. The following example sets the fill to a preset shade for shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Fill.PresetGradient _
 msoGradientHorizontal, 1, msoGradientBrass

Use Shapes.Range(index), where index is the shape's name or index number or an array of shape names or index numbers, to return a ShapeRange collection that represents a subset of the Shapes collection. The following example sets the fill pattern for shapes one and three on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.Range(Array(1, 3)).Fill.Patterned _
 msoPatternHorizontalBrick

An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the Name box when you view the sheet, and the code name for the control, which you can see in the cell to the right of (Name) in the Properties window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other isn't automatically changed to match.

You use the code name of a control in the names of its event procedures. However, when you return a control from the Shapes or OLEObjects collection for a sheet, you must use the shape name, not the code name, to refer to the control by name. For example, assume that you add a check box to a sheet and that both the default shape name and the default code name are CheckBox1. If you then change the control code name by typing chkFinished next to (Name) in the Properties window, you must use chkFinished in event procedures names, but you still have to use CheckBox1 to return the control from the Shapes or OLEObject collection, as shown in the following example.

VBA Copy code Copy code
Private Sub chkFinished_Click()
 ActiveSheet.OLEObjects("CheckBox1").Object.Value = 1
End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Shapes Object Members


Shapes Members (Excel)

 Copy code hover
[image]

Shapes Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Shape objects on the specified sheet.

Methods

Name | Description
AddCallout | Creates a borderless line callout. Returns a Shape object that represents the new callout.
AddChart2 | Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.
AddConnector | Creates a connector. Returns a Shape object that represents the new connector. When a connector is added, it's not connected to anything. Use the BeginConnect and EndConnect methods to attach the beginning and end of a connector to other shapes in the document.
AddCurve | Returns a Shape object that represents a Bézier curve in a worksheet.
AddFormControl | Creates a Microsoft Excel control. Returns a Shape object that represents the new control.
AddLabel | Creates a label. Returns a Shape object that represents the new label.
AddLine | As it applies to the Shapes object, returns a Shape object that represents the new line in a worksheet.
AddOLEObject | Creates an OLE object. Returns a Shape object that represents the new OLE object.
AddPicture | Creates a picture from an existing file. Returns a Shape object that represents the new picture.
AddPicture2 |
AddPolyline | Creates an open polyline or a closed polygon drawing. Returns a Shape object that represents the new polyline or polygon.
AddShape | Returns a Shape object that represents the new AutoShape in a worksheet.
AddSmartArt | Creates a new SmartArt graphic with the specified layout.
AddTextbox | Creates a text box. Returns a Shape object that represents the new text box.
AddTextEffect | Creates a WordArt object. Returns a Shape object that represents the new WordArt object.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.
Item | Returns a single object from a collection.
SelectAll | Selects all the shapes in the specified Shapes collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.


Shapes Properties (Excel)

 Copy code hover
[image]

Shapes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.


Shapes.Application Property (Excel)

 Copy code hover
[image]

Shapes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Shapes object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.Count Property (Excel)

 Copy code hover
[image]

Shapes.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Shapes object.

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.Creator Property (Excel)

 Copy code hover
[image]

Shapes.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Shapes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.Parent Property (Excel)

 Copy code hover
[image]

Shapes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Shapes object.

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.Range Property (Excel)

 Copy code hover
[image]

Shapes.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Syntax

expression .Range(Index)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual shapes to be included in the range. Can be an integer that specifies the index number of the shape, a string that specifies the name of the shape, or an array that contains either integers or strings.

Remarks

Although you can use the Range property to return any number of shapes, it's simpler to use the Item method if you only want to return a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).

To specify an array of integers or strings for Index, you can use the Array function. For example, the following instruction returns two shapes specified by name.

Dim arShapes() As Variant

Dim objRange As Object

arShapes = Array("Oval 4", "Rectangle 5")

Set objRange = ActiveSheet.Shapes.Range(arShapes)

In Microsoft Excel, you cannot use this property to return a ShapeRange object containing all the Shape objects on a worksheet. Instead, use the following code:

Worksheets(1).Shapes.SelectAll ' select all shapes set sr = Selection.ShapeRange ' create ShapeRange

Example

This example sets the fill pattern for shapes one and three on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.Range(Array(1, 3)) _
 .Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for the shapes named "Oval 4" and "Rectangle 5" on myDocument.

VBA Copy code Copy code
Dim arShapes() As Variant
Dim objRange As Object
Set myDocument = Worksheets(1)
arShapes = Array("Oval 4", "Rectangle 5")
Set objRange = myDocument.Shapes.Range(arShapes)
objRange.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myRange = myDocument.Shapes.Range(1)
myRange.Fill.Patterned msoPatternHorizontalBrick

This example creates an array that contains all the AutoShapes on myDocument, uses that array to define a shape range, and then distributes all the shapes in that range horizontally.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 numShapes = .Count
 If numShapes > 1 Then
 numAutoShapes = 1
 ReDim autoShpArray(1 To numShapes)
 For i = 1 To numShapes
 If .Item(i).Type = msoAutoShape Then
 autoShpArray(numAutoShapes) = .Item(i).Name
 numAutoShapes = numAutoShapes + 1
 End If
 Next
 If numAutoShapes > 1 Then
 ReDim Preserve autoShpArray(1 To numAutoShapes)
 Set asRange = .Range(autoShpArray)
 asRange.Distribute msoDistributeHorizontally, False
 End If
 End If
End With

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes Methods (Excel)

 Copy code hover
[image]

Shapes Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddCallout | Creates a borderless line callout. Returns a Shape object that represents the new callout.
AddChart2 | Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.
AddConnector | Creates a connector. Returns a Shape object that represents the new connector. When a connector is added, it's not connected to anything. Use the BeginConnect and EndConnect methods to attach the beginning and end of a connector to other shapes in the document.
AddCurve | Returns a Shape object that represents a Bézier curve in a worksheet.
AddFormControl | Creates a Microsoft Excel control. Returns a Shape object that represents the new control.
AddLabel | Creates a label. Returns a Shape object that represents the new label.
AddLine | As it applies to the Shapes object, returns a Shape object that represents the new line in a worksheet.
AddOLEObject | Creates an OLE object. Returns a Shape object that represents the new OLE object.
AddPicture | Creates a picture from an existing file. Returns a Shape object that represents the new picture.
AddPicture2 |
AddPolyline | Creates an open polyline or a closed polygon drawing. Returns a Shape object that represents the new polyline or polygon.
AddShape | Returns a Shape object that represents the new AutoShape in a worksheet.
AddSmartArt | Creates a new SmartArt graphic with the specified layout.
AddTextbox | Creates a text box. Returns a Shape object that represents the new text box.
AddTextEffect | Creates a WordArt object. Returns a Shape object that represents the new WordArt object.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.
Item | Returns a single object from a collection.
SelectAll | Selects all the shapes in the specified Shapes collection.


Shapes.AddCallout Method (Excel)

 Copy code hover
[image]

Shapes.AddCallout Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a borderless line callout. Returns a Shape object that represents the new callout.

Syntax

expression .AddCallout(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoCalloutType | The type of callout line.
Left | Required | Single | The position (in points) of the upper-left corner of the callout's bounding box relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the callout's bounding box relative to the upper-left corner of the document.
Width | Required | Single | The width of the callout's bounding box, in points.
Height | Required | Single | The height of the callout's bounding box, in points.

Return Value

Shape

Remarks

MsoCalloutType can be one of these MsoCalloutType constants.

msoCalloutOne. A single-segment callout line that can be either horizontal or vertical.

msoCalloutTwo. A single-segment callout line that rotates freely.

msoCalloutMixed.

msoCalloutThree. A two-segment line.

msoCalloutFour. A three-segment line.

You can insert a greater variety of callouts by using the AddShape method.

Example

This example adds a borderless callout with a freely rotating one-segment callout line to myDocument and then sets the callout angle to 30 degrees.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddCallout(Type:=msoCalloutTwo, _
    Left:=50, Top:=50, Width:=200, Height:=100) _
    .Callout.Angle = msoCalloutAngle30

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddChart2 Method (Excel)

 Copy code hover
[image]

Shapes.AddChart2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.

Version information

Version Added: Excel 2013

Syntax

expression .AddChart2(Style,XlChartType,Left,Top,Width,Height,NewLayout)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data type | Description
Style | Optional | VARIANT | The chart style.
XlChartType | Optional | VARIANT | The type of chart.
Left | Optional | VARIANT | The position, in points, of the left edge of the chart, relative to the anchor.
Top | Optional | VARIANT | The position, in points, of the top edge of the chart, relative to the anchor.
Width | Optional | VARIANT | The width, in points, of the chart.
Height | Optional | VARIANT | The height, in points, of the chart.
NewLayout | Optional | VARIANT | If NewLayout is True, the chart is inserted by using the new dynamic formatting rules (Title is on, and Legend is on only if there are multiple series).

Return value

SHAPE

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddConnector Method (Excel)

 Copy code hover
[image]

Shapes.AddConnector Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a connector. Returns a Shape object that represents the new connector. When a connector is added, it's not connected to anything. Use the BeginConnect and EndConnect methods to attach the beginning and end of a connector to other shapes in the document.

Syntax

expression .AddConnector(Type, BeginX, BeginY, EndX, EndY)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoConnectorType | The connector type to add.
BeginX | Required | Single | The horizontal position (in points) of the connector's starting point relative to the upper-left corner of the document.
BeginY | Required | Single | The vertical position (in points) of the connector's starting point relative to the upper-left corner of the document.
EndX | Required | Single | The horizontal position (in points) of the connector's end point relative to the upper-left corner of the document.
EndY | Required | Single | The veritcal position (in points) of the connector's end point relative to the upper-left corner of the document.

Return Value

Shape

Remarks

MsoConnectorType can be one of these MsoConnectorType constants.

msoConnectorElbow

msoConnectorTypeMixed

msoConnectorCurve

msoConnectorStraight

When you attach a connector to a shape, the size and position of the connector are automatically adjusted, if necessary. Therefore, if you're going to attach a connector to other shapes, the position and dimensions you specify when adding the connector are irrelevant.

Example

The following example adds a curved connector to a new canvas in a new worksheet.

VBA Copy code Copy code
Sub AddCanvasConnector()

    Dim wksNew As Worksheet
    Dim shpCanvas As Shape

    Set wksNew = Worksheets.Add

    'Add drawing canvas to new worksheet
    Set shpCanvas = wksNew.Shapes.AddCanvas( _
        Left:=150, Top:=150, Width:=200, Height:=300)

    'Add connector to the drawing canvas
    shpCanvas.CanvasItems.AddConnector _
        Type:=msoConnectorStraight, BeginX:=150, _
        BeginY:=150, EndX:=200, EndY:=200

End Sub

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddCurve Method (Excel)

 Copy code hover
[image]

Shapes.AddCurve Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents a Bézier curve in a worksheet.

Syntax

expression .AddCurve(SafeArrayOfPoints)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the vertices and control points of the curve. The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. Then, for each additional segment of the curve, you specify a vertex and two control points. The last point you specify is the ending vertex for the curve. Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

Return Value

Shape

Example

The following example adds a two-segment Bézier curve to myDocument.

VBA Copy code Copy code
Dim pts(1 To 7, 1 To 2) As Single
pts(1, 1) = 0
pts(1, 2) = 0
pts(2, 1) = 72
pts(2, 2) = 72
pts(3, 1) = 100
pts(3, 2) = 40
pts(4, 1) = 20
pts(4, 2) = 50
pts(5, 1) = 90
pts(5, 2) = 120
pts(6, 1) = 60
pts(6, 2) = 30
pts(7, 1) = 150
pts(7, 2) = 90
Set myDocument = Worksheets(1)
myDocument.Shapes.AddCurve SafeArrayOfPoints:=pts

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddFormControl Method (Excel)

 Copy code hover
[image]

Shapes.AddFormControl Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a Microsoft Excel control. Returns a Shape object that represents the new control.

Syntax

expression .AddFormControl(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFormControl | The Microsoft Excel control type. You cannot create an edit box on a worksheet.
Left | Required | Long | The initial coordinates of the new object (in points) relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.
Top | Required | Long | The initial coordinates of the new object (in points) relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.
Width | Required | Long | The initial size of the new object, in points.
Height | Required | Long | The initial size of the new object, in points.

Return Value

Shape

Remarks

Use the AddOLEObject method or the Add method of the OLEObjects collection to create an ActiveX control.

Example

This example adds a list box to worksheet one and sets the fill range for the list box.

VBA Copy code Copy code
With Worksheets(1)
 Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
 lb.ControlFormat.ListFillRange = "A1:A10"
End With

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddLabel Method (Excel)

 Copy code hover
[image]

Shapes.AddLabel Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a label. Returns a Shape object that represents the new label.

Syntax

expression .AddLabel(Orientation, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoTextOrientation | The text orientation within the label.
Left | Required | Single | The position (in points) of the upper-left corner of the label relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the label relative to the top corner of the document.
Width | Required | Single | The width of the label, in points.
Height | Required | Single | The height of the label, in points.

Return Value

Shape

Example

This example adds a vertical label that contains the text "Test Label" to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddLabel(msoTextOrientationVertical, _
    100, 100, 60, 150) _
    .TextFrame.Characters.Text = "Test Label"

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddLine Method (Excel)

 Copy code hover
[image]

Shapes.AddLine Method (Excel)
See also Send feedback

Published: July 16, 2012

As it applies to the Shapes object, returns a Shape object that represents the new line in a worksheet.

Syntax

expression .AddLine(BeginX, BeginY, EndX, EndY)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
BeginX | Required | Single | The position (in points) of the line's starting point relative to the upper-left corner of the document.
BeginY | Required | Single | The position (in points) of the line's starting point relative to the upper-left corner of the document.
EndX | Required | Single | The position (in points) of the line's end point relative to the upper-left corner of the document.
EndY | Required | Single | The position (in points) of the line's end point relative to the upper-left corner of the document.

Return Value

Shape

Example

This example adds a blue dashed line to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddOLEObject Method (Excel)

 Copy code hover
[image]

Shapes.AddOLEObject Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates an OLE object. Returns a Shape object that represents the new OLE object.

Syntax

expression .AddOLEObject(ClassType, Filename, Link, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | (you must specify either ClassType or FileName). A string that contains the programmatic identifier for the object to be created. If ClassType is specified, FileName and Link are ignored.
Filename | Optional | Variant | The file from which the object is to be created. If the path isn't specified, the current working folder is used. You must specify either the ClassType or FileName argument for the object, but not both.
Link | Optional | Variant | True to link the OLE object to the file from which it was created. False to make the OLE object an independent copy of the file. If you specified a value for ClassType, this argument must be False. The default value is False.
DisplayAsIcon | Optional | Variant | True to display the OLE object as an icon. The default value is False.
IconFileName | Optional | Variant | The file that contains the icon to be displayed.
IconIndex | Optional | Variant | The index of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box (accessed from the Object dialog box when the Display as icon check box is selected). The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).
IconLabel | Optional | Variant | A label (caption) to be displayed beneath the icon.
Left | Optional | Variant | The position (in points) of the upper-left corner of the new object relative to the upper-left corner of the document. The default value is 0 (zero).
Top | Optional | Variant | The position (in points) of the upper-left corner of the new object relative to the upper-left corner of the document. The default value is 0 (zero).
Width | Optional | Variant | The initial dimensions of the OLE object, in points.
Height | Optional | Variant | The initial dimensions of the OLE object, in points.

Return Value

Shape

Example

This example adds a linked Word document to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddOLEObject Left:=100, Top:=100, _
 Width:=200, Height:=300, _
 FileName:="c:\my documents\testing.doc", link:=True

This example adds a new command button to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddOLEObject Left:=100, Top:=100, _
 Width:=100, Height:=200, _
 ClassType:="Forms.CommandButton.1"

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddPicture Method (Excel)

 Copy code hover
[image]

Shapes.AddPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a picture from an existing file. Returns a Shape object that represents the new picture.

Syntax

expression .AddPicture(Filename, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The file from which the OLE object is to be created.
LinkToFile | Required | MsoTriState | The file to link to.
SaveWithDocument | Required | MsoTriState | To save the picture with the document.
Left | Required | Single | The position (in points) of the upper-left corner of the picture relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the picture relative to the top of the document.
Width | Required | Single | The width of the picture, in points.
Height | Required | Single | The height of the picture, in points.

Return Value

Shape

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse To make the picture an independent copy of the file.

msoTriStateMixed

msoTriStateToggle

msoTrue To link the picture to the file from which it was created.

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse To store only the link information in the document.

msoTriStateMixed

msoTriStateToggle

msoTrue To save the linked picture with the document into which it's inserted. This argument must be msoTrue if LinkToFile is msoFalse.

Example

This example adds a picture created from the file Music.bmp to myDocument. The inserted picture is linked to the file from which it was created and is saved with myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddPicture _
    "c:\microsoft office\clipart\music.bmp", _
    True, True, 100, 100, 70, 70

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddPicture2 Method (Excel)

 Copy code hover
[image]

Shapes.AddPicture2 Method (Excel)
See also Send feedback

Creates a picture from an existing file. Returns a Shape object that represents the new picture.

Syntax

expression .AddPicture2(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height, compress)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file from which the OLE object is to be created.
LinkToFile | Required | MsoTriState | Determines whether the picture will be linked to the file from which it was created.
SaveWithDocument | Required | MsoTriState | Determines whether the linked picture will be saved with the document into which it is inserted. This argument must be msoTrue if LinkToFile is msoFalse.
Left | Required | Single | The position, measured in points, of the left edge of the picture relative to the left edge of the worksheet.
Top | Required | Single | The position, measured in points, of the top edge of the picture relative to the top edge of the worksheet.
Width | Optional | Single | The width of the picture, measured in points.
Height | Optional | Single | The height of the picture, measured in points.
compress | Optional | MsoPictureCompress | Determines whether the picture should be compressed when inserted.

Return Value

Shape

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddPolyline Method (Excel)

 Copy code hover
[image]

Shapes.AddPolyline Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates an open polyline or a closed polygon drawing. Returns a Shape object that represents the new polyline or polygon.

Syntax

expression .AddPolyline(SafeArrayOfPoints)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the polyline drawing's vertices.

Return Value

Shape

Remarks

To form a closed polygon, assign the same coordinates to the first and last vertices in the polyline drawing.

Example

This example adds a triangle to myDocument. Because the first and last points have the same coordinates, the polygon is closed and filled. The color of the triangle's interior will be the same as the default shape's fill color.

VBA Copy code Copy code
Dim triArray(1 To 4, 1 To 2) As Single
triArray(1, 1) = 25
triArray(1, 2) = 100
triArray(2, 1) = 100
triArray(2, 2) = 150
triArray(3, 1) = 150
triArray(3, 2) = 50
triArray(4, 1) = 25 ' Last point has same coordinates as first
triArray(4, 2) = 100
Set myDocument = Worksheets(1)
myDocument.Shapes.AddPolyline triArray

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddShape Method (Excel)

 Copy code hover
[image]

Shapes.AddShape Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the new AutoShape in a worksheet.

Syntax

expression .AddShape(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoAutoShapeType | Specifies the type of AutoShape to create.
Left | Required | Single | The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.
Width | Required | Single | The width of the AutoShape's bounding box, in points.
Height | Required | Single | The height of the AutoShape's bounding box, in points.

Return Value

Shape

Remarks

To change the type of an AutoShape that you've added, set the AutoShapeType property.

Example

This example adds a rectangle to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddSmartArt Method (Excel)

 Copy code hover
[image]

Shapes.AddSmartArt Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new SmartArt graphic with the specified layout.

Version Information

Version Added: Excel 2010

Syntax

expression .AddSmartArt(Layout, Left, Top, Width, Height)

expression A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Layout | Required | SmartArtLayout | An object that represents the layout to use.
Left | Optional | Variant | The distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Top | Optional | Variant | The distance, in points, from the top edge of the object to the top edge of the worksheet.
Width | Optional | Variant | The width, in points, of the object.
Height | Optional | Variant | The width, in points, of the object.

Return Value

Shape

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddTextbox Method (Excel)

 Copy code hover
[image]

Shapes.AddTextbox Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a text box. Returns a Shape object that represents the new text box.

Syntax

expression .AddTextbox(Orientation, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoTextOrientation | The orientation of the textbox.
Left | Required | Single | The position (in points) of the upper-left corner of the text box relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the text box relative to the top of the document.
Width | Required | Single | The width of the text box, in points.
Height | Required | Single | The height of the text box, in points.

Return Value

Shape

Example

This example adds a text box that contains the text "Test Box" to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
    100, 100, 200, 50) _
    .TextFrame.Characters.Text = "Test Box"

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.AddTextEffect Method (Excel)

 Copy code hover
[image]

Shapes.AddTextEffect Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a WordArt object. Returns a Shape object that represents the new WordArt object.

Syntax

expression .AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
PresetTextEffect | Required | MsoPresetTextEffect | The preset text effect.
Text | Required | String | The text in the WordArt.
FontName | Required | String | The name of the font used in the WordArt.
FontSize | Required | Single | The size (in points) of the font used in the WordArt.
FontBold | Required | MsoTriState | The font used in the WordArt to bold.
FontItalic | Required | MsoTriState | The font used in the WordArt to italic.
Left | Required | Single | The position (in points) of the upper-left corner of the WordArt's bounding box relative to the upper-left corner of the document.
Top | Required | Single | The position (in points) of the upper-left corner of the WordArt's bounding box relative to the top of the document.

Return Value

Shape

Remarks

When you add WordArt to a document, the height and width of the WordArt are automatically set based on the size and amount of text you specify.

Example

This example adds WordArt that contains the text "Test" to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
    PresetTextEffect:=msoTextEffect1, Text:="Test", _
    FontName:="Arial Black", FontSize:=36, _
    FontBold:=msoFalse, FontItalic:=msoFalse, Left:=10, _
    Top:=10)

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.BuildFreeform Method (Excel)

 Copy code hover
[image]

Shapes.BuildFreeform Method (Excel)
See also Send feedback

Published: July 16, 2012

Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.

Syntax

expression .BuildFreeform(EditingType, X1, Y1)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
EditingType | Required | MsoEditingType | The editing property of the first node.
X1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the upper-left corner of the document.
Y1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the upper-left corner of the document.

Return Value

FreeformBuilder

Example

This example adds a freeform with five vertices to myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
    .AddNodes msoSegmentCurve, msoEditingCorner, _
        380, 230, 400, 250, 450, 300
    .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
    .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
    .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
    .ConvertToShape
End With

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.Item Method (Excel)

 Copy code hover
[image]

Shapes.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Shape object contained by the collection.

Remarks

The text name of the object is the value of the Name property.

Example

This example sets the OnAction property for shape two in a Shapes collection. If the ss variable doesn't represent a Shapes object, this example fails.

VBA Copy code Copy code
Dim ss As Shape
ss.Item(2).OnAction = "ShapeAction"

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Shapes.SelectAll Method (Excel)

 Copy code hover
[image]

Shapes.SelectAll Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects all the shapes in the specified Shapes collection.

Version Information

Version Added: Excel 2007

Syntax

expression .SelectAll

expression A variable that represents a Shapes object.

Example

This example selects all the shapes on myDocument and creates a ShapeRange collection containing all the shapes.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
VBA Copy code Copy code
Set sr = Selection.ShapeRange

See also

Concepts

Shapes Object

Other resources

Shapes Object Members


Sheets Object (Excel)

 Copy code hover
[image]

Sheets Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the sheets in the specified or active workbook.

Remarks

The Sheets collection can contain Chart or Worksheet objects.

The Sheets collection is useful when you want to return sheets of any type. If you need to work with sheets of only one type, see the object topic for that sheet type.

Example

Use the Sheets property to return the Sheets collection. The following example prints all sheets in the active workbook.

VBA Copy code Copy code
Sheets.PrintOut

Use the Add method to create a new sheet and add it to the collection. The following example adds two chart sheets to the active workbook, placing them after sheet two in the workbook.

VBA Copy code Copy code
Sheets.Add type:=xlChart, count:=2, after:=Sheets(2)

Use Sheets(index), where index is the sheet name or index number, to return a single Chart or Worksheet object. The following example activates the sheet named "sheet1."

VBA Copy code Copy code
Sheets("sheet1").Activate

Use Sheets(array) to specify more than one sheet. The following example moves the sheets named "Sheet4" and "Sheet5" to the beginning of the workbook.

VBA Copy code Copy code
Sheets(Array("Sheet4", "Sheet5")).Move before:=Sheets(1)

See also

Concepts

Excel Object Model Reference

Other resources

Sheets Object Members


Sheets Members (Excel)

 Copy code hover
[image]

Sheets Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the sheets in the specified or active workbook.

Methods

Name | Description
Add | Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.
Add2 | This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
FillAcrossSheets | Copies a range to the same area on all other worksheets in a collection.
Move | Moves the sheet to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Sheets Properties (Excel)

 Copy code hover
[image]

Sheets Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Sheets.Application Property (Excel)

 Copy code hover
[image]

Sheets.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Sheets object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Count Property (Excel)

 Copy code hover
[image]

Sheets.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Sheets object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Creator Property (Excel)

 Copy code hover
[image]

Sheets.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Sheets object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.HPageBreaks Property (Excel)

 Copy code hover
[image]

Sheets.HPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.

Syntax

expression .HPageBreaks

expression A variable that represents a Sheets object.

Remarks

There is a limit of 1026 horizontal page breaks per sheet.

Example

This example displays the number of full-screen and print-area horizontal page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).HPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Item Property (Excel)

 Copy code hover
[image]

Sheets.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example activates Sheet1.

VBA Copy code Copy code
Sheets.Item("sheet1").Activate

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Parent Property (Excel)

 Copy code hover
[image]

Sheets.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Sheets object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Visible Property (Excel)

 Copy code hover
[image]

Sheets.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that determines whether the object is visible.

Syntax

expression .Visible

expression A variable that represents a Sheets object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.VPageBreaks Property (Excel)

 Copy code hover
[image]

Sheets.VPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.

Syntax

expression .VPageBreaks

expression A variable that represents a Sheets object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets Methods (Excel)

 Copy code hover
[image]

Sheets Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.
Add2 | This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
FillAcrossSheets | Copies a range to the same area on all other worksheets in a collection.
Move | Moves the sheet to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.


Sheets.Add Method (Excel)

 Copy code hover
[image]

Sheets.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.

Syntax

expression .Add(Before, After, Count, Type)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | An object that specifies the sheet before which the new sheet is added.
After | Optional | Variant | An object that specifies the sheet after which the new sheet is added.
Count | Optional | Variant | The number of sheets to be added. The default value is one.
Type | Optional | Variant | Specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. If you are inserting a sheet based on an existing template, specify the path to the template. The default value is xlWorksheet.

Return Value

An Object value that represents the new worksheet, chart, or macro sheet.

Remarks

If Before and After are both omitted, the new sheet is inserted before the active sheet.

Example

This example inserts a new worksheet before the last worksheet in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Sheets.Add Before:=Worksheets(Worksheets.Count)

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Add2 Method (Excel)

 Copy code hover
[image]

Sheets.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.

Version information

Version Added: Excel 2013

Syntax

expression .Add2(Before,After,Count,NewLayout)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data type | Description
Before | Optional | VARIANT | An object that specifies the sheet before which the new sheet is added.
After | Optional | VARIANT | An object that specifies the sheet after which the new sheet is added.
Count | Optional | VARIANT | The number of sheets to be added. The default value is one.
NewLayout | Optional | VARIANT |

Return value

OBJECT

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Copy Method (Excel)

 Copy code hover
[image]

Sheets.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the sheet to another location in the workbook.

Syntax

expression .Copy(Before, After)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the copied sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the copied sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.

Example

This example copies Sheet1, placing the copy after Sheet3.

VBA Copy code Copy code
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Delete Method (Excel)

 Copy code hover
[image]

Sheets.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Sheets object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.FillAcrossSheets Method (Excel)

 Copy code hover
[image]

Sheets.FillAcrossSheets Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies a range to the same area on all other worksheets in a collection.

Syntax

expression .FillAcrossSheets(Range, Type)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to fill on all the worksheets in the collection. The range must be from a worksheet within the collection.
Type | Optional | XlFillWith | Specifies how to copy the range.

Example

This example fills the range A1:C5 on Sheet1, Sheet5, and Sheet7 with the contents of the same range on Sheet1.

VBA Copy code Copy code
x = Array("Sheet1", "Sheet5", "Sheet7")
Sheets(x).FillAcrossSheets _
 Worksheets("Sheet1").Range("A1:C5")

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Move Method (Excel)

 Copy code hover
[image]

Sheets.Move Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the sheet to another location in the workbook.

Syntax

expression .Move(Before, After)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the moved sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the moved sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the moved sheet.

Example

This example moves Sheet1 after Sheet3 in the active workbook.

VBA Copy code Copy code
Worksheets("Sheet1").Move _
 after:=Worksheets("Sheet3")

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.PrintOut Method (Excel)

 Copy code hover
[image]

Sheets.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.
IgnorePrintAreas | Optional | Variant | True to ignore print areas and print the entire object.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.PrintPreview Method (Excel)

 Copy code hover
[image]

Sheets.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


Sheets.Select Method (Excel)

 Copy code hover
[image]

Sheets.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Sheets object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

See also

Concepts

Sheets Object

Other resources

Sheets Object Members


SheetViews Object (Excel)

 Copy code hover
[image]

SheetViews Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the sheet views in the specified or active workbook window.

Version Information

Version Added: Excel 2007

Example

The following example will return the view count of the active window.

VBA Copy code Copy code
ActiveWindow.SheetViews.Count

See also

Concepts

Excel Object Model Reference

Other resources

SheetViews Object Members


SheetViews Members (Excel)

 Copy code hover
[image]

SheetViews Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the sheet views in the specified or active workbook window.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SheetView object that represents views in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


SheetViews Properties (Excel)

 Copy code hover
[image]

SheetViews Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SheetView object that represents views in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


SheetViews.Application Property (Excel)

 Copy code hover
[image]

SheetViews.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a SheetViews object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

SheetViews Object

Other resources

SheetViews Object Members


SheetViews.Count Property (Excel)

 Copy code hover
[image]

SheetViews.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a SheetViews object.

See also

Concepts

SheetViews Object

Other resources

SheetViews Object Members


SheetViews.Creator Property (Excel)

 Copy code hover
[image]

SheetViews.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SheetViews object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SheetViews Object

Other resources

SheetViews Object Members


SheetViews.Item Property (Excel)

 Copy code hover
[image]

SheetViews.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SheetView object that represents views in a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a SheetViews object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the view.

See also

Concepts

SheetViews Object

Other resources

SheetViews Object Members


SheetViews.Parent Property (Excel)

 Copy code hover
[image]

SheetViews.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a SheetViews object.

See also

Concepts

SheetViews Object

Other resources

SheetViews Object Members


Slicer Object (Excel)

 Copy code hover
[image]

Slicer Object (Excel)
See also Send feedback

Represents a slicer in a workbook.

Version Information

Version Added: Excel 2010

Remarks

Each Slicer object represents a slicer in a workbook. Slicers are used to filter data in PivotTable reports or OLAP data sources.

Use the Add method to add a Slicer object to the Slicers collection. To access the SlicerItem object that represents the currently selected button in a slicer, use the ActiveItem property of the Slicer object.

Example

The following code example changes the caption for the first slicer in the first slicer cache to "My Slicer".

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches(1).Slicers(1).Caption = "My Slicer"

The following code example sets the width of the first slicer in the first slicer cache to equal 200 points.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches(1).Slicers(1).Width = 200

See also

Concepts

Excel Object Model Reference

Other resources

Slicer Object Members


Slicer Members (Excel)

 Copy code hover
[image]

Slicer Members (Excel)
Send feedback

Published: July 16, 2012

Represents a slicer in a workbook.

Methods

Name | Description
Copy | Copies the specified slicer to the clipboard.
Cut | Cuts the specified slicer and copies it to the clipboard.
Delete | Deletes the slicer and removes it from the associated Slicers collection.

Properties

Name | Description
ActiveItem | Returns a SlicerItem object that represents the slicer button that is currently in focus for the specified slicer. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns or sets the caption of the specified slicer. Read/write.
ColumnWidth | Returns or sets the width, in points, of each column in the slicer. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisableMoveResizeUI | Returns or sets whether the specified slicer can be moved or resized by using the user interface. Read/write.
DisplayHeader | Returns or sets whether the header that displays the slicer Caption is visible. Read/write.
Height | Returns or sets the height of the specified slicer, in points. Read/write.
Left | Returns or sets the horizontal position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.
Locked | Returns or sets whether the specified slicer can be modified when the sheet that contains it is protected. Read/write.
Name | Returns or sets the name of the specified slicer. Read/write.
NumberOfColumns | Returns or sets the number of columns in the specified slicer. Read/write.
Parent | Returns the Worksheet object that represents the sheet that contains the slicer. Read-only.
RowHeight | Returns or sets the height, in points, of each row in the specified slicer. Read/write.
Shape | Returns the Shape object associated with the specified slicer. Read-only.
SlicerCache | Returns the SlicerCache object associated with the slicer. Read-only.
SlicerCacheLevel | Returns the SlicerCacheLevel object associated with the slicer. Read-only.
SlicerCacheType | Returns the type of the slicer cache - slicer or timeline. XlSlicerCacheType Read-only
Style | Returns or sets the style currently applied to the specified slicer. Read/write.
TimelineViewState | The timeline-specific state of the Slicer. TimelineViewState Read-only
Top | Returns or sets the vertical position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.
Width | Returns or sets the width of the specified slicer, in points. Read/write.


Slicer Properties (Excel)

 Copy code hover
[image]

Slicer Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveItem | Returns a SlicerItem object that represents the slicer button that is currently in focus for the specified slicer. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns or sets the caption of the specified slicer. Read/write.
ColumnWidth | Returns or sets the width, in points, of each column in the slicer. Read/write
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisableMoveResizeUI | Returns or sets whether the specified slicer can be moved or resized by using the user interface. Read/write.
DisplayHeader | Returns or sets whether the header that displays the slicer Caption is visible. Read/write.
Height | Returns or sets the height of the specified slicer, in points. Read/write.
Left | Returns or sets the horizontal position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.
Locked | Returns or sets whether the specified slicer can be modified when the sheet that contains it is protected. Read/write.
Name | Returns or sets the name of the specified slicer. Read/write.
NumberOfColumns | Returns or sets the number of columns in the specified slicer. Read/write.
Parent | Returns the Worksheet object that represents the sheet that contains the slicer. Read-only.
RowHeight | Returns or sets the height, in points, of each row in the specified slicer. Read/write.
Shape | Returns the Shape object associated with the specified slicer. Read-only.
SlicerCache | Returns the SlicerCache object associated with the slicer. Read-only.
SlicerCacheLevel | Returns the SlicerCacheLevel object associated with the slicer. Read-only.
SlicerCacheType | Returns the type of the slicer cache - slicer or timeline. XlSlicerCacheType Read-only
Style | Returns or sets the style currently applied to the specified slicer. Read/write.
TimelineViewState | The timeline-specific state of the Slicer. TimelineViewState Read-only
Top | Returns or sets the vertical position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.
Width | Returns or sets the width of the specified slicer, in points. Read/write.


Slicer.ActiveItem Property (Excel)

 Copy code hover
[image]

Slicer.ActiveItem Property (Excel)
Send feedback

Published: July 16, 2012

Returns a SlicerItem object that represents the slicer button that is currently in focus for the specified slicer. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .ActiveItem

expression A variable that represents a Slicer object.

Return Value

SlicerItem

Remarks

The ActiveItem property will return a SlicerItem object when the specified slicer has focus and the active control is a button within the slicer (for example, the user can navigate the buttons within the slicer with the keyboard in this state).

The ActiveItem property will return Null under the following circumstances:

  • The specified slicer does not have focus (is not selected or active).

  • The specified slicer has focus and the whole slicer itself is selected (for example, the user can move the whole slicer around using the keyboard in this state).

  • The specified slicer has focus and the active control is the Clear Filter button in the header of the slicer.


Slicer.Application Property (Excel)

 Copy code hover
[image]

Slicer.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a Slicer object.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Caption Property (Excel)

 Copy code hover
[image]

Slicer.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the caption of the specified slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Caption

expression A variable that represents a Slicer object.

Return Value

String

Remarks

The value specified for the Caption property is displayed in the header of the slicer. If the Caption property is not specified, Excel uses the value of the Caption property of the underlying PivotField object.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.ColumnWidth Property (Excel)

 Copy code hover
[image]

Slicer.ColumnWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of each column in the slicer. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ColumnWidth

expression A variable that represents a Slicer object.

Return Value

Double

Remarks

The Width property of the Slicer object is automatically adjusted based on the value of the ColumnWidth property and the NumberOfColumns property.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Creator Property (Excel)

 Copy code hover
[image]

Slicer.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Slicer object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.DisableMoveResizeUI Property (Excel)

 Copy code hover
[image]

Slicer.DisableMoveResizeUI Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified slicer can be moved or resized by using the user interface. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .DisableMoveResizeUI

expression A variable that represents a Slicer object.

Return Value

Boolean

Remarks

True if the slicer cannot be moved or resized by selecting borders or handles in the user interface; otherwise False. The default value is False. Setting the DisableMoveResizeUI property to True affects only the user interface. Moving or resizing the slicer by setting properties such as the Top, Left, Width, or Height properties of the Slicer object from code is not disabled.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.DisplayHeader Property (Excel)

 Copy code hover
[image]

Slicer.DisplayHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the header that displays the slicer Caption is visible. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .DisplayHeader

expression A variable that represents a Slicer object.

Return Value

Boolean

Remarks

True if the header is visible; otherwise False. The default value is True.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Height Property (Excel)

 Copy code hover
[image]

Slicer.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified slicer, in points. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Height

expression A variable that represents a Slicer object.

Return Value

Double

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Left Property (Excel)

 Copy code hover
[image]

Slicer.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Left

expression A variable that represents a Slicer object.

Return Value

Double

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Locked Property (Excel)

 Copy code hover
[image]

Slicer.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified slicer can be modified when the sheet that contains it is protected. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Locked

expression A variable that represents a Slicer object.

Return Value

Boolean

Remarks

True if the slicer is locked when the sheet is protected. False if the slicer can be modified when the sheet is protected. The default value is True.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Name Property (Excel)

 Copy code hover
[image]

Slicer.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Name

expression A variable that represents a Slicer object.

Return Value

String

Remarks

The name must be unique across all slicers within a workbook. The default name uses the text the field name of the PivotField on which the slicer is based, and if necessary, appends a space and number to make the name unique.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.NumberOfColumns Property (Excel)

 Copy code hover
[image]

Slicer.NumberOfColumns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of columns in the specified slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .NumberOfColumns

expression A variable that represents a Slicer object.

Return Value

Long

Remarks

The default value is 1.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Parent Property (Excel)

 Copy code hover
[image]

Slicer.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Worksheet object that represents the sheet that contains the slicer. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a Slicer object.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.RowHeight Property (Excel)

 Copy code hover
[image]

Slicer.RowHeight Property (Excel)
Send feedback

Published: July 16, 2012

Returns or sets the height, in points, of each row in the specified slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .RowHeight

expression A variable that represents a Slicer object.

Return Value

Double

Remarks

This property does not affect the height of the slicer. Use the Height property of the Slicer object to return or set the height of the slicer.


Slicer.Shape Property (Excel)

 Copy code hover
[image]

Slicer.Shape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Shape object associated with the specified slicer. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Shape

expression A variable that represents a Slicer object.

Return Value

Shape

Remarks

Some properties of the slicer, such as the AlternativeText property, can only be accessed from the Shape object associated with the slicer.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.SlicerCache Property (Excel)

 Copy code hover
[image]

Slicer.SlicerCache Property (Excel)
See also Send feedback

Returns the SlicerCache object associated with the slicer. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerCache

expression A variable that represents a Slicer object.

Return Value

SlicerCache

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.SlicerCacheLevel Property (Excel)

 Copy code hover
[image]

Slicer.SlicerCacheLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SlicerCacheLevel object associated with the slicer. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerCacheLevel

expression A variable that represents a Slicer object.

Return Value

SlicerCacheLevel

Remarks

This property only applies to OLAP data sources.

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.SlicerCacheType Property (Excel)

 Copy code hover
[image]

Slicer.SlicerCacheType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the slicer cache - slicer or timeline. XlSlicerCacheType Read-only

Version information

Version Added: Excel 2013

Syntax

expression .SlicerCacheType

expression A variable that represents a Slicer object.

Property value

XLSLICERCACHETYPE

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Style Property (Excel)

 Copy code hover
[image]

Slicer.Style Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the style currently applied to the specified slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Style

expression A variable that represents a Slicer object.

Return Value

Variant

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.TimelineViewState Property (Excel)

 Copy code hover
[image]

Slicer.TimelineViewState Property (Excel)
See also Send feedback

Published: July 16, 2012

The timeline-specific state of the Slicer. TimelineViewState Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TimelineViewState

expression A variable that represents a Slicer object.

Property value

TIMELINEVIEWSTATE

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Top Property (Excel)

 Copy code hover
[image]

Slicer.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Top

expression A variable that represents a Slicer object.

Return Value

Double

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Width Property (Excel)

 Copy code hover
[image]

Slicer.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the specified slicer, in points. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Width

expression A variable that represents a Slicer object.

Return Value

Double

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer Methods (Excel)

 Copy code hover
[image]

Slicer Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified slicer to the clipboard.
Cut | Cuts the specified slicer and copies it to the clipboard.
Delete | Deletes the slicer and removes it from the associated Slicers collection.


Slicer.Copy Method (Excel)

 Copy code hover
[image]

Slicer.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the specified slicer to the clipboard.

Version Information

Version Added: Excel 2010

Syntax

expression .Copy

expression A variable that represents a Slicer object.

Example

The following code example accesses the Customer slicer by using the Range property of the Shapes collection, and then copies and pastes it into the active worksheet.

VBA Copy code Copy code
ActiveSheet.Shapes.Range(Array("Customer")).Select
Selection.Copy
ActiveSheet.Paste

Alternatively, you can perform the same operation by using the Slicers property of the SlicerCaches collection to access the slicer, as shown in the following code example.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Customer") _
 .Slicers("Customer").Copy
ActiveSheet.Paste

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Cut Method (Excel)

 Copy code hover
[image]

Slicer.Cut Method (Excel)
See also Send feedback

Published: July 16, 2012

Cuts the specified slicer and copies it to the clipboard.

Version Information

Version Added: Excel 2010

Syntax

expression .Cut

expression A variable that represents a Slicer object.

Example

The following code example accesses the Customer slicer by using the Range property of the Shapes collection, and then cuts and pastes it into the active worksheet.

VBA Copy code Copy code
ActiveSheet.Shapes.Range(Array("Customer")).Select
Selection.Cut
ActiveSheet.Paste

Alternatively, you can perform the same operation by using the Slicers property of the SlicerCaches collection to access the slicer, as shown in the following code example.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Customer") _
 .Slicers("Customer").Cut
ActiveSheet.Paste

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


Slicer.Delete Method (Excel)

 Copy code hover
[image]

Slicer.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the slicer and removes it from the associated Slicers collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Delete

expression A variable that represents a Slicer object.

Return Value

Nothing

See also

Concepts

Slicer Object

Other resources

Slicer Object Members


SlicerCache Object (Excel)

 Copy code hover
[image]

SlicerCache Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the current filter state for a slicer and information about which PivotCache or WorkbookConnection the slicer is connected to.

Version Information

Version Added: Excel 2010

Remarks

Use the SlicerCaches property of the Workbook object to access the collection of SlicerCache objects in a workbook.

Each slicer has a base SlicerCache object which represents the items displayed in the slicer and the current user interface state of the tiles displayed with their corresponding item captions. Each slicer control that the user sees in Excel is represented by a Slicer object that has a SlicerCache object associated with it.

Example

The following code example creates a SlicerCache object based on the Customer Geography OLAP hierarchy from the connection to the AdventureWorks database, and then creates a slicer on the Country level of that hierarchy in Sheet2 of the workbook.

VBA Copy code Copy code
With ActiveWorkbook
 .SlicerCaches.Add("AdventureWorks", _
 "[Customer].[Customer Geography]").Slicers.Add SlicerDestination:="Sheet2", _
 Level:="[Customer].[Customer Geography].[Country]", Caption:="Country"
End With

See also

Concepts

Excel Object Model Reference

Other resources

SlicerCache Object Members


SlicerCache Members (Excel)

 Copy code hover
[image]

SlicerCache Members (Excel)
Send feedback

Published: July 16, 2012

Represents the current filter state for a slicer and information about which PivotCache or WorkbookConnection the slicer is connected to.

Methods

Name | Description
ClearAllFilters | Clears the filter for either slicer or timeline, depending on the slicer cache type.
ClearDateFilter | Clears the filter for a timeline (date filter).
ClearManualFilter | Clears the manual filter for the slicer cache.
Delete | Deletes the specified slicer cache and the slicers associated with it.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CrossFilterType | Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write
FilterCleared | Returns whether the slicer or timeline filter state is cleared. Boolean. Read-only
Index | Returns the index of the specified SlicerCache object in the SlicerCaches collection. Read-only
List | True if the slicer cache is for a slicer on a table. False otherwise. Boolean Read-only
ListObject | Returns a ListObject object for the QueryTable Object (Excel) object. Read-only
Name | Returns or sets the name of the slicer cache.
OLAP | Returns whether the slicer associated with the specified slicer cache is based on an OLAP data source. Read-only
Parent | Returns the parent SlicerCaches object for the specified SlicerCache object. Read-only.
PivotTables | Returns a SlicerPivotTables collection that contains information about the PivotTables the slicer cache is currently filtering. Read-only
RequireManualUpdate | True when manual updates of the slicer cache required. Boolean Read/Write
ShowAllItems | Returns or sets whether slicers connected to the specified slicer cache display items that have been deleted from in the corresponding PivotCache. Read/write
SlicerCacheLevels | Returns the collection of SlicerCacheLevel objects that represent the levels of an OLAP hierarchy on which the specified slicer cache is based. Read-only
SlicerCacheType | Returns the type of the slicer cache - slicer or timeline. Read-only
SlicerItems | Returns a SlicerItems collection that contains the collection of all items in the slicer cache. Read-only
Slicers | Returns a Slicers collection that contains the collection of Slicer objects associated with the specified SlicerCache. Read-only
SortItems | Returns or sets the sort order of the items in the slicer. Read/write XlSlicerSort.
SortUsingCustomLists | Returns or sets whether items in the specified slicer cache will be sorted by the custom lists. Read/write
SourceName | Returns the name of the data source the slicer is connected to. Read-only
SourceType | Returns the kind of data source the slicer is connected to. Read-only
TimelineState | The timeline-specific state of the SlicerCache object. Read-only
VisibleSlicerItems | Returns a SlicerItems collection that contains the collection of all the visible items in the specified slicer cache. Read-only
VisibleSlicerItemsList | Returns or sets the list of MDX unique names for members at all levels of the hierarchy where manual filtering is applied. Read/write
WorkbookConnection | Gets or sets the WorkbookConnection object that represents the data connection used by the specified slicer. Read/Write.


SlicerCache Properties (Excel)

 Copy code hover
[image]

SlicerCache Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CrossFilterType | Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write
FilterCleared | Returns whether the slicer or timeline filter state is cleared. Boolean. Read-only
Index | Returns the index of the specified SlicerCache object in the SlicerCaches collection. Read-only
List | True if the slicer cache is for a slicer on a table. False otherwise. Boolean Read-only
ListObject | Returns a ListObject object for the QueryTable Object (Excel) object. Read-only
Name | Returns or sets the name of the slicer cache.
OLAP | Returns whether the slicer associated with the specified slicer cache is based on an OLAP data source. Read-only
Parent | Returns the parent SlicerCaches object for the specified SlicerCache object. Read-only.
PivotTables | Returns a SlicerPivotTables collection that contains information about the PivotTables the slicer cache is currently filtering. Read-only
RequireManualUpdate | True when manual updates of the slicer cache required. Boolean Read/Write
ShowAllItems | Returns or sets whether slicers connected to the specified slicer cache display items that have been deleted from in the corresponding PivotCache. Read/write
SlicerCacheLevels | Returns the collection of SlicerCacheLevel objects that represent the levels of an OLAP hierarchy on which the specified slicer cache is based. Read-only
SlicerCacheType | Returns the type of the slicer cache - slicer or timeline. Read-only
SlicerItems | Returns a SlicerItems collection that contains the collection of all items in the slicer cache. Read-only
Slicers | Returns a Slicers collection that contains the collection of Slicer objects associated with the specified SlicerCache. Read-only
SortItems | Returns or sets the sort order of the items in the slicer. Read/write XlSlicerSort.
SortUsingCustomLists | Returns or sets whether items in the specified slicer cache will be sorted by the custom lists. Read/write
SourceName | Returns the name of the data source the slicer is connected to. Read-only
SourceType | Returns the kind of data source the slicer is connected to. Read-only
TimelineState | The timeline-specific state of the SlicerCache object. Read-only
VisibleSlicerItems | Returns a SlicerItems collection that contains the collection of all the visible items in the specified slicer cache. Read-only
VisibleSlicerItemsList | Returns or sets the list of MDX unique names for members at all levels of the hierarchy where manual filtering is applied. Read/write
WorkbookConnection | Gets or sets the WorkbookConnection object that represents the data connection used by the specified slicer. Read/Write.


SlicerCache.Application Property (Excel)

 Copy code hover
[image]

SlicerCache.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerCache object.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Creator Property (Excel)

 Copy code hover
[image]

SlicerCache.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SlicerCache object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.CrossFilterType Property (Excel)

 Copy code hover
[image]

SlicerCache.CrossFilterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .CrossFilterType

expression A variable that represents a SlicerCache object.

Return Value

XlSlicerCrossFilterType

Remarks

If more than one slicer is associated with the same PivotTable, by default, if the item or items you filter by in one slicer have no corresponding data in another slicer, those items will be grayed out. For example, if you have Country slicer and a State slicer, and you click a country in the Country slicer, all states that are not in that country will be grayed out. This feature is referred to as "cross filtering".

The user interface settings that correspond to the setting of the CrossFilterType property are the Visually indicate items with no data and Show items with no data last check boxes in the Slicer Settings dialog box. Setting the CrossFilterType property to xlSlicerCrossFilterShowItemsWithDataAtTop corresponds to selecting both the Visually indicate items with no data and Show items with no data last check boxes. Setting the CrossFilterType property to xlSlicerCrossFilterShowItemsWithNoData corresponds to selecting only the Visually indicate items with no data check box. Clearing both check boxes corresponds to setting the CrossFilterType property to xlSlicerNoCrossFilter.

OLAP data sources (SlicerCache.OLAP = True) are not supported by the CrossFilterType property of the SlicerCache object. For OLAP data sources, use the CrossFilterType property of the SlicerCacheLevel object, instead.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.FilterCleared Property (Excel)

 Copy code hover
[image]

SlicerCache.FilterCleared Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the slicer or timeline filter state is cleared. Boolean. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .FilterCleared

expression A variable that represents a SlicerCache Object (Excel) object.

Property value

BOOL

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Index Property (Excel)

 Copy code hover
[image]

SlicerCache.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the index of the specified SlicerCache object in the SlicerCaches collection. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Index

expression A variable that represents a SlicerCache object.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.List Property (Excel)

 Copy code hover
[image]

SlicerCache.List Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the slicer cache is for a slicer on a table. False otherwise. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .List

expression A variable that represents a SlicerCache object.

Property value

BOOL

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.ListObject Property (Excel)

 Copy code hover
[image]

SlicerCache.ListObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListObject object for the QueryTable Object (Excel) object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ListObject

expression A variable that represents a SlicerCache Object (Excel) object.

Property value

LISTOBJECT

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Name Property (Excel)

 Copy code hover
[image]

SlicerCache.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the slicer cache.

Version Information

Version Added: Excel 2010

Syntax

expression .Name

expression A variable that returns a SlicerCache object.

Return Value

String

Remarks

Name of the slicer cache must be unique within the workbook namespace. By default, the name assigned to a slicer cache is Slicer_ followed by the name of the PivotTable field the slicer cache is associated with. For example, if slicer is associated with the Product Category field in the PivotTable, the default name will be Slicer_Product_Category (any spaces in the field name are replaced with underscore characters). If there is more than one Product Category field in the same workbook with a slicer associated with it, or some other named entity in the workbook with the name Slicer_Product_Category, Excel will append a number after the name to produce a unique name, such as Slicer_Product_Category1

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.OLAP Property (Excel)

 Copy code hover
[image]

SlicerCache.OLAP Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the slicer associated with the specified slicer cache is based on an OLAP data source. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .OLAP

expression A variable that represents a SlicerCache object.

Return Value

Boolean

Remarks

True, if the slicer is based on an OLAP data source; otherwise False.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Parent Property (Excel)

 Copy code hover
[image]

SlicerCache.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SlicerCaches object for the specified SlicerCache object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerCache object.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.PivotTables Property (Excel)

 Copy code hover
[image]

SlicerCache.PivotTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SlicerPivotTables collection that contains information about the PivotTables the slicer cache is currently filtering. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTables

expression A variable that represents a SlicerCache object.

Return Value

PivotTables

Remarks

The SlicerPivotTables collection returned by the PivotTables property will be empty if the slicer associated with the specified SlicerCache is not connected to any PivotTables.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.RequireManualUpdate Property (Excel)

 Copy code hover
[image]

SlicerCache.RequireManualUpdate Property (Excel)
See also Send feedback

Published: July 16, 2012

True when manual updates of the slicer cache required. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .RequireManualUpdate

expression A variable that represents a SlicerCache object.

Property value

BOOL

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.ShowAllItems Property (Excel)

 Copy code hover
[image]

SlicerCache.ShowAllItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether slicers connected to the specified slicer cache display items that have been deleted from in the corresponding PivotCache. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowAllItems

expression A variable that represents a SlicerCache object.

Return Value

Boolean

Remarks

When the ShowAllItems property is set to True (the default), items that have been deleted from the source data are displayed in the slicers connected to the specified slicer cache. The ShowAllItems property corresponds to the setting of the Show items deleted from the data source check box in the Slicer Settings dialog box.

The ShowAllItems property applies only to slicers that are based on workbook ranges or lists (SlicerCache.SourceType = xlDatabase), or to slicers that are based on relational data sources (SlicerCache.SourceType = xlExternal and SlicerCache.OLAP = False). Attempting to set the ShowAllItems property for slicers that are connected to PivotTables based on external OLAP data sources (SlicerCache.OLAP = True) generates a run-time error.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SlicerCacheLevels Property (Excel)

 Copy code hover
[image]

SlicerCache.SlicerCacheLevels Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the collection of SlicerCacheLevel objects that represent the levels of an OLAP hierarchy on which the specified slicer cache is based. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerCacheLevels

expression A variable that represents a SlicerCache object.

Remarks

The SlicerCacheLevels property applies only to slicers that filter OLAP data sources (SlicerCache.OLAP = True). Attempting to access this property from non-OLAP slicers will generate a run-time error.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SlicerCacheType Property (Excel)

 Copy code hover
[image]

SlicerCache.SlicerCacheType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the slicer cache - slicer or timeline. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .SlicerCacheType

expression A variable that represents a SlicerCache Object (Excel) object.

Returns

XlSlicerCacheType Enumeration (Excel)

Property value

XLSLICERCACHETYPE

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SlicerItems Property (Excel)

 Copy code hover
[image]

SlicerCache.SlicerItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SlicerItems collection that contains the collection of all items in the slicer cache. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerItems

expression A variable that represents a SlicerCache object.

Return Value

SlicerItems

Remarks

The SlicerItems property of the SlicerCache object is only applicable for slicers that are based on PivotTables based on workbook ranges or lists (SlicerCache.SourceType = xlDatabase), or for slicers that are based on PivotTables based on relational data sources (SlicerCache.SourceType = xlExternal and SlicerCache.OLAP = False). Attempting to access the SlicerItems property for slicers that are connected to an external OLAP data source (SlicerCache.OLAP = True) generates a run-time error. For OLAP data sources, use the SlicerItems property of the SlicerCacheLevel object instead.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Slicers Property (Excel)

 Copy code hover
[image]

SlicerCache.Slicers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Slicers collection that contains the collection of Slicer objects associated with the specified SlicerCache. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Slicers

expression A variable that represents a SlicerCache object.

Return Value

Slicers

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SortItems Property (Excel)

 Copy code hover
[image]

SlicerCache.SortItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the sort order of the items in the slicer. Read/write XlSlicerSort.

Version Information

Version Added: Excel 2010

Syntax

expression .SortItems

expression A variable that represents a SlicerCache object.

Return Value

XlSlicerSort

Remarks

The default setting of this property is xlSlicerSortAscending.

The SortItems property of the SlicerCache object only applies to slicers that are based on PivotTables that are connected to workbook ranges or lists (SlicerCache.SourceType = xlDatabase). Attempting to access the SortItems property for slicers that are connected to a OLAP data sources (SlicerCache.OLAP = True) generates a run-time error. For OLAP data sources, use the SortItems property of the SlicerCacheLevel object instead.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SortUsingCustomLists Property (Excel)

 Copy code hover
[image]

SlicerCache.SortUsingCustomLists Property (Excel)
See also Send feedback

Returns or sets whether items in the specified slicer cache will be sorted by the custom lists. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .SortUsingCustomLists

expression A variable that represents a SlicerCache object.

Remarks

The SortUsingCustomLists property corresponds to the setting of the Use Custom Lists when sorting check box of the Slicer Settings dialog box. To access the custom lists associated with the current installation of Excel, click the File tab, click Options, click Advanced, and then click Edit Custom Lists under the General category.

The SortUsingCustomLists property only applies to slicers that are filtering non-OLAP data sources. Attempting to access this property from a slicer cache that is filtering an OLAP data source (SlicerCache.OLAP = True) generates a run-time error.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SourceName Property (Excel)

 Copy code hover
[image]

SlicerCache.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the data source the slicer is connected to. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SourceName

expression A variable that represents a SlicerCache object.

Return Value

String

Remarks

For slicers based on data in the workbook (SlicerCache.SourceType = xlDatabase), or slicers based on non-OLAP external data (SlicerCache.SourceType = xlExternal and SlicerCache.OLAP = False), returns the name of the corresponding column in the source data.

For OLAP slicers (SlicerCache.OLAP = True), returns the MDX unique name of the hierarchy the slicer is based on.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.SourceType Property (Excel)

 Copy code hover
[image]

SlicerCache.SourceType Property (Excel)
See also Send feedback

Returns the kind of data source the slicer is connected to. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SourceType

expression A variable that represents a SlicerCache object.

Return Value

XlPivotTableSourceType

Remarks

Only the xlDatabase and xlExternal data source types are supported.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.TimelineState Property (Excel)

 Copy code hover
[image]

SlicerCache.TimelineState Property (Excel)
See also Send feedback

Published: July 16, 2012

The timeline-specific state of the SlicerCache object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TimelineState

expression A variable that represents a SlicerCache Object (Excel) object.

Returns

TimelineState Object (Excel)

Property value

TIMELINESTATE

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.VisibleSlicerItems Property (Excel)

 Copy code hover
[image]

SlicerCache.VisibleSlicerItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SlicerItems collection that contains the collection of all the visible items in the specified slicer cache. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .VisibleSlicerItems

expression A variable that represents a SlicerCache object.

Return Value

SlicerItems

Remarks

The VisibleSlicerItems property is only applicable for slicers that are based on PivotTables based on workbook ranges or lists (SlicerCache.SourceType = xlDatabase). Attempting to access the VisibleSlicerItems property for slicers that are connected to an OLAP data source (SlicerCache.OLAP = True) generates a run-time error.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.VisibleSlicerItemsList Property (Excel)

 Copy code hover
[image]

SlicerCache.VisibleSlicerItemsList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the list of MDX unique names for members at all levels of the hierarchy where manual filtering is applied. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .VisibleSlicerItemsList

expression A variable that represents a SlicerCache object.

Return Value

Variant

Remarks

The VisibleSlicerItemsList property is only applicable for slicers that are based on OLAP data sources (SlicerCache.OLAP = True).

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.WorkbookConnection Property (Excel)

 Copy code hover
[image]

SlicerCache.WorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the WorkbookConnection object that represents the data connection used by the specified slicer. Read/Write.

Version Information

Version Added: Excel 2010

Syntax

expression .WorkbookConnection

expression A variable that represents a SlicerCache object.

Return Value

WorkbookConnection

Remarks

The WorkbookConnection property only applies to slicers that are based on external data sources (SlicerCache.SourceType = xlExternal). Attempting to access the WorkbookConnection property for slicers that are connected to PivotTables based on workbook ranges or lists (SlicerCache.SourceType = xlDatabase) generates a run-time error.

The workbook connection value must be unique. Setting the workbook connection to a value that already exists generates a run-time error.

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache Methods (Excel)

 Copy code hover
[image]

SlicerCache Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearAllFilters | Clears the filter for either slicer or timeline, depending on the slicer cache type.
ClearDateFilter | Clears the filter for a timeline (date filter).
ClearManualFilter | Clears the manual filter for the slicer cache.
Delete | Deletes the specified slicer cache and the slicers associated with it.


SlicerCache.ClearAllFilters Method (Excel)

 Copy code hover
[image]

SlicerCache.ClearAllFilters Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the filter for either slicer or timeline, depending on the slicer cache type.

Version information

Version Added: Excel 2013

Syntax

expression .ClearAllFilters

expression A variable that represents a SlicerCache Object (Excel) object.

Return value

VOID

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.ClearDateFilter Method (Excel)

 Copy code hover
[image]

SlicerCache.ClearDateFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the filter for a timeline (date filter).

Version information

Version Added: Excel 2013

Syntax

expression .ClearDateFilter

expression A variable that represents a SlicerCache Object (Excel) object.

Return value

VOID

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.ClearManualFilter Method (Excel)

 Copy code hover
[image]

SlicerCache.ClearManualFilter Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the manual filter for the slicer cache.

Version information

Version Added: Excel 2013

Syntax

expression .ClearManualFilter

expression A variable that represents a SlicerCache object.

Return value

VOID

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCache.Delete Method (Excel)

 Copy code hover
[image]

SlicerCache.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified slicer cache and the slicers associated with it.

Version Information

Version Added: Excel 2010

Syntax

expression .Delete

expression A variable that represents a SlicerCache object.

Remarks

To delete a particular slicer independently of the slicer cache, use the Delete method of the Slicer object instead.

Example

The following code example deletes the Slicer_Country slicer cache and the Country slicer associated with that slicer cache.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Country").Delete

See also

Concepts

SlicerCache Object

Other resources

SlicerCache Object Members


SlicerCacheLevel Object (Excel)

 Copy code hover
[image]

SlicerCacheLevel Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a level of a hierarchy in an OLAP data source being filtered by a slicer.

Version Information

Version Added: Excel 2010

Remarks

When a slicer is used to filter an OLAP data source, the slicer cache it is associated with can contain multiple hierarchy levels from the data source. Use the SlicerCacheLevels collection of the parent SlicerCache object to access the SlicerCacheLevel objects that represent these hierarchy levels.

See also

Concepts

Excel Object Model Reference

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel Members (Excel)

 Copy code hover
[image]

SlicerCacheLevel Members (Excel)
Send feedback

Published: July 16, 2012

Represents a level of a hierarchy in an OLAP data source being filtered by a slicer.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of SlicerItem objects in the specified SlicerCacheLevel object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CrossFilterType | Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write
Name | Returns the MDX unique name of OLAP hierarchy level represented by the object.
Ordinal | Returns the one-based ordinal value of the hierarchy level represented by the specified SlicerCacheLevel object. Read-only
Parent | Returns the SlicerCache object for the specified SlicerCacheLevel object. Read-only.
SlicerItems | Returns a SlicerItems collection that contains the collection of all slicer items for the specified level. Read-only
SortItems | Returns or sets the sort order of the items in the slicer. Read/write.
VisibleSlicerItemsList | Returns the list of slicer items that are currently included in the slicer filter. Read-only


SlicerCacheLevel Properties (Excel)

 Copy code hover
[image]

SlicerCacheLevel Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of SlicerItem objects in the specified SlicerCacheLevel object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CrossFilterType | Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write
Name | Returns the MDX unique name of OLAP hierarchy level represented by the object.
Ordinal | Returns the one-based ordinal value of the hierarchy level represented by the specified SlicerCacheLevel object. Read-only
Parent | Returns the SlicerCache object for the specified SlicerCacheLevel object. Read-only.
SlicerItems | Returns a SlicerItems collection that contains the collection of all slicer items for the specified level. Read-only
SortItems | Returns or sets the sort order of the items in the slicer. Read/write.
VisibleSlicerItemsList | Returns the list of slicer items that are currently included in the slicer filter. Read-only


SlicerCacheLevel.Application Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerCacheLevel object.

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.Count Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of SlicerItem objects in the specified SlicerCacheLevel object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a SlicerCacheLevel object.

Return Value

Long

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.Creator Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version Information

Version Added: Excel 2010

Syntax

expression .Creator

expression A variable that represents a SlicerCacheLevel object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.CrossFilterType Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.CrossFilterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .CrossFilterType

expression A variable that represents a SlicerCacheLevel object.

Return Value

XlSlicerCrossFilterType

Remarks

If more than one slicer is associated with the same PivotTable, by default, if the item or items you filter by in one slicer have no corresponding data in another slicer, those items will be dimmed. For example, if you have Country slicer and a State slicer, and you click a country in the Country slicer, all states in the State slicer that are not in that country will be dimmed. This feature is referred to as "cross filtering."

The user interface settings that correspond to the setting of the CrossFilterType property are the Visually indicate items with no data and Show items with no data last check boxes in the Slicer Settings dialog box. Setting the CrossFilterType property to xlSlicerCrossFilterShowItemsWithDataAtTop corresponds to selecting both the Visually indicate items with no data and Show items with no data last check boxes. Setting the CrossFilterType property to xlSlicerCrossFilterShowItemsWithNoData corresponds to selecting only the Visually indicate items with no data check box. Clearing both check boxes corresponds to setting the CrossFilterType property to xlSlicerNoCrossFilter.

Slicers filtering non-OLAP data sources (SlicerCache.OLAP = False) are not supported by the CrossFilterType property of the SlicerCacheLevel object. For slicers filtering PivotTables based on ranges, lists, and non-OLAP relational data sources, use the CrossFilterType property of the SlicerCache object, instead.

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.Name Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the MDX unique name of OLAP hierarchy level represented by the object.

Version Information

Version Added: Excel 2010

Syntax

expression .Name

expression A variable that returns a SlicerCacheLevel object.

Return Value

String

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.Ordinal Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Ordinal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the one-based ordinal value of the hierarchy level represented by the specified SlicerCacheLevel object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Ordinal

expression A variable that represents a SlicerCacheLevel object.

Return Value

Long

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.Parent Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SlicerCache object for the specified SlicerCacheLevel object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerCacheLevel object.

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.SlicerItems Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.SlicerItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SlicerItems collection that contains the collection of all slicer items for the specified level. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerItems

expression A variable that represents a SlicerCacheLevel object.

Return Value

SlicerItems

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.SortItems Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.SortItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the sort order of the items in the slicer. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .SortItems

expression A variable that represents a SlicerCacheLevel object.

Return Value

XlSlicerSort

Remarks

The default setting of this property is xlDataSourceOrder (1).

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevel.VisibleSlicerItemsList Property (Excel)

 Copy code hover
[image]

SlicerCacheLevel.VisibleSlicerItemsList Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the list of slicer items that are currently included in the slicer filter. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .VisibleSlicerItemsList

expression A variable that represents a SlicerCacheLevel object.

Return Value

Variant

Remarks

The list of slicer items are returned as MDX unique name strings. If this list is empty, the slicer is not filtering the data source and all slicer tiles are displayed as selected.

See also

Concepts

SlicerCacheLevel Object

Other resources

SlicerCacheLevel Object Members


SlicerCacheLevels Object (Excel)

 Copy code hover
[image]

SlicerCacheLevels Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of hierarchy levels for the OLAP data source that is filtered by a slicer.

Version Information

Version Added: Excel 2010

Remarks

When a slicer is used to filter an OLAP data source, its parent slicer cache can contain multiple hierarchy levels from the data source. Use the SlicerCacheLevels collection of the parent SlicerCache object to access the SlicerCacheLevel objects that represent these hierarchy levels. This collection is not accessible for non-OLAP data sources.

Example

The following code example retrieves a SlicerCacheLevel object that represents the Country level of the Customer Geography hierarchy from the SlicerCacheLevel collection of the Country slicer.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Customer_Geography"). _
 SlicerCacheLevels("[Customer].[Customer Geography].[Country]")

See also

Concepts

Excel Object Model Reference

Other resources

SlicerCacheLevels Object Members


SlicerCacheLevels Members (Excel)

 Copy code hover
[image]

SlicerCacheLevels Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of hierarchy levels for the OLAP data source that is filtered by a slicer.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of levels in the specified SlicerCacheLevels collection, which represents the number of levels in the associated SlicerCache object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns the specified SlicerCacheLevel object from the collection, or if no level is specified, returns the first SlicerCacheLevel object in the collection.
Parent | Returns the SlicerCache object that is the parent of the specified SlicerCacheLevels object. Read-only.


SlicerCacheLevels Properties (Excel)

 Copy code hover
[image]

SlicerCacheLevels Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of levels in the specified SlicerCacheLevels collection, which represents the number of levels in the associated SlicerCache object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns the specified SlicerCacheLevel object from the collection, or if no level is specified, returns the first SlicerCacheLevel object in the collection.
Parent | Returns the SlicerCache object that is the parent of the specified SlicerCacheLevels object. Read-only.


SlicerCacheLevels.Application Property (Excel)

 Copy code hover
[image]

SlicerCacheLevels.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerCacheLevels object.

See also

Concepts

SlicerCacheLevels Object

Other resources

SlicerCacheLevels Object Members


SlicerCacheLevels.Count Property (Excel)

 Copy code hover
[image]

SlicerCacheLevels.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of levels in the specified SlicerCacheLevels collection, which represents the number of levels in the associated SlicerCache object.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a SlicerCacheLevels object.

Return Value

Long

See also

Concepts

SlicerCacheLevels Object

Other resources

SlicerCacheLevels Object Members


SlicerCacheLevels.Creator Property (Excel)

 Copy code hover
[image]

SlicerCacheLevels.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SlicerCacheLevels object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerCacheLevels Object

Other resources

SlicerCacheLevels Object Members


SlicerCacheLevels.Item Property (Excel)

 Copy code hover
[image]

SlicerCacheLevels.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the specified SlicerCacheLevel object from the collection, or if no level is specified, returns the first SlicerCacheLevel object in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Level)

expression A variable that returns a SlicerCacheLevels object.

Parameters

Name | Required/Optional | Data Type | Description
Level | Optional | Variant | The MDX unique name of the level or index number of the object.

Example

The following example retrieves a SlicerCacheLevel object that represents the Country level of the Customer Geography hierarchy from the SlicerCacheLevel collection of the Country slicer.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Country"). _
 SlicerCacheLevels("[Customer].[Customer Geography].[Country]")

See also

Concepts

SlicerCacheLevels Object

Other resources

SlicerCacheLevels Object Members


SlicerCacheLevels.Parent Property (Excel)

 Copy code hover
[image]

SlicerCacheLevels.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SlicerCache object that is the parent of the specified SlicerCacheLevels object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerCacheLevels object.

See also

Concepts

SlicerCacheLevels Object

Other resources

SlicerCacheLevels Object Members


SlicerCaches Object (Excel)

 Copy code hover
[image]

SlicerCaches Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of slicer caches associated with the specified workbook.

Version Information

Version Added: Excel 2010

Remarks

Use the Item property of the SlicerCaches collection to return a SlicerCache object associated with the specified Workbook object. A SlicerCache object can be retrieved by using either the value of the Index property or the Name property of the specified object.

Example

The following code example retrieves the SlicerCache object that represents the slicer cache associated with the Country slicer.

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches("Slicer_Country")

See also

Concepts

Excel Object Model Reference

Other resources

SlicerCaches Object Members


SlicerCaches Members (Excel)

 Copy code hover
[image]

SlicerCaches Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of slicer caches associated with the specified workbook.

Methods

Name | Description
Add2 | Adds a new SlicerCache object to the collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only.
Item | Returns a single SlicerCache object from the collection.
Parent | Returns the parent Workbook object for the collection. Read-only.


SlicerCaches Properties (Excel)

 Copy code hover
[image]

SlicerCaches Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only.
Item | Returns a single SlicerCache object from the collection.
Parent | Returns the parent Workbook object for the collection. Read-only.


SlicerCaches.Application Property (Excel)

 Copy code hover
[image]

SlicerCaches.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerCaches collection.

Return Value

Application

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerCaches.Count Property (Excel)

 Copy code hover
[image]

SlicerCaches.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a SlicerCaches collection.

Return Value

Long

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerCaches.Creator Property (Excel)

 Copy code hover
[image]

SlicerCaches.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only.

Syntax

expression .Creator

expression A variable that represents a SlicerCaches collection.

Return Value

Long

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerCaches.Item Property (Excel)

 Copy code hover
[image]

SlicerCaches.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single SlicerCache object from the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that returns a SlicerCaches collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Return Value

SlicerCache

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerCaches.Parent Property (Excel)

 Copy code hover
[image]

SlicerCaches.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent Workbook object for the collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerCaches collection.

Return Value

Workbook

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerCaches Methods (Excel)

 Copy code hover
[image]

SlicerCaches Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add2 | Adds a new SlicerCache object to the collection.


SlicerCaches.Add2 Method (Excel)

 Copy code hover
[image]

SlicerCaches.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a new SlicerCache object to the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Add(Source, SourceField, Name, SlicerCacheType)

expression A variable that represents a SlicerCaches collection.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The data source that the new SlicerCache will be based on. The argument passed to the Source parameter can be a WorkbookConnection object, a PivotTable object, or a string. If a PivotTable object is passed, the associated PivotCache object is used as the data source. If a string is passed, it is interpreted as the name of a WorkbookConnection object, and if no such WorkbookConnection object exists, a run-time error is generated.
SourceField | Required | Variant | The name of the field in the data source to filter by. For non-OLAP data sources, use the PivotField object from the PivotCache object that the slicer is based on, or the unique name of that object (the value of the PivotField.Name property). For OLAP data sources, use the MDX unique name of the hierarchy that the SlicerCache is based on. You can also specify a level of the OLAP hierarchy, and Excel will use the corresponding hierarchy.
Name | Optional | Variant | The name Excel uses to reference the slicer cache (the value of the SlicerCache.Name property). If omitted, Excel will generate a name. By default, Excel concatenates "Slicer_" with the value of the PivotField.Caption property for slicers with non-OLAP data sources, or with the value of the CubeField.Caption property for slicers with OLAP data sources. (Replacing any spaces with "_".) If required to make the name unique in the workbook namespace, Excel adds an integer to the end of the generated name. If you specify a name that already exists in the workbook namespace, the Add method will fail.
SlicerCacheType | Optional | XlSlicerCacheType | Designates the type of slicer or slicer cache.

Return Value

SlicerCache

Example

The following code example adds a slicer cache based on the Customer Geography OLAP hierarchy.

VBA Copy code Copy code
 ActiveWorkbook.SlicerCaches.Add(ActiveCell.PivotTable, _
 "[Customer].[Customer Geography]")

See also

Concepts

SlicerCaches Object

Other resources

SlicerCaches Object Members


SlicerItem Object (Excel)

 Copy code hover
[image]

SlicerItem Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an item in a slicer.

Version Information

Version Added: Excel 2010

Remarks

To access the SlicerItem object that represents the currently selected button in the slicer, use the ActiveItem property of the Slicer object. To access the SlicerItems collection that represents all the items in a slicer filtering a PivotTable, use the SlicerItems property of the SlicerCache object that is associated with the Slicer object. To access the SlicerItems collection that represent the items in a slicer filtering a level of an OLAP hierarchy, use the SlicerItems property of the SlicerCacheLevel object that represents that level of the hierarchy.

See also

Concepts

Excel Object Model Reference

Other resources

SlicerItem Object Members


SlicerItem Members (Excel)

 Copy code hover
[image]

SlicerItem Members (Excel)
Send feedback

Published: July 16, 2012

Represents an item in a slicer.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns the label text for the slicer item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HasData | Returns whether the slicer item contains data that matches the current manual filter state. Read-only.
Name | Returns the name of the slicer item. Read-only.
Parent | Returns the parent SlicerCache object for the slicer item. Read-only.
Selected | Returns or sets whether the slicer item is selected. Read/write for slicers connected to non-OLAP data sources. Read-only for slicers connected to OLAP data sources.
SourceName | Returns the source name of the slicer item. Read-only.
SourceNameStandard | Returns the slicer item's source name in standard English (United States) format settings. Read-only
Value | Returns the value of the slicer item. Read-only.


SlicerItem Properties (Excel)

 Copy code hover
[image]

SlicerItem Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Caption | Returns the label text for the slicer item. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HasData | Returns whether the slicer item contains data that matches the current manual filter state. Read-only.
Name | Returns the name of the slicer item. Read-only.
Parent | Returns the parent SlicerCache object for the slicer item. Read-only.
Selected | Returns or sets whether the slicer item is selected. Read/write for slicers connected to non-OLAP data sources. Read-only for slicers connected to OLAP data sources.
SourceName | Returns the source name of the slicer item. Read-only.
SourceNameStandard | Returns the slicer item's source name in standard English (United States) format settings. Read-only
Value | Returns the value of the slicer item. Read-only.


SlicerItem.Application Property (Excel)

 Copy code hover
[image]

SlicerItem.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerItem object.

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.Caption Property (Excel)

 Copy code hover
[image]

SlicerItem.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the label text for the slicer item. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Caption

expression A variable that represents a SlicerItem object.

Return Value

String

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.Creator Property (Excel)

 Copy code hover
[image]

SlicerItem.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SlicerItem object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.HasData Property (Excel)

 Copy code hover
[image]

SlicerItem.HasData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the slicer item contains data that matches the current manual filter state. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .HasData

expression A variable that represents a SlicerItem object.

Return Value

Boolean

Remarks

True if the slicer item contains data that matches the current manual filter state; otherwise False.

This property is only supported when cross filtering is turned on, and will generate a run-time error otherwise. To determine if cross filtering is turned on for a slicer associated with a PivotTable report, check the value of the CrossFilterType property of the specified SlicerItem object's parent SlicerCache object. To determine if cross filtering is turned on for a slicer associated with an OLAP data source, check the value of the CrossFilterType property of the SlicerCacheLevel object that corresponds to the OLAP hierarchy being filtered.

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.Name Property (Excel)

 Copy code hover
[image]

SlicerItem.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the slicer item. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Name

expression A variable that represents a SlicerItem object.

Return Value

String

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.Parent Property (Excel)

 Copy code hover
[image]

SlicerItem.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SlicerCache object for the slicer item. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerItem object.

Return Value

SlicerCache

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.Selected Property (Excel)

 Copy code hover
[image]

SlicerItem.Selected Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the slicer item is selected. Read/write for slicers connected to non-OLAP data sources. Read-only for slicers connected to OLAP data sources.

Version Information

Version Added: Excel 2010

Syntax

expression .Selected

expression A variable that represents a SlicerItem object.

Return Value

Boolean

Remarks

True if the slicer item is selected; otherwise False.

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.SourceName Property (Excel)

 Copy code hover
[image]

SlicerItem.SourceName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the source name of the slicer item. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .SourceName

expression A variable that represents a SlicerItem object.

Return Value

Variant

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItem.SourceNameStandard Property (Excel)

 Copy code hover
[image]

SlicerItem.SourceNameStandard Property (Excel)
Send feedback

Published: July 16, 2012

Returns the slicer item's source name in standard English (United States) format settings. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .SourceNameStandard

expression A variable that represents a SlicerItem object.

Return Value

String

Remarks

This property is used when a slicer item has a localized version and its SourceNameStandard property value differs from the SourceName property value, such as with date formatting.


SlicerItem.Value Property (Excel)

 Copy code hover
[image]

SlicerItem.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value of the slicer item. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Value

expression A variable that represents a SlicerItem object.

Return Value

String

See also

Concepts

SlicerItem Object

Other resources

SlicerItem Object Members


SlicerItems Object (Excel)

 Copy code hover
[image]

SlicerItems Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of SlicerItem objects contained in a SlicerCache or SlicerCacheLevel object.

Version Information

Version Added: Excel 2010

Remarks

To access the SlicerItems collection that represents the items in a slicer based on data in the workbook or non-OLAP external data, use the SlicerItems property of the SlicerCache object that is associated with the slicer.

To access the SlicerItems collection that represents the items in a slicer based on OLAP data connection, use the SlicerItems property of the SlicerCacheLevel object that represents a level of the hierarchy.

See also

Concepts

Excel Object Model Reference

Other resources

SlicerItems Object Members


SlicerItems Members (Excel)

 Copy code hover
[image]

SlicerItems Members (Excel)
Send feedback

Represents the collection of SlicerItem objects contained in a SlicerCache or SlicerCacheLevel object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only.
Item | Returns a SlicerItem object from a collection. Read-only.
Parent | Returns the parent SlicerCache object for the specified object. Read-only.


SlicerItems Properties (Excel)

 Copy code hover
[image]

SlicerItems Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only.
Item | Returns a SlicerItem object from a collection. Read-only.
Parent | Returns the parent SlicerCache object for the specified object. Read-only.


SlicerItems.Application Property (Excel)

 Copy code hover
[image]

SlicerItems.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerItems object.

See also

Concepts

SlicerItems Object

Other resources

SlicerItems Object Members


SlicerItems.Count Property (Excel)

 Copy code hover
[image]

SlicerItems.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that represents a SlicerItems object.

Return Value

Long

See also

Concepts

SlicerItems Object

Other resources

SlicerItems Object Members


SlicerItems.Creator Property (Excel)

 Copy code hover
[image]

SlicerItems.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only.

Syntax

expression .Creator

expression A variable that represents a SlicerItems object.

Return Value

Long

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerItems Object

Other resources

SlicerItems Object Members


SlicerItems.Item Property (Excel)

 Copy code hover
[image]

SlicerItems.Item Property (Excel)
See also Send feedback

Returns a SlicerItem object from a collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a SlicerItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the SlicerItem object.

Return Value

SlicerItem

See also

Concepts

SlicerItems Object

Other resources

SlicerItems Object Members


SlicerItems.Parent Property (Excel)

 Copy code hover
[image]

SlicerItems.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SlicerCache object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerItems object.

Return Value

SlicerCache

See also

Concepts

SlicerItems Object

Other resources

SlicerItems Object Members


SlicerPivotTables Object (Excel)

 Copy code hover
[image]

SlicerPivotTables Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents information about the collection of PivotTables associated with the specified SlicerCache object.

Version Information

Version Added: Excel 2010

Remarks

The SlicerPivotTables collection contains information about the PivotTables the slicer cache is currently filtering. It provides properties for determining the number of PivotTables the slicer is associated with, and for retrieving PivotTable objects that represent the PivotTables being filtered. It also provides methods for adding and removing PivotTables from the SlicerPivotTables collection. The SlicerPivotTables collection will be empty if the slicer associated with the specified SlicerCache is not connected to any PivotTables.

Use the PivotTables property of the SlicerCache object to return the SlicerPivotTables collection associated with a SlicerCache, which in turn may be associated with one or more slicers.

See also

Concepts

Excel Object Model Reference

Other resources

SlicerPivotTables Object Members


SlicerPivotTables Members (Excel)

 Copy code hover
[image]

SlicerPivotTables Members (Excel)
Send feedback

Published: July 16, 2012

Represents information about the collection of PivotTables associated with the specified SlicerCache object.

Methods

Name | Description
AddPivotTable | Adds a reference to a PivotTable to the SlicerPivotTables collection.
RemovePivotTable | Removes a reference to a PivotTable from the SlicerPivotTables collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single PivotTable object from the collection.
Parent | Returns the SlicerCache object that is the parent of the specified SlicerPivotTables collection. Read-only.


SlicerPivotTables Properties (Excel)

 Copy code hover
[image]

SlicerPivotTables Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single PivotTable object from the collection.
Parent | Returns the SlicerCache object that is the parent of the specified SlicerPivotTables collection. Read-only.


SlicerPivotTables.Application Property (Excel)

 Copy code hover
[image]

SlicerPivotTables.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SlicerPivotTables object.

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables.Count Property (Excel)

 Copy code hover
[image]

SlicerPivotTables.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that returns a SlicerPivotTables object.

Return Value

Long

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables.Creator Property (Excel)

 Copy code hover
[image]

SlicerPivotTables.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SlicerPivotTables object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables.Item Property (Excel)

 Copy code hover
[image]

SlicerPivotTables.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single PivotTable object from the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a SlicerPivotTables object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables.Parent Property (Excel)

 Copy code hover
[image]

SlicerPivotTables.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SlicerCache object that is the parent of the specified SlicerPivotTables collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SlicerPivotTables object.

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables Methods (Excel)

 Copy code hover
[image]

SlicerPivotTables Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddPivotTable | Adds a reference to a PivotTable to the SlicerPivotTables collection.
RemovePivotTable | Removes a reference to a PivotTable from the SlicerPivotTables collection.


SlicerPivotTables.AddPivotTable Method (Excel)

 Copy code hover
[image]

SlicerPivotTables.AddPivotTable Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a reference to a PivotTable to the SlicerPivotTables collection.

Version Information

Version Added: Excel 2010

Syntax

expression .AddPivotTable(PivotTable)

expression A variable that represents a SlicerPivotTables object.

Parameters

Name | Required/Optional | Data Type | Description
PivotTable | Required | PivotTable | A PivotTable object that represents the PivotTable to add.

Return Value

Nothing

Remarks

When a PivotTable is added to the SlicerPivotTables collection, it can be filtered by its parent SlicerCache and the slicers associated with it.

Example

The following code example adds PivotTable1 to the slicer cache associated with the Customer slicer.

VBA Copy code Copy code
Dim pvts As SlicerPivotTables
Set pvts = ActiveWorkbook.SlicerCaches("Slicer_Customer").PivotTables
pvts.AddPivotTable(ActiveSheet.PivotTables("PivotTable1"))

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


SlicerPivotTables.RemovePivotTable Method (Excel)

 Copy code hover
[image]

SlicerPivotTables.RemovePivotTable Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes a reference to a PivotTable from the SlicerPivotTables collection.

Version Information

Version Added: Excel 2010

Syntax

expression .RemovePivotTable(PivotTable)

expression A variable that represents a SlicerPivotTables object.

Parameters

Name | Required/Optional | Data Type | Description
PivotTable | Required | Variant | A PivotTable object that represents the PivotTable to remove, or the name or index of the PivotTable in the collection.

Return Value

Nothing

Remarks

When a PivotTable is removed from the SlicerPivotTables collection, is no longer filtered by its parent SlicerCache and the slicers associated with it.

Example

The following code example removes PivotTable1 from the slicer cache associated with the Customer slicer.

VBA Copy code Copy code
Dim pvts As SlicerPivotTables
Set pvts = ActiveWorkbook.SlicerCaches("Slicer_Customer").PivotTables
pvts.RemovePivotTable("PivotTable1")

See also

Concepts

SlicerPivotTables Object

Other resources

SlicerPivotTables Object Members


Slicers Object (Excel)

 Copy code hover
[image]

Slicers Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of Slicer objects.

Version Information

Version Added: Excel 2010

Remarks

Each Slicer object represents a slicer in a workbook. Slicers are used to filter data.

Example

Use the Slicers property to return the Slicers collection. The following code example displays the number of slicers in the first slicer cache in the workbook.

VBA Copy code Copy code
MsgBox ActiveWorkbook.SlicerCaches(1).Slicers.Count

Use Slicers(index), where index is the slicer index number or name, to return a single Slicer object from the slicers collection. The following code example changes the caption for the first slicer in the first slicer cache to "My Slicer".

VBA Copy code Copy code
ActiveWorkbook.SlicerCaches(1).Slicers(1).Caption = "My Slicer"

See also

Concepts

Excel Object Model Reference

Other resources

Slicers Object Members


Slicers Members (Excel)

 Copy code hover
[image]

Slicers Members (Excel)
Send feedback

Published: July 16, 2012

A collection of Slicer objects.

Methods

Name | Description
Add | Creates a new slicer and returns a Slicer object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Slicer object from the collection. Read-only.
Parent | Returns the parent SlicerCache object for the specified Slicers collection. Read-only.


Slicers Properties (Excel)

 Copy code hover
[image]

Slicers Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a Slicer object from the collection. Read-only.
Parent | Returns the parent SlicerCache object for the specified Slicers collection. Read-only.


Slicers.Application Property (Excel)

 Copy code hover
[image]

Slicers.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a Slicers collection.

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Slicers.Count Property (Excel)

 Copy code hover
[image]

Slicers.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that represents a Slicers collection.

Return Value

Long

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Slicers.Creator Property (Excel)

 Copy code hover
[image]

Slicers.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Slicers collection.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Slicers.Item Property (Excel)

 Copy code hover
[image]

Slicers.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Slicer object from the collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a Slicers collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the Slicer object.

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Slicers.Parent Property (Excel)

 Copy code hover
[image]

Slicers.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SlicerCache object for the specified Slicers collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a Slicers collection.

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Slicers Methods (Excel)

 Copy code hover
[image]

Slicers Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new slicer and returns a Slicer object.


Slicers.Add Method (Excel)

 Copy code hover
[image]

Slicers.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new slicer and returns a Slicer object.

Version Information

Version Added: Excel 2010

Syntax

expression .Add(SlicerDestination, Level, Name, Caption, Top, Left, Width, Height)

expression A variable that represents a Slicers object.

Parameters

Name | Required/Optional | Data Type | Description
SlicerDestination | Required | Variant | A String that specifies the name of the sheet, or a Worksheet object that represents the sheet, where the resulting slicer will be placed. The destination sheet must be in the workbook that contains the Slicers object specified by expression.
Level | Optional | Variant | For OLAP data sources, the ordinal or the Multidimensional Expression (MDX) name of the level on which the slicer creation is based. Not supported for non-OLAP data sources.
Name | Optional | Variant | The name of the slicer. Excel automatically generates a name if one is not specified. The name must be unique across all slicers within a workbook.
Caption | Optional | Variant | The caption of the slicer.
Top | Optional | Variant | The initial vertical position of the slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.
Left | Optional | Variant | The initial horizontal position of the slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.
Width | Optional | Variant | The initial width, in points, of the slicer control.
Height | Optional | Variant | The initial height, in points, of the slicer control.

Return Value

Slicer

Example

This example adds a SlicerCache object using the OLAP data source "AdventureWorks" and then adds a Slicer object to filter on the "Country" field.

VBA Copy code Copy code
Sub CreateNewSlicer()
 ActiveWorkbook.SlicerCaches.Add("Adventure Works", _
 "[Customer].[Customer Geography]").Slicers.Add ActiveSheet, _
 "[Customer].[Customer Geography].[Country]", "Country 1", "Country", _
 252, 522, 144, 216)
End Sub

See also

Concepts

Slicers Object

Other resources

Slicers Object Members


Sort Object (Excel)

 Copy code hover
[image]

Sort Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a sort of a range of data.

Version Information

Version Added: Excel 2007

Example

The following proceedure builds and sorts data in a range in the active worksheet.

VBA Copy code Copy code
Sub SortData()

 'Building data to sort on the active sheet.
 Range("A1").Value = "Name"
 Range("A2").Value = "Bill"
 Range("A3").Value = "Rod"
 Range("A4").Value = "John"
 Range("A5").Value = "Paddy"
 Range("A6").Value = "Kelly"
 Range("A7").Value = "William"
 Range("A8").Value = "Janet"
 Range("A9").Value = "Florence"
 Range("A10").Value = "Albert"
 Range("A11").Value = "Mary"
 MsgBox "The list is out of order. Hit Ok to continue...", vbInformation

 'Selecting a cell within the range.
 Range("A2").Select

 'Applying sort.
 With ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort
 .SortFields.Clear
 .SortFields.Add Key:=Range("A2:A11"), _
 SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
 .SetRange Range("A1:A11")
 .Header = xlYes
 .MatchCase = False
 .Orientation = xlTopToBottom
 .SortMethod = xlPinYin
 .Apply
 End With
 MsgBox "Sort complete.", vbInformation

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Sort Object Members


Sort Members (Excel)

 Copy code hover
[image]

Sort Members (Excel)
Send feedback

Published: July 16, 2012

Represents a sort of a range of data.

Methods

Name | Description
Apply | Sorts the range based on the currently applied sort states.
SetRange | Sets the range over which the sort occurs.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Header | Specifies whether the first row contains header information. Read/write XlYesNoGuess.
MatchCase | Set to True to perform a case-sensitive sort or set to False to perform non-case sensitive sort. Read/write.
Orientation | Specifies the orientation for the sort. Read/write XlSortOrientation.
Parent | Returns the parent object for the specified object. Read-only.
Rng | Return the range of values on which the sort is performed. Read-only.
SortFields | Returns the SortFields object that represents the collection of sort fields associated with the Sort object. Read-only.
SortMethod | Specifies the sort method for Chinese languages. Read/write XlSortMethod.


Sort Properties (Excel)

 Copy code hover
[image]

Sort Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Header | Specifies whether the first row contains header information. Read/write XlYesNoGuess.
MatchCase | Set to True to perform a case-sensitive sort or set to False to perform non-case sensitive sort. Read/write.
Orientation | Specifies the orientation for the sort. Read/write XlSortOrientation.
Parent | Returns the parent object for the specified object. Read-only.
Rng | Return the range of values on which the sort is performed. Read-only.
SortFields | Returns the SortFields object that represents the collection of sort fields associated with the Sort object. Read-only.
SortMethod | Specifies the sort method for Chinese languages. Read/write XlSortMethod.


Sort.Application Property (Excel)

 Copy code hover
[image]

Sort.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Sort object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.Creator Property (Excel)

 Copy code hover
[image]

Sort.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Sort object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.Header Property (Excel)

 Copy code hover
[image]

Sort.Header Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether the first row contains header information. Read/write XlYesNoGuess.

Version Information

Version Added: Excel 2007

Syntax

expression .Header

expression A variable that represents a Sort object.

Remarks

xlNo is the default value. You can specify xlGuess if you want Excel to attempt to determine the header.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.MatchCase Property (Excel)

 Copy code hover
[image]

Sort.MatchCase Property (Excel)
See also Send feedback

Published: July 16, 2012

Set to True to perform a case-sensitive sort or set to False to perform non-case sensitive sort. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .MatchCase

expression A variable that represents a Sort object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.Orientation Property (Excel)

 Copy code hover
[image]

Sort.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the orientation for the sort. Read/write XlSortOrientation.

Version Information

Version Added: Excel 2007

Syntax

expression .Orientation

expression A variable that represents a Sort object.

Remarks

XlSortOrientation can be one of these XlSortOrientation constants.

xlSortColumns

xlSortRows

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.Parent Property (Excel)

 Copy code hover
[image]

Sort.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Sort object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.Rng Property (Excel)

 Copy code hover
[image]

Sort.Rng Property (Excel)
See also Send feedback

Published: July 16, 2012

Return the range of values on which the sort is performed. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Rng

expression A variable that represents a Sort object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.SortFields Property (Excel)

 Copy code hover
[image]

Sort.SortFields Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SortFields object that represents the collection of sort fields associated with the Sort object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SortFields

expression A variable that represents a Sort object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.SortMethod Property (Excel)

 Copy code hover
[image]

Sort.SortMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the sort method for Chinese languages. Read/write XlSortMethod.

Version Information

Version Added: Excel 2007

Syntax

expression .SortMethod

expression A variable that represents a Sort object.

Remarks

XlSortMethod can be one of these SortMethod constants.

xlStroke

xlPinYin

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort Methods (Excel)

 Copy code hover
[image]

Sort Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Apply | Sorts the range based on the currently applied sort states.
SetRange | Sets the range over which the sort occurs.


Sort.Apply Method (Excel)

 Copy code hover
[image]

Sort.Apply Method (Excel)
See also Send feedback

Published: July 16, 2012

Sorts the range based on the currently applied sort states.

Version Information

Version Added: Excel 2007

Syntax

expression .Apply

expression A variable that represents a Sort object.

See also

Concepts

Sort Object

Other resources

Sort Object Members


Sort.SetRange Method (Excel)

 Copy code hover
[image]

Sort.SetRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the range over which the sort occurs.

Version Information

Version Added: Excel 2007

Syntax

expression .SetRange(Rng)

expression A variable that represents a Sort object.

Parameters

Name | Required/Optional | Data Type | Description
Rng | Required | Range | Specifies the range over which the sort represented by the Sort object occurs.
Note Note

SetRange can only be used when applying a sort to a sheet range, and cannot be used if the range is within a table.

See also

Concepts

Sort Object

Other resources

Sort Object Members


SortField Object (Excel)

 Copy code hover
[image]

SortField Object (Excel)
See also Send feedback

Published: July 16, 2012

The SortField object contains all the sort information for the Worksheet, ListObject, and AutoFilter objects.

Version Information

Version Added: Excel 2007

Remarks

Developers can use the BeforeSort event to override Excel's default behavior and put their own sort algorithm into the application.

See also

Concepts

Excel Object Model Reference

Other resources

SortField Object Members


SortField Members (Excel)

 Copy code hover
[image]

SortField Members (Excel)
Send feedback

Published: July 16, 2012

The SortField object contains all the sort information for the Worksheet, ListObject, and AutoFilter objects.

Methods

Name | Description
Delete | Removes the specified SortField object from the SortFields collection.
ModifyKey | Modify the key value by which values are sorted in the field.
SetIcon | Sets an icon for a SortField object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomOrder | Specifies a custom order to sort the fields. Read/write Variant.
DataOption | Specifies how to sort text in the range specified in SortField object. Read/write XlSortDataOption.
Key | Specifies the range that is currently being sorted on. Read-only.
Order | Determines the sort order for the values specified in the key. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Specifies the priority for the sort field. Read/write.
SortOn | Returns or sets what attribute of the cell to sort on . Read/write XlSortOn.
SortOnValue | Retun the value on which the sort is performed for the specified SortField object. Read-only.


SortField Properties (Excel)

 Copy code hover
[image]

SortField Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomOrder | Specifies a custom order to sort the fields. Read/write Variant.
DataOption | Specifies how to sort text in the range specified in SortField object. Read/write XlSortDataOption.
Key | Specifies the range that is currently being sorted on. Read-only.
Order | Determines the sort order for the values specified in the key. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Specifies the priority for the sort field. Read/write.
SortOn | Returns or sets what attribute of the cell to sort on . Read/write XlSortOn.
SortOnValue | Retun the value on which the sort is performed for the specified SortField object. Read-only.


SortField.Application Property (Excel)

 Copy code hover
[image]

SortField.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a SortField object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.Creator Property (Excel)

 Copy code hover
[image]

SortField.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SortField object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.CustomOrder Property (Excel)

 Copy code hover
[image]

SortField.CustomOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies a custom order to sort the fields. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .CustomOrder

expression A variable that represents a SortField object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.DataOption Property (Excel)

 Copy code hover
[image]

SortField.DataOption Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies how to sort text in the range specified in SortField object. Read/write XlSortDataOption.

Version Information

Version Added: Excel 2007

Syntax

expression .DataOption

expression A variable that represents a SortField object.

Remarks

xlSortDataOption can be either xlSortNormal or xlSortTextAsNumbers.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.Key Property (Excel)

 Copy code hover
[image]

SortField.Key Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the range that is currently being sorted on. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Key

expression A variable that represents a SortField object.

Remarks

The key can either be a range name (String) or a Range object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.Order Property (Excel)

 Copy code hover
[image]

SortField.Order Property (Excel)
See also Send feedback

Published: July 16, 2012

Determines the sort order for the values specified in the key. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Order

expression A variable that represents a SortField object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.Parent Property (Excel)

 Copy code hover
[image]

SortField.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a SortField object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.Priority Property (Excel)

 Copy code hover
[image]

SortField.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the priority for the sort field. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a SortField object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.SortOn Property (Excel)

 Copy code hover
[image]

SortField.SortOn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets what attribute of the cell to sort on . Read/write XlSortOn.

Version Information

Version Added: Excel 2007

Syntax

expression .SortOn

expression A variable that represents a SortField object.

Remarks

XlSortOn can be one of these XlSortOn constants.

SortOnCellColor

SortOnFontColor

SortOnIcon

SortOnValues

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.SortOnValue Property (Excel)

 Copy code hover
[image]

SortField.SortOnValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Retun the value on which the sort is performed for the specified SortField object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SortOnValue

expression A variable that represents a SortField object.

Example

This sample sorts the data in column B on sheet1 by font color in an ascending

VBA Copy code Copy code
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add(Range("B1:B25"), _
 xlSortOnFontColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(0, 0, 0)

With ActiveWorkbook.Worksheets("Sheet1").Sort
 .SetRange Range("A1:B25")
 .Header = xlGuess
 .MatchCase = False
 .Orientation = xlTopToBottom
 .SortMethod = xlPinYin
 .Apply
End With

Cell color

VBA Copy code Copy code
SortOn = xlSortOnCellColor
SortOnValue.Color = RGB(255, 255, 0)

Font color

VBA Copy code Copy code
SortOn = xlSortOnFontColor
SortOnValue.Color = RGB(255, 255, 0)

Icons

VBA Copy code Copy code
SortOn = xlSortOnIcon
SortOnValue.Color = RGB(255, 255, 0)
SortField.SetIcon ActiveWorkbook.IconSets(1).Item(3)

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField Methods (Excel)

 Copy code hover
[image]

SortField Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Removes the specified SortField object from the SortFields collection.
ModifyKey | Modify the key value by which values are sorted in the field.
SetIcon | Sets an icon for a SortField object.


SortField.Delete Method (Excel)

 Copy code hover
[image]

SortField.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes the specified SortField object from the SortFields collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a SortField object.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.ModifyKey Method (Excel)

 Copy code hover
[image]

SortField.ModifyKey Method (Excel)
See also Send feedback

Published: July 16, 2012

Modify the key value by which values are sorted in the field.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyKey(Key)

expression A variable that represents a SortField object.

Parameters

Name | Required/Optional | Data Type | Description
Key | Required | Range | Specifies the key to be modified.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortField.SetIcon Method (Excel)

 Copy code hover
[image]

SortField.SetIcon Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets an icon for a SortField object.

Version Information

Version Added: Excel 2007

Syntax

expression .SetIcon(Icon)

expression A variable that represents a SortField object.

Parameters

Name | Required/Optional | Data Type | Description
Icon | Required | Icon | The icon to be set.

See also

Concepts

SortField Object

Other resources

SortField Object Members


SortFields Object (Excel)

 Copy code hover
[image]

SortFields Object (Excel)
See also Send feedback

Published: July 16, 2012

The SortFields collection is a collection of SortField objects. It allows developers to store a sort state on workbooks, lists, and autofilters.

Version Information

Version Added: Excel 2007

Remarks

The object contains properties to add, count, sort, and remove SortField objects.

Example

Copy code Copy code
ActiveWorksheet.SortFields.Add Key:=Range("A1"), Order:=xlDescending
ActiveWorksheet.SortFields.Add Key:=Range("B1"), Order:=xlDescending
ActiveWorksheet.SortFields.Sort Header:=xlGuess

See also

Concepts

Excel Object Model Reference

Other resources

SortFields Object Members


SortFields Members (Excel)

 Copy code hover
[image]

SortFields Members (Excel)
Send feedback

Published: July 16, 2012

The SortFields collection is a collection of SortField objects. It allows developers to store a sort state on workbooks, lists, and autofilters.

Methods

Name | Description
Add | Creates a new sort field and returns a SortFields object.
Clear | Clears all the SortFields objects.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SortField object that represents a collection of items that can be sorted in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


SortFields Properties (Excel)

 Copy code hover
[image]

SortFields Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SortField object that represents a collection of items that can be sorted in a workbook. Read-only.
Parent | Returns the parent object for the specified object. Read-only.


SortFields.Application Property (Excel)

 Copy code hover
[image]

SortFields.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a SortFields object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields.Count Property (Excel)

 Copy code hover
[image]

SortFields.Count Property (Excel)
See also Send feedback

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a SortFields object.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields.Creator Property (Excel)

 Copy code hover
[image]

SortFields.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SortFields object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields.Item Property (Excel)

 Copy code hover
[image]

SortFields.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SortField object that represents a collection of items that can be sorted in a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a SortFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the SortField.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields.Parent Property (Excel)

 Copy code hover
[image]

SortFields.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a SortFields object.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields Methods (Excel)

 Copy code hover
[image]

SortFields Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new sort field and returns a SortFields object.
Clear | Clears all the SortFields objects.


SortFields.Add Method (Excel)

 Copy code hover
[image]

SortFields.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new sort field and returns a SortFields object.

Version Information

Version Added: Excel 2007

Syntax

expression .Add(Key, SortOn, Order, CustomOrder, DataOption)

expression A variable that represents a SortFields object.

Parameters

Name | Required/Optional | Data Type | Description
Key | Required | Range | Specifies a key value for the sort.
SortOn | Optional | Variant | The field to sort on.
Order | Optional | Variant | Specifies the sort order.
CustomOrder | Optional | Variant | Specifies if a custom sort order should be used.
DataOption | Optional | Variant | Specifies the data option.

Return Value

SortField

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SortFields.Clear Method (Excel)

 Copy code hover
[image]

SortFields.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears all the SortFields objects.

Version Information

Version Added: Excel 2007

Syntax

expression .Clear

expression A variable that represents a SortFields object.

See also

Concepts

SortFields Object

Other resources

SortFields Object Members


SparkAxes Object (Excel)

 Copy code hover
[image]

SparkAxes Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the settings for the horizontal and vertical axes of a group of sparklines.

Version Information

Version Added: Excel 2010

Remarks

Use the Axes property of a SparklineGroup object to return the SparkAxes object for that group of sparklines.

See also

Concepts

Excel Object Model Reference

Other resources

SparkAxes Object Members


SparkAxes Members (Excel)

 Copy code hover
[image]

SparkAxes Members (Excel)
Send feedback

Published: July 16, 2012

Represents the settings for the horizontal and vertical axes of a group of sparklines.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Horizontal | Returns the SparkHorizontalAxis object for the specified SparkAxes object. Read-only
Parent | Returns the parent SparklineGroup object for the specified SparkAxes object. Read-only.
Vertical | Returns the SparkVerticalAxis object for the specified SparkAxes object. Read-only


SparkAxes Properties (Excel)

 Copy code hover
[image]

SparkAxes Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Horizontal | Returns the SparkHorizontalAxis object for the specified SparkAxes object. Read-only
Parent | Returns the parent SparklineGroup object for the specified SparkAxes object. Read-only.
Vertical | Returns the SparkVerticalAxis object for the specified SparkAxes object. Read-only


SparkAxes.Application Property (Excel)

 Copy code hover
[image]

SparkAxes.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparkAxes object.

See also

Concepts

SparkAxes Object

Other resources

SparkAxes Object Members


SparkAxes.Creator Property (Excel)

 Copy code hover
[image]

SparkAxes.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparkAxes object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparkAxes Object

Other resources

SparkAxes Object Members


SparkAxes.Horizontal Property (Excel)

 Copy code hover
[image]

SparkAxes.Horizontal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SparkHorizontalAxis object for the specified SparkAxes object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Horizontal

expression A variable that represents a SparkAxes object.

Return Value

SparkHorizontalAxis

See also

Concepts

SparkAxes Object

Other resources

SparkAxes Object Members


SparkAxes.Parent Property (Excel)

 Copy code hover
[image]

SparkAxes.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified SparkAxes object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparkAxes object.

Return Value

SparklineGroup

See also

Concepts

SparkAxes Object

Other resources

SparkAxes Object Members


SparkAxes.Vertical Property (Excel)

 Copy code hover
[image]

SparkAxes.Vertical Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SparkVerticalAxis object for the specified SparkAxes object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Vertical

expression A variable that represents a SparkAxes object.

Return Value

SparkVerticalAxis

See also

Concepts

SparkAxes Object

Other resources

SparkAxes Object Members


SparkColor Object (Excel)

 Copy code hover
[image]

SparkColor Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the color of the horizontal axis and the markers for points in a sparkline.

Version Information

Version Added: Excel 2010

Remarks

The SparkColor object corresponds to the settings of the items available on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon. Use the corresponding properties of the SparkPoints object to set the colors of these items.

See also

Concepts

Excel Object Model Reference

Other resources

SparkColor Object Members


SparkColor Members (Excel)

 Copy code hover
[image]

SparkColor Members (Excel)
Send feedback

Published: July 16, 2012

Represents the color of the horizontal axis and the markers for points in a sparkline.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns a FormatColor object that you can use to set the color of the horizontal axis or the markers for points in a sparkline. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
Visible | Returns of sets whether the point is visible. Read/write


SparkColor Properties (Excel)

 Copy code hover
[image]

SparkColor Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Color | Returns a FormatColor object that you can use to set the color of the horizontal axis or the markers for points in a sparkline. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
Visible | Returns of sets whether the point is visible. Read/write


SparkColor.Application Property (Excel)

 Copy code hover
[image]

SparkColor.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparkColor object.

See also

Concepts

SparkColor Object

Other resources

SparkColor Object Members


SparkColor.Color Property (Excel)

 Copy code hover
[image]

SparkColor.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FormatColor object that you can use to set the color of the horizontal axis or the markers for points in a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Color

expression A variable that represents a SparkColor object.

Return Value

FormatColor

See also

Concepts

SparkColor Object

Other resources

SparkColor Object Members


SparkColor.Creator Property (Excel)

 Copy code hover
[image]

SparkColor.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparkColor object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparkColor Object

Other resources

SparkColor Object Members


SparkColor.Parent Property (Excel)

 Copy code hover
[image]

SparkColor.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparkColor object.

See also

Concepts

SparkColor Object

Other resources

SparkColor Object Members


SparkColor.Visible Property (Excel)

 Copy code hover
[image]

SparkColor.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns of sets whether the point is visible. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Visible

expression A variable that represents a SparkColor object.

Return Value

Boolean

Remarks

The setting of the Visible property corresponds to the settings of the High Point, Low Point, Negative Point, First Point, Last Point, and Markers check boxes in the Show section of the Sparkline Tools Design tab of the ribbon. Use the corresponding properties of the SparkPoints object to set the state of these check boxes.

See also

Concepts

SparkColor Object

Other resources

SparkColor Object Members


SparkHorizontalAxis Object (Excel)

 Copy code hover
[image]

SparkHorizontalAxis Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the settings for the horizontal axes of a group of sparklines.

Version Information

Version Added: Excel 2010

Remarks

Use the Horizontal property of the SparkAxes object to return the SparkHorizontalAxis object for group of sparklines. The horizontal axis is displayed only if the data for the sparkline has both negative and positive values on the vertical axis.

See also

Concepts

Excel Object Model Reference

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis Members (Excel)

 Copy code hover
[image]

SparkHorizontalAxis Members (Excel)
Send feedback

Represents the settings for the horizontal axes of a group of sparklines.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Axis | Returns a SparkColor object that specifies the color of the horizontal axis of the sparkline. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
IsDateAxis | Returns whether the horizontal axis of the sparkline is based on date values. Read-only
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
RightToLeftPlotOrder | Returns or sets whether the points on the horizontal axis are plotted in right-to-left order. Read/write


SparkHorizontalAxis Properties (Excel)

 Copy code hover
[image]

SparkHorizontalAxis Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Axis | Returns a SparkColor object that specifies the color of the horizontal axis of the sparkline. Read-only
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
IsDateAxis | Returns whether the horizontal axis of the sparkline is based on date values. Read-only
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
RightToLeftPlotOrder | Returns or sets whether the points on the horizontal axis are plotted in right-to-left order. Read/write


SparkHorizontalAxis.Application Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparkHorizontalAxis object.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis.Axis Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.Axis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that specifies the color of the horizontal axis of the sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Axis

expression A variable that represents a SparkHorizontalAxis object.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis.Creator Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparkHorizontalAxis object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis.IsDateAxis Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.IsDateAxis Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the horizontal axis of the sparkline is based on date values. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .IsDateAxis

expression A variable that represents a SparkHorizontalAxis object.

Return Value

Boolean

Remarks

True if the horizontal axis is based on date values; otherwise False.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis.Parent Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparkHorizontalAxis object.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


SparkHorizontalAxis.RightToLeftPlotOrder Property (Excel)

 Copy code hover
[image]

SparkHorizontalAxis.RightToLeftPlotOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the points on the horizontal axis are plotted in right-to-left order. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .RightToLeftPlotOrder

expression A variable that represents a SparkHorizontalAxis object.

Return Value

Boolean

Remarks

Set the RightToLeftPlotOrder property to True to plot the values on the horizontal axis in right-to-left order.

See also

Concepts

SparkHorizontalAxis Object

Other resources

SparkHorizontalAxis Object Members


Sparkline Object (Excel)

 Copy code hover
[image]

Sparkline Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single sparkline.

Version Information

Version Added: Excel 2010

Remarks

Use the ModifyLocation method to change the location of a single sparkline, and use the ModifySourceData method to change the range of the source data. To work with a group of sparklines at once, use the members of the SparklineGroup object.

See also

Concepts

Excel Object Model Reference

Other resources

Sparkline Object Members


Sparkline Members (Excel)

 Copy code hover
[image]

Sparkline Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single sparkline.

Methods

Name | Description
ModifyLocation | Modifies the location of a single sparkline.
ModifySourceData | Modifies the source data for a single sparkline.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Location | Returns or sets the location of a single sparkline. Read/write
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
SourceData | Returns or sets the range the contains the source data for a single sparkline. Read/write


Sparkline Properties (Excel)

 Copy code hover
[image]

Sparkline Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Location | Returns or sets the location of a single sparkline. Read/write
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.
SourceData | Returns or sets the range the contains the source data for a single sparkline. Read/write


Sparkline.Application Property (Excel)

 Copy code hover
[image]

Sparkline.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a Sparkline object.

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline.Creator Property (Excel)

 Copy code hover
[image]

Sparkline.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Sparkline object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline.Location Property (Excel)

 Copy code hover
[image]

Sparkline.Location Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of a single sparkline. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .Location

expression A variable that represents a Sparkline object.

Return Value

Range

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline.Parent Property (Excel)

 Copy code hover
[image]

Sparkline.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a Sparkline object.

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline.SourceData Property (Excel)

 Copy code hover
[image]

Sparkline.SourceData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the range the contains the source data for a single sparkline. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .SourceData

expression A variable that represents a Sparkline object.

Return Value

String

Remarks

The data source range for a single sparkline must be continuous.

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline Methods (Excel)

 Copy code hover
[image]

Sparkline Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ModifyLocation | Modifies the location of a single sparkline.
ModifySourceData | Modifies the source data for a single sparkline.


Sparkline.ModifyLocation Method (Excel)

 Copy code hover
[image]

Sparkline.ModifyLocation Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies the location of a single sparkline.

Version Information

Version Added: Excel 2010

Syntax

expression .ModifyLocation(Range)

expression A variable that represents a Sparkline object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The cell that contains the sparkline.

Return Value

Nothing

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


Sparkline.ModifySourceData Method (Excel)

 Copy code hover
[image]

Sparkline.ModifySourceData Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies the source data for a single sparkline.

Version Information

Version Added: Excel 2010

Syntax

expression .ModifySourceData(Formula)

expression A variable that represents a Sparkline object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Required | String | The range that contains the source data.

Return Value

Nothing

Remarks

The data source range for a single sparkline must be continuous.

See also

Concepts

Sparkline Object

Other resources

Sparkline Object Members


SparklineGroup Object (Excel)

 Copy code hover
[image]

SparklineGroup Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a group of sparklines.

Version Information

Version Added: Excel 2010

Remarks

The SparklineGroup object can contain multiple sparklines and contains the property settings for the group, such as color and axis settings. Each sparkline is represented by a Sparkline object.

Use the Modify method to add or remove sparklines from the sparkline group. Use the ModifyLocation method to change the location of the sparkline and use the ModifySourceData method to change the range of the source data.

Example

The following code example creates a group of column sparklines at the location A1:A4 that are bound to the source data in the range Sheet2!B1:E4. The series color is changed to display the columns in red.

VBA Copy code Copy code
Dim mySG As SparklineGroup
Set mySG = Range("$A$1:$A$4").SparklineGroups.Add(Type:=xlSparkColumn, SourceData:= _
 "Sheet2!B1:E4")

mySG.SeriesColor.Color = RGB(255, 0, 0)

See also

Concepts

Excel Object Model Reference

Other resources

SparklineGroup Object Members


SparklineGroup Members (Excel)

 Copy code hover
[image]

SparklineGroup Members (Excel)
Send feedback

Published: July 16, 2012

Represents a group of sparklines.

Methods

Name | Description
Delete | Deletes the sparkline group.
Modify | Sets the location and the source data for the sparkline group.
ModifyDateRange | Sets the date range for the sparkline group.
ModifyLocation | Sets the associated Range object to modify the location of the sparkline group.
ModifySourceData | Sets the range that represents the source data for the sparkline group.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Axes | Returns the associated SparkAxes object. Read-only.
Count | Returns the number of sparklines in the sparkline group. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DateRange | Gets or sets the date range for the sparkline group. Read/write.
DisplayBlanksAs |
DisplayHidden | Specifies if hidden cells are plotted in the sparkline group. Read/write.
Item | Returns a Sparkline object. Read-only
LineWeight | Gets or sets the thickness of the sparklines in the sparkline group. Read/write.
Location | Gets or sets the Range object that represents the location of the sparkline group. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
PlotBy | Returns or sets how to plot the sparkline when the data on which it is based is in a square-shaped range. Read/write.
Points | Returns the associated SparkPoints object for the sparkline group. Read-only.
SeriesColor | Returns a FormatColor object that represents the main series color for the sparkline group. Read-only.
SourceData | Returns or sets the range that contains the source data for the sparkline group. Read/write.
Type | Gets or sets the type of sparkline for the group. Read/write.


SparklineGroup Properties (Excel)

 Copy code hover
[image]

SparklineGroup Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Axes | Returns the associated SparkAxes object. Read-only.
Count | Returns the number of sparklines in the sparkline group. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DateRange | Gets or sets the date range for the sparkline group. Read/write.
DisplayBlanksAs |
DisplayHidden | Specifies if hidden cells are plotted in the sparkline group. Read/write.
Item | Returns a Sparkline object. Read-only
LineWeight | Gets or sets the thickness of the sparklines in the sparkline group. Read/write.
Location | Gets or sets the Range object that represents the location of the sparkline group. Read/write.
Parent | Returns the parent object for the specified object. Read-only.
PlotBy | Returns or sets how to plot the sparkline when the data on which it is based is in a square-shaped range. Read/write.
Points | Returns the associated SparkPoints object for the sparkline group. Read-only.
SeriesColor | Returns a FormatColor object that represents the main series color for the sparkline group. Read-only.
SourceData | Returns or sets the range that contains the source data for the sparkline group. Read/write.
Type | Gets or sets the type of sparkline for the group. Read/write.


SparklineGroup.Application Property (Excel)

 Copy code hover
[image]

SparklineGroup.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparklineGroup object.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Axes Property (Excel)

 Copy code hover
[image]

SparklineGroup.Axes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the associated SparkAxes object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Axes

expression A variable that represents a SparklineGroup object.

Return Value

SparkAxes

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Count Property (Excel)

 Copy code hover
[image]

SparklineGroup.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of sparklines in the sparkline group. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that represents a SparklineGroup object.

Return Value

Long

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Creator Property (Excel)

 Copy code hover
[image]

SparklineGroup.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparklineGroup object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.DateRange Property (Excel)

 Copy code hover
[image]

SparklineGroup.DateRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the date range for the sparkline group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .DateRange

expression A variable that represents a SparklineGroup object.

Return Value

String

Remarks

To clear the date range set this property to an empty string.

The date range must be a continuous one dimensional range.

The date range can be located on a different sheet than the Location and SourceData properties.

Empty cells and non-date values in the date range are not displayed.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.DisplayBlanksAs Property (Excel)

 Copy code hover
[image]

SparklineGroup.DisplayBlanksAs Property (Excel)
Send feedback

Published: July 16, 2012

Version information

Version Added: Excel 2013

Syntax

expression .DisplayBlanksAs

expression A variable that represents a SparklineGroup object.

Property value

XLDISPLAYBLANKSAS


SparklineGroup.DisplayHidden Property (Excel)

 Copy code hover
[image]

SparklineGroup.DisplayHidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if hidden cells are plotted in the sparkline group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .DisplayHidden

expression A variable that represents a SparklineGroup object.

Return Value

Boolean

Remarks

True if hidden cells are shown in the sparkline group.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Item Property (Excel)

 Copy code hover
[image]

SparklineGroup.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sparkline object. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a SparklineGroup object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Index value of the sparkline.

Return Value

Sparkline

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.LineWeight Property (Excel)

 Copy code hover
[image]

SparklineGroup.LineWeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the thickness of the sparklines in the sparkline group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .LineWeight

expression A variable that represents a SparklineGroup object.

Return Value

Variant

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Location Property (Excel)

 Copy code hover
[image]

SparklineGroup.Location Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the Range object that represents the location of the sparkline group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Location

expression A variable that represents a SparklineGroup object.

Return Value

Range

Remarks

The location for all sparklines in a sparkline group must be on the same sheet, but the source data for the sparkline group can be on a different sheet or workbook.

The size of the range that represents the Location property must equal the number of rows or columns in the SourceData property for the SparklineGroup object.

A continuous range associated with a sparkline group can only be one dimensional. If the range is not continuous, each cell must be specified individually.

Note Note

Do not use the Union method to create a non-continuous range because the Union method returns a single range reference.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Parent Property (Excel)

 Copy code hover
[image]

SparklineGroup.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparklineGroup object.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.PlotBy Property (Excel)

 Copy code hover
[image]

SparklineGroup.PlotBy Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how to plot the sparkline when the data on which it is based is in a square-shaped range. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .PlotBy

expression A variable that represents a SparklineGroup object.

Return Value

XlSparklineRowCol

Remarks

This property can only be set if the data on which the sparkline is based is in a square-shaped range, for example if the data is in the range A1:B2.

The default value for sp data in a square-shaped range is to plot the data by rows (xlSparklineRowsSquare).

Property value

XLSPARKLINEROWCOL

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Points Property (Excel)

 Copy code hover
[image]

SparklineGroup.Points Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the associated SparkPoints object for the sparkline group. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Points

expression A variable that represents a SparklineGroup object.

Return Value

SparkPoints

Property value

SPARKPOINTS

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.SeriesColor Property (Excel)

 Copy code hover
[image]

SparklineGroup.SeriesColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a FormatColor object that represents the main series color for the sparkline group. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .SeriesColor

expression A variable that represents a SparklineGroup object.

Return Value

FormatColor

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.SourceData Property (Excel)

 Copy code hover
[image]

SparklineGroup.SourceData Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the range that contains the source data for the sparkline group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .SourceData

expression A variable that represents a SparklineGroup object.

Return Value

String

Remarks

The number of rows or columns in the source data range must equal the number of cells in the Location property range.

The data source range for a single sparkline in the sparkline group must be continuous.

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Type Property (Excel)

 Copy code hover
[image]

SparklineGroup.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Gets or sets the type of sparkline for the group. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .Type

expression A variable that represents a SparklineGroup object.

Return Value

XlSparkType

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup Methods (Excel)

 Copy code hover
[image]

SparklineGroup Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the sparkline group.
Modify | Sets the location and the source data for the sparkline group.
ModifyDateRange | Sets the date range for the sparkline group.
ModifyLocation | Sets the associated Range object to modify the location of the sparkline group.
ModifySourceData | Sets the range that represents the source data for the sparkline group.


SparklineGroup.Delete Method (Excel)

 Copy code hover
[image]

SparklineGroup.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .Delete

expression A variable that represents a SparklineGroup object.

Return Value

Nothing

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.Modify Method (Excel)

 Copy code hover
[image]

SparklineGroup.Modify Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the location and the source data for the sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .Modify(Location, SourceData)

expression A variable that represents a SparklineGroup object.

Parameters

Name | Required/Optional | Data Type | Description
Location | Required | Range | The Range object that represents the location of the sparkline group.
SourceData | Required | String | The range that represents the source data for the sparkline group.

Return Value

Nothing

Example

This examples selects a sparkline group in the location A1:A4 and removes a row of data by changing the sparkline group location to equal A1:A3. The data source must also be modified to only include the first three rows of data.

VBA Copy code Copy code
Range("A1:A4").Select
ActiveCell.SparklineGroups.Item(1).Modify Location:=Range("$A$1:$A$3"), SourceData:="Sheet1!B1:D3"

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.ModifyDateRange Method (Excel)

 Copy code hover
[image]

SparklineGroup.ModifyDateRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the date range for the sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .ModifyDateRange(DateRange)

expression A variable that represents a SparklineGroup object.

Parameters

Name | Required/Optional | Data Type | Description
DateRange | Required | String | The date range for the sparkline group.

Return Value

Nothing

Example

This example selects a sparkline group in the location A2:A5 and sets the date range equal to B1:E1. If the cells in range B1:E1 do not contain date values the data is not displayed.

VBA Copy code Copy code
Range("A2:A5").Select
ActiveCell.SparklineGroups.Item(1).ModifyDateRange "Sheet1!B1:E1"

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.ModifyLocation Method (Excel)

 Copy code hover
[image]

SparklineGroup.ModifyLocation Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the associated Range object to modify the location of the sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .ModifyLocation(Location)

expression A variable that represents a SparklineGroup object.

Parameters

Name | Required/Optional | Data Type | Description
Location | Required | Range | The Range that represents the location of the sparkline group.

Return Value

Nothing

Example

This example selects a sparkline group in the location A1:A4 and changes the location to equal A10:A14.

VBA Copy code Copy code
Range("A1:A4").Select
ActiveCell.SparklineGroups.Item(1).ModifyLocation Range("$A$10:$A$14")

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroup.ModifySourceData Method (Excel)

 Copy code hover
[image]

SparklineGroup.ModifySourceData Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the range that represents the source data for the sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .ModifySourceData(SourceData)

expression A variable that represents a SparklineGroup object.

Parameters

Name | Required/Optional | Data Type | Description
SourceData | Required | String | The range that represents the source data.

Return Value

Nothing

Example

This example selects a sparkline group in the location A1:A4 and modifies the source data to include an additional column using the data in the range B1:D4.

VBA Copy code Copy code
Range("A1:A4").Select
ActiveCell.SparklineGroups.Item(1).ModifySourceData "B1:D4"

See also

Concepts

SparklineGroup Object

Other resources

SparklineGroup Object Members


SparklineGroups Object (Excel)

 Copy code hover
[image]

SparklineGroups Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a collection of sparkline groups.

Version Information

Version Added: Excel 2010

Remarks

The SparklineGroups object can contain multiple SparklineGroup objects.

Use the SparklineGroups property of the Range object to return an existing SparklineGroups collection from its parent range.

Use the Add method to create a group of new sparklines.

Use the Group method to create a group of existing sparklines.

Example

This example selects the range A1:A4 and groups the sparklines in that range. If the sparklines in the sparkline group are line sparklines, the markers are displayed in red.

VBA Copy code Copy code
Range("A1:A4").Select
Selection.SparklineGroups.Group Location := Range("A1")
Selection.SparklineGroups.Item(1).Points.Markers.Visible = True
Selection.SparklineGroups.Item(1).Points.Markers.Color.Color = 255

See also

Concepts

Excel Object Model Reference

Other resources

SparklineGroups Object Members


SparklineGroups Members (Excel)

 Copy code hover
[image]

SparklineGroups Members (Excel)
Send feedback

Published: July 16, 2012

Represents a collection of sparkline groups.

Methods

Name | Description
Add | Creates a new sparkline group and returns a SparklineGroup object.
Clear | Clears the selected sparklines.
ClearGroups | Clears the selected sparkline groups.
Group | Groups the selected sparklines.
Ungroup | Ungroups the sparklines in the selected sparkline group.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the count of sparkline groups in the associated Range object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SparklineGroup object from a collection. Read-only.
Parent | Returns the Range object for the specified object. Read-only.


SparklineGroups Properties (Excel)

 Copy code hover
[image]

SparklineGroups Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the count of sparkline groups in the associated Range object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a SparklineGroup object from a collection. Read-only.
Parent | Returns the Range object for the specified object. Read-only.


SparklineGroups.Application Property (Excel)

 Copy code hover
[image]

SparklineGroups.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparklineGroups object.

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Count Property (Excel)

 Copy code hover
[image]

SparklineGroups.Count Property (Excel)
See also Send feedback

Returns the count of sparkline groups in the associated Range object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Count

expression A variable that represents a SparklineGroups object.

Return Value

Long

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Creator Property (Excel)

 Copy code hover
[image]

SparklineGroups.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparklineGroups object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Item Property (Excel)

 Copy code hover
[image]

SparklineGroups.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparklineGroup object from a collection. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Item(Index)

expression A variable that represents a SparklineGroups object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies the position of an element in the collection.

Return Value

SparklineGroup

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Parent Property (Excel)

 Copy code hover
[image]

SparklineGroups.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Range object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparklineGroups object.

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups Methods (Excel)

 Copy code hover
[image]

SparklineGroups Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new sparkline group and returns a SparklineGroup object.
Clear | Clears the selected sparklines.
ClearGroups | Clears the selected sparkline groups.
Group | Groups the selected sparklines.
Ungroup | Ungroups the sparklines in the selected sparkline group.


SparklineGroups.Add Method (Excel)

 Copy code hover
[image]

SparklineGroups.Add Method (Excel)
See also Send feedback

Creates a new sparkline group and returns a SparklineGroup object.

Version Information

Version Added: Excel 2010

Syntax

expression .Add(Type, SourceData)

expression A variable that represents a SparklineGroups object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlSparkType | The type of sparkline.
SourceData | Required | String | Represents the range to use to create the sparkline.

Return Value

SparklineGroup

Example

This example adds a sparkline group to the range A1:A4. The sparklines in the group are column sparklines and are bound to the data in the range B1:E4.

VBA Copy code Copy code
Range("$A$1:$A$4").SparklineGroups.Add Type:=xlSparkColumn, SourceData:= _
 "Sheet2!B1:E4"

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Clear Method (Excel)

 Copy code hover
[image]

SparklineGroups.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the selected sparklines.

Version Information

Version Added: Excel 2010

Syntax

expression .Clear

expression A variable that represents a SparklineGroups object.

Return Value

Nothing

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.ClearGroups Method (Excel)

 Copy code hover
[image]

SparklineGroups.ClearGroups Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the selected sparkline groups.

Version Information

Version Added: Excel 2010

Syntax

expression .ClearGroups

expression A variable that represents a SparklineGroups object.

Return Value

Nothing

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Group Method (Excel)

 Copy code hover
[image]

SparklineGroups.Group Method (Excel)
See also Send feedback

Published: July 16, 2012

Groups the selected sparklines.

Version Information

Version Added: Excel 2010

Syntax

expression .Group(Location)

expression A variable that represents a SparklineGroups object.

Parameters

Name | Required/Optional | Data Type | Description
Location | Required | Range | The location of the first cell in the group.

Return Value

Nothing

Example

This example selects the range A1:A4 and groups the sparklines in that range.

VBA Copy code Copy code
Range("A1:A4").Select
Selection.SparklineGroups.Group Location:=Range("A1")

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparklineGroups.Ungroup Method (Excel)

 Copy code hover
[image]

SparklineGroups.Ungroup Method (Excel)
See also Send feedback

Published: July 16, 2012

Ungroups the sparklines in the selected sparkline group.

Version Information

Version Added: Excel 2010

Syntax

expression .Ungroup

expression A variable that represents a SparklineGroups object.

Return Value

Nothing

Example

The following code example selects the range A1:A4 and ungroups the sparklines in that range.

VBA Copy code Copy code
Range("A1:A4").Select
Selection.SparklineGroups.Ungroup

See also

Concepts

SparklineGroups Object

Other resources

SparklineGroups Object Members


SparkPoints Object (Excel)

 Copy code hover
[image]

SparkPoints Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the settings of the markers for points of data on a sparkline.

Version Information

Version Added: Excel 2010

Remarks

Use the SparkPoints object to set the color and visibility of markers for points of data on a sparkline. Use the Points property of the SparklineGroup object to return a SparkPoints object. The properties of the SparkPoints object correspond to the settings of the High Point, Low Point, Negative Point, First Point, Last Point, and Markers check boxes in the Show section, and of the items on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

Excel Object Model Reference

Other resources

SparkPoints Object Members


SparkPoints Members (Excel)

 Copy code hover
[image]

SparkPoints Members (Excel)
Send feedback

Published: July 16, 2012

Represents the settings of the markers for points of data on a sparkline.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Firstpoint | Returns a SparkColor object that represents the color and visibility of the marker for the first point of data on a sparkline. Read-only
Highpoint | Returns a SparkColor object that represents the color and visibility of the marker for the highest point of data on a sparkline. Read-only
Lastpoint | Returns a SparkColor object that represents the color and visibility of the marker for the last point of data on a sparkline. Read-only
Lowpoint | Returns a SparkColor object that represents the color and visibility of the marker for the lowest point of data on a sparkline. Read-only
Markers | Returns a SparkColor object that represents the color and visibility of markers for positive points of data on a sparkline. Read-only
Negative | Returns a SparkColor object that represents the color and visibility of markers for negative points of data on a sparkline. Read-only
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.


SparkPoints Properties (Excel)

 Copy code hover
[image]

SparkPoints Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Firstpoint | Returns a SparkColor object that represents the color and visibility of the marker for the first point of data on a sparkline. Read-only
Highpoint | Returns a SparkColor object that represents the color and visibility of the marker for the highest point of data on a sparkline. Read-only
Lastpoint | Returns a SparkColor object that represents the color and visibility of the marker for the last point of data on a sparkline. Read-only
Lowpoint | Returns a SparkColor object that represents the color and visibility of the marker for the lowest point of data on a sparkline. Read-only
Markers | Returns a SparkColor object that represents the color and visibility of markers for positive points of data on a sparkline. Read-only
Negative | Returns a SparkColor object that represents the color and visibility of markers for negative points of data on a sparkline. Read-only
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.


SparkPoints.Application Property (Excel)

 Copy code hover
[image]

SparkPoints.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparkPoints object.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Creator Property (Excel)

 Copy code hover
[image]

SparkPoints.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparkPoints object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Firstpoint Property (Excel)

 Copy code hover
[image]

SparkPoints.Firstpoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of the marker for the first point of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Firstpoint

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Firstpoint property corresponds to the setting of the First Point check box in the Show section, and of the First Point item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Highpoint Property (Excel)

 Copy code hover
[image]

SparkPoints.Highpoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of the marker for the highest point of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Highpoint

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Highpoint property corresponds to the setting of the High Point check box in the Show section, and of the High Point item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Lastpoint Property (Excel)

 Copy code hover
[image]

SparkPoints.Lastpoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of the marker for the last point of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Lastpoint

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Lastpoint property corresponds to the setting of the Last Point, check box in the Show section, and of the Last Point item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Lowpoint Property (Excel)

 Copy code hover
[image]

SparkPoints.Lowpoint Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of the marker for the lowest point of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Lowpoint

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Lowpoint property corresponds to the setting of the Low Point check box in the Show section, and of the Low Point item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Markers Property (Excel)

 Copy code hover
[image]

SparkPoints.Markers Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of markers for positive points of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Markers

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Markers property corresponds to the setting of the Markers check box in the Show section, and of the Markers item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Negative Property (Excel)

 Copy code hover
[image]

SparkPoints.Negative Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SparkColor object that represents the color and visibility of markers for negative points of data on a sparkline. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Negative

expression A variable that represents a SparkPoints object.

Return Value

SparkColor

Remarks

The Negative property corresponds to the setting of the Negative Point check box in the Show section, and of the Negative Points item on the Marker Color drop-down list in the Style section of the Sparkline Tools Design tab of the ribbon.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkPoints.Parent Property (Excel)

 Copy code hover
[image]

SparkPoints.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparkPoints object.

See also

Concepts

SparkPoints Object

Other resources

SparkPoints Object Members


SparkVerticalAxis Object (Excel)

 Copy code hover
[image]

SparkVerticalAxis Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the settings for the vertical axes of a group of sparklines.

Version Information

Version Added: Excel 2010

Remarks

Use the Vertical property of the SparkAxes object to return the SparkVerticalAxis object for group of sparklines.

See also

Concepts

Excel Object Model Reference

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis Members (Excel)

 Copy code hover
[image]

SparkVerticalAxis Members (Excel)
Send feedback

Published: July 16, 2012

Represents the settings for the vertical axes of a group of sparklines.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomMaxScaleValue | Returns or sets the custom maximum value for the vertical axis of a sparkline. Read/write
CustomMinScaleValue | Returns or sets the custom minimum value for the vertical axis of a sparkline. Read/write
MaxScaleType | Returns or sets how the maximum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write
MinScaleType | Returns or sets how the minimum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.


SparkVerticalAxis Properties (Excel)

 Copy code hover
[image]

SparkVerticalAxis Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomMaxScaleValue | Returns or sets the custom maximum value for the vertical axis of a sparkline. Read/write
CustomMinScaleValue | Returns or sets the custom minimum value for the vertical axis of a sparkline. Read/write
MaxScaleType | Returns or sets how the maximum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write
MinScaleType | Returns or sets how the minimum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write
Parent | Returns the parent SparklineGroup object for the specified object. Read-only.


SparkVerticalAxis.Application Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a SparkVerticalAxis object.

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.Creator Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a SparkVerticalAxis object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.CustomMaxScaleValue Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.CustomMaxScaleValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the custom maximum value for the vertical axis of a sparkline. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .CustomMaxScaleValue

expression A variable that represents a SparkVerticalAxis object.

Return Value

Variant

Remarks

The CustomMaxScaleValue property can be returned or set only when the MaxScaleType property of the specified SparkVerticalAxis object is set to xlSparkScaleCustom (3).

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.CustomMinScaleValue Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.CustomMinScaleValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the custom minimum value for the vertical axis of a sparkline. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .CustomMinScaleValue

expression A variable that represents a SparkVerticalAxis object.

Return Value

Variant

Remarks

The CustomMinScaleValue property can be returned or set only when the MinScaleType property of the specified SparkVerticalAxis object is set to xlSparkScaleCustom (3).

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.MaxScaleType Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.MaxScaleType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how the maximum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .MaxScaleType

expression A variable that represents a SparkVerticalAxis object.

Return Value

XlSparkScale

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.MinScaleType Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.MinScaleType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how the minimum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .MinScaleType

expression A variable that represents a SparkVerticalAxis object.

Return Value

XlSparkScale

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


SparkVerticalAxis.Parent Property (Excel)

 Copy code hover
[image]

SparkVerticalAxis.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent SparklineGroup object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a SparkVerticalAxis object.

See also

Concepts

SparkVerticalAxis Object

Other resources

SparkVerticalAxis Object Members


Speech Object (Excel)

 Copy code hover
[image]

Speech Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains methods and properties that pertain to speech.

Remarks

Use the Speech property of the Application object to return a Speech object.

Example

Once a Speech object is returned, you can use the Speak method of Speech object to play back the contents of a string. In the following example, Microsoft Excel plays back "Hello". This example assumes speech features have been installed on the host system.

Note Note

There is a speech feature in the setup tree that pertains to Dictation and Command & Control that does not have to be installed.

VBA Copy code Copy code
Sub UseSpeech()

 Application.Speech.Speak "Hello"

End Sub()

See also

Concepts

Excel Object Model Reference

Other resources

Speech Object Members


Speech Members (Excel)

 Copy code hover
[image]

Speech Members (Excel)
Send feedback

Published: July 16, 2012

Contains methods and properties that pertain to speech.

Methods

Name | Description
Speak | Microsoft Excel plays back the text string that is passed as an argument.

Properties

Name | Description
Direction | Returns or sets the order in which the cells will be spoken. The value of the Direction property is an XlSpeakDirection constant. Read/write.
SpeakCellOnEnter | Microsoft Excel supports a mode where the active cell will be spoken when the ENTER key is pressed or when the active cell is finished being edited. Setting the SpeakCellOnEnter property to True will turn this mode on. False turns this mode off. Read/write Boolean.


Speech Properties (Excel)

 Copy code hover
[image]

Speech Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Direction | Returns or sets the order in which the cells will be spoken. The value of the Direction property is an XlSpeakDirection constant. Read/write.
SpeakCellOnEnter | Microsoft Excel supports a mode where the active cell will be spoken when the ENTER key is pressed or when the active cell is finished being edited. Setting the SpeakCellOnEnter property to True will turn this mode on. False turns this mode off. Read/write Boolean.


Speech.Direction Property (Excel)

 Copy code hover
[image]

Speech.Direction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the order in which the cells will be spoken. The value of the Direction property is an XlSpeakDirection constant. Read/write.

Syntax

expression .Direction

expression A variable that represents a Speech object.

Remarks

XlSpeakDirection can be one of these XlSpeakDirection constants.

xlSpeakByColumns

xlSpeakByRows

Example

In this example, Microsoft Excel determines the speech direction and notifies the user.

VBA Copy code Copy code
Sub CheckSpeechDirection()

 ' Notify user of speech direction.
 If Application.Speech.Direction = xlSpeakByColumns Then
 MsgBox "The speech direction is set to speak by columns."
 Else
 MsgBox "The speech direction is set to speak by rows."
 End If

End Sub

See also

Concepts

Databar Object
Speech Object

Other resources

Databar Object Members
Speech Object Members


Speech.SpeakCellOnEnter Property (Excel)

 Copy code hover
[image]

Speech.SpeakCellOnEnter Property (Excel)
See also Send feedback

Published: July 16, 2012

Microsoft Excel supports a mode where the active cell will be spoken when the ENTER key is pressed or when the active cell is finished being edited. Setting the SpeakCellOnEnter property to True will turn this mode on. False turns this mode off. Read/write Boolean.

Syntax

expression .SpeakCellOnEnter

expression A variable that represents a Speech object.

Example

This example determines if the active cell will be spoken when the ENTER key is pressed or the active cell is done being edited, and notifies the user.

VBA Copy code Copy code
Sub SpeechCheck()

 ' Determine mode setting and notify user.
 If Application.Speech.SpeakCellOnEnter = True Then
 MsgBox "The Speak On Enter mode is turned on. " & _
 "The active cell will be spoken when the ENTER "& _
 "key is pressed or it is done being edited."
 Else
 MsgBox "The Speaker On Enter mode is turned off."
 End If

End Sub

See also

Concepts

Speech Object

Other resources

Speech Object Members


Speech Methods (Excel)

 Copy code hover
[image]

Speech Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Speak | Microsoft Excel plays back the text string that is passed as an argument.


Speech.Speak Method (Excel)

 Copy code hover
[image]

Speech.Speak Method (Excel)
See also Send feedback

Published: July 16, 2012

Microsoft Excel plays back the text string that is passed as an argument.

Syntax

expression .Speak(Text, SpeakAsync, SpeakXML, Purge)

expression A variable that represents a Speech object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be spoken.
SpeakAsync | Optional | Variant | True will cause the Text to be spoken asynchronously (the method will not wait of the Text to be spoken). False will cause theText to be spoken synchronously (the method waits for the Text to be spoken before continuing). The default is False.
SpeakXML | Optional | Variant | True will cause the Text to be interpreted as XML. False will cause the Text to not be interpreted as XML, so any XML tags will be read and not interpreted. The default is False.
Purge | Optional | Variant | True will cause current speech to be terminated and any buffered text to be purged before Text is spoken. False will not cause the current speech to be terminated and will not purge the buffered text before Text is spoken. The default is False.

Example

In this example, Microsoft Excel speaks "Hello".

VBA Copy code Copy code
Sub UseSpeech()

 Application.Speech.Speak "Hello"

End Sub

See also

Concepts

Speech Object

Other resources

Speech Object Members


SpellingOptions Object (Excel)

 Copy code hover
[image]

SpellingOptions Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the various spell checking options for a worksheet.

Remarks

Use the SpellingOptions property of the Application object to return a SpellingOptions object.

Once a SpellingOptions object is returned, you can use its following properties to set or return various spell checking options.

  • ArabicModes

  • DictLang

  • GermanPostReform

  • HebrewModes

  • IgnoreCaps

  • IgnoreFileNames

  • IgnoreMixedDigits

  • KoreanCombineAux

  • KoreanProcessCompound

  • KoreanUseAutoChangeList

  • SuggestMainOnly

  • UserDict

Example

The following example uses the IgnoreCaps property to disable spell checking for words that have all capitalized letters. In this example, "Testt", but not "TESTT", is identified by the spell checker.

VBA Copy code Copy code
Sub IgnoreAllCAPS()

 ' Place mispelled versions of the same word in all caps and mixed case.
 Range("A1").Formula = "Testt"
 Range("A2").Formula = "TESTT"

 With Application.SpellingOptions
 .SuggestMainOnly = True
 .IgnoreCaps = True
 End With

 ' Run a spell check.
 Cells.CheckSpelling

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

SpellingOptions Object Members


SpellingOptions Members (Excel)

 Copy code hover
[image]

SpellingOptions Members (Excel)
Send feedback

Published: July 16, 2012

Represents the various spell checking options for a worksheet.

Properties

Name | Description
ArabicModes | Returns or sets the mode for the Arabic spelling checker. Read/write XlArabicModes.
ArabicStrictAlefHamza | Returns or sets whether the spelling checker uses rules regarding Arabic words beginning with an alef hamza. Read/write
ArabicStrictFinalYaa | Returns or sets whether the spelling checker uses rules regarding Arabic words ending with the letter yaa. Read/write
ArabicStrictTaaMarboota | Returns or sets whether the spelling checker uses rules to flag Arabic words ending with haa instead of taa marboota. Read/write
BrazilReform | Returns or sets the mode for checking the spelling of Brazilian Portuguese. Read/write
DictLang | Selects the dictionary language used when Microsoft Excel performs spelling checks. Read/write Long.
GermanPostReform | True to check the spelling of words using the German post-reform rules. False cancels this feature. Read/write Boolean.
HebrewModes | Returns or sets the mode for the Hebrew spelling checker. Read/write XlHebrewModes.
IgnoreCaps | False instructs Microsoft Excel to check for uppercase words, True instructs Excel to ignore words in uppercase when using the spelling checker. Read/write Boolean.
IgnoreFileNames | False instructs Microsoft Excel to check for Internet and file addresses, True instructs Excel to ignore Internet and file addresses when using the spell checker. Read/write Boolean.
IgnoreMixedDigits | False instructs Microsoft Excel to check for mixed digits, True instructs Excel to ignore mixed digits when checking spelling. Read/write Boolean.
KoreanCombineAux | When set to True, Microsoft Excel combines Korean auxiliary verbs and adjectives when spelling is checked. Read/write Boolean.
KoreanProcessCompound | When set to True, this enables Microsoft Excel to process Korean compound nouns when using the spelling checker. Read/write Boolean.
KoreanUseAutoChangeList | When set to True, this enables Microsoft Excel to use the auto-change list for Korean words when using the spelling checker. Read/write Boolean.
PortugalReform | Returns or sets the mode for checking the spelling of European Portuguese. Read/write
RussianStrictE | Returns or sets whether the spelling checker uses rules regarding Russian words containing the character ë. Read/write
SpanishModes | Returns or sets the mode for checking the spelling of Spanish. Read/write
SuggestMainOnly | When set to True, instructs Microsoft Excel to suggest words from only the main dictionary, for using the spelling checker. False removes the limits of suggesting words from only the main dictionary, for using the spelling checker. Read/write Boolean.
UserDict | Instructs Microsoft Excel to create a custom dictionary to which new words can be added to, when performing spelling checks on a worksheet. Read/write String.


SpellingOptions Properties (Excel)

 Copy code hover
[image]

SpellingOptions Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ArabicModes | Returns or sets the mode for the Arabic spelling checker. Read/write XlArabicModes.
ArabicStrictAlefHamza | Returns or sets whether the spelling checker uses rules regarding Arabic words beginning with an alef hamza. Read/write
ArabicStrictFinalYaa | Returns or sets whether the spelling checker uses rules regarding Arabic words ending with the letter yaa. Read/write
ArabicStrictTaaMarboota | Returns or sets whether the spelling checker uses rules to flag Arabic words ending with haa instead of taa marboota. Read/write
BrazilReform | Returns or sets the mode for checking the spelling of Brazilian Portuguese. Read/write
DictLang | Selects the dictionary language used when Microsoft Excel performs spelling checks. Read/write Long.
GermanPostReform | True to check the spelling of words using the German post-reform rules. False cancels this feature. Read/write Boolean.
HebrewModes | Returns or sets the mode for the Hebrew spelling checker. Read/write XlHebrewModes.
IgnoreCaps | False instructs Microsoft Excel to check for uppercase words, True instructs Excel to ignore words in uppercase when using the spelling checker. Read/write Boolean.
IgnoreFileNames | False instructs Microsoft Excel to check for Internet and file addresses, True instructs Excel to ignore Internet and file addresses when using the spell checker. Read/write Boolean.
IgnoreMixedDigits | False instructs Microsoft Excel to check for mixed digits, True instructs Excel to ignore mixed digits when checking spelling. Read/write Boolean.
KoreanCombineAux | When set to True, Microsoft Excel combines Korean auxiliary verbs and adjectives when spelling is checked. Read/write Boolean.
KoreanProcessCompound | When set to True, this enables Microsoft Excel to process Korean compound nouns when using the spelling checker. Read/write Boolean.
KoreanUseAutoChangeList | When set to True, this enables Microsoft Excel to use the auto-change list for Korean words when using the spelling checker. Read/write Boolean.
PortugalReform | Returns or sets the mode for checking the spelling of European Portuguese. Read/write
RussianStrictE | Returns or sets whether the spelling checker uses rules regarding Russian words containing the character ë. Read/write
SpanishModes | Returns or sets the mode for checking the spelling of Spanish. Read/write
SuggestMainOnly | When set to True, instructs Microsoft Excel to suggest words from only the main dictionary, for using the spelling checker. False removes the limits of suggesting words from only the main dictionary, for using the spelling checker. Read/write Boolean.
UserDict | Instructs Microsoft Excel to create a custom dictionary to which new words can be added to, when performing spelling checks on a worksheet. Read/write String.


SpellingOptions.ArabicModes Property (Excel)

 Copy code hover
[image]

SpellingOptions.ArabicModes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Arabic spelling checker. Read/write XlArabicModes.

Syntax

expression .ArabicModes

expression A variable that represents a SpellingOptions object.

Remarks

XlArabicModes can be one of these XlArabicModes constants.

xlArabicNone . The spelling checker ignores spelling rules regarding either Arabic words ending with the letter yaa or Arabic words beginning with an alef hamza.

xlArabicBothStrict . The spelling checker uses spelling rules regarding both Arabic words ending with the letter yaa and Arabic words beginning with an alef hamza.

xlArabicStrictAlefHamza . The spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza.

xlArabicStrictFinalYaa . The spelling checker uses spelling rules regarding Arabic words ending with the letter yaa.

Example

In this example, Microsoft Excel checks the setting for the spell checking option for Arabic mode and sets it to check for words ending with the letter yaa and words beginning with an alef hamza, if the Arabic mode is not set to this already. Before running this code example, the Arabic modes option must be enabled in the spelling options.

VBA Copy code Copy code
Sub SpellCheck()

 If Application.SpellingOptions.ArabicModes <> xlArabicBothStrict Then
 Application.SpellingOptions.ArabicModes = xlArabicBothStrict
 MsgBox "Spell checking for Arabic mode has been changed to a strict setting."
 Else
 MsgBox "Spell checking for Arabic mode is already in a strict setting."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.ArabicStrictAlefHamza Property (Excel)

 Copy code hover
[image]

SpellingOptions.ArabicStrictAlefHamza Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the spelling checker uses rules regarding Arabic words beginning with an alef hamza. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ArabicStrictAlefHamza

expression A variable that represents a SpellingOptions object.

Return Value

Boolean

Remarks

True if the spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza; otherwise False.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.ArabicStrictFinalYaa Property (Excel)

 Copy code hover
[image]

SpellingOptions.ArabicStrictFinalYaa Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the spelling checker uses rules regarding Arabic words ending with the letter yaa. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ArabicStrictFinalYaa

expression A variable that represents a SpellingOptions object.

Return Value

Boolean

Remarks

True if the spelling checker uses rules regarding Arabic words ending with the letter yaa; otherwise False.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.ArabicStrictTaaMarboota Property (Excel)

 Copy code hover
[image]

SpellingOptions.ArabicStrictTaaMarboota Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the spelling checker uses rules to flag Arabic words ending with haa instead of taa marboota. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ArabicStrictTaaMarboota

expression A variable that represents a SpellingOptions object.

Return Value

Boolean

Remarks

True if the spelling checker uses rules to flag Arabic words ending with haa instead of taa marboota; otherwise False.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.BrazilReform Property (Excel)

 Copy code hover
[image]

SpellingOptions.BrazilReform Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for checking the spelling of Brazilian Portuguese. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .BrazilReform

expression A variable that represents a SpellingOptions object.

Return Value

XlPortugueseReform

Remarks

Note Note

This property does not set the mode for checking the spelling of European Portuguese. To do that, use the PortugalReform property.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.DictLang Property (Excel)

 Copy code hover
[image]

SpellingOptions.DictLang Property (Excel)
See also Send feedback

Published: July 16, 2012

Selects the dictionary language used when Microsoft Excel performs spelling checks. Read/write Long.

Syntax

expression .DictLang

expression A variable that represents a SpellingOptions object.

Example

This example sets the Excel dictionary to use the English (United States) language.

VBA Copy code Copy code
Sub LanguageSpellCheck()

 With Application.SpellingOptions
 .DictLang = 1033 ' United States English language number.
 .UserDict = "CUSTOM.DIC"
 End With

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.GermanPostReform Property (Excel)

 Copy code hover
[image]

SpellingOptions.GermanPostReform Property (Excel)
See also Send feedback

Published: July 16, 2012

True to check the spelling of words using the German post-reform rules. False cancels this feature. Read/write Boolean.

Syntax

expression .GermanPostReform

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel determines if the checking of spelling for German words is using post-reform rules and enables this feature if it's not enabled, and then notifies the user of the status.

VBA Copy code Copy code
Sub SpellingCheck()

 ' Determine if spelling check for German words is using post-reform rules.
 If Application.SpellingOptions.GermanPostReform = False Then
 Application.SpellingOptions.GermanPostReform = True
 MsgBox "German words will now use post-reform rules."
 Else
 MsgBox "German words using post-reform rules has already been set."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.HebrewModes Property (Excel)

 Copy code hover
[image]

SpellingOptions.HebrewModes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Hebrew spelling checker. Read/write XlHebrewModes.

Syntax

expression .HebrewModes

expression A variable that represents a SpellingOptions object.

Remarks

XlHebrewModes can be one of these XlHebrewModes constants.

xlHebrewFullScript (default) The conventional script type as required by the Hebrew Language Academy when writing non-diacritisized text.

xlHebrewMixedAuthorizedScript The Hebrew traditional script.

xlHebrewMixedScript In this mode the speller accepts any word recognized as Hebrew, whether in Full Script, Partial Script, or any non-conventional spelling variation what is known to the speller.

xlHebrewPartialScript In this mode the speller accepts words both in Full Script and Partial Script. Some words will be flagged since this spelling is not authorized in either Full script or Partial script.

A legitimate Hebrew word can be a basic dictionary entry or any inflection.

Example

In this example, Microsoft Excel determines the setting for the Hebrew spelling mode and notifies the user.

VBA Copy code Copy code
Sub CheckHebrewMode()

 ' Determine the Hebrew spelling mode setting and notify user.
 Select Case Application.SpellingOptions.HebrewModes
 Case xlHebrewFullScript
 MsgBox "The Hebrew spelling mode setting is Full Script."
 Case xlHebrewMixedAuthorizedScript
 MsgBox "The Hebrew spelling mode setting is Mixed Authorized Script."
 Case xlHebrewMixedScript
 MsgBox "The Hebrew spelling mode setting is Mixed Script."
 Case xlHebrewPartialScript
 MsgBox "The Hebrew spelling mode setting is Partial Script."
 End Select

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.IgnoreCaps Property (Excel)

 Copy code hover
[image]

SpellingOptions.IgnoreCaps Property (Excel)
See also Send feedback

Published: July 16, 2012

False instructs Microsoft Excel to check for uppercase words, True instructs Excel to ignore words in uppercase when using the spelling checker. Read/write Boolean.

Syntax

expression .IgnoreCaps

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel determines what the setting is for checking the spelling of uppercase words and notifies the user.

VBA Copy code Copy code
Sub SpellingOptionsCheck()

 If Application.SpellingOptions.IgnoreCaps = True Then
 MsgBox "Spelling options for checking uppercase words is disabled."
 Else
 MsgBox "Spelling options for checking uppercase words is enabled."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.IgnoreFileNames Property (Excel)

 Copy code hover
[image]

SpellingOptions.IgnoreFileNames Property (Excel)
See also Send feedback

Published: July 16, 2012

False instructs Microsoft Excel to check for Internet and file addresses, True instructs Excel to ignore Internet and file addresses when using the spell checker. Read/write Boolean.

Syntax

expression .IgnoreFileNames

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel determines what the setting is for checking spelling of Internet and file addresses and notifies the user.

VBA Copy code Copy code
Sub SpellingOptionsCheck()

 If Application.SpellingOptions.IgnoreFileNames = True Then
 MsgBox "Spelling options for checking Internet and file addresses is disabled."
 Else
 MsgBox "Spelling options for checking Internet and file addresses is enabled."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.IgnoreMixedDigits Property (Excel)

 Copy code hover
[image]

SpellingOptions.IgnoreMixedDigits Property (Excel)
See also Send feedback

Published: July 16, 2012

False instructs Microsoft Excel to check for mixed digits, True instructs Excel to ignore mixed digits when checking spelling. Read/write Boolean.

Syntax

expression .IgnoreMixedDigits

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel determines what the setting is for the checking of spelling for mixed digits and notifies the user.

VBA Copy code Copy code
Sub SpellingOptionsCheck()

 If Application.SpellingOptions.IgnoreMixedDigits = True Then
 MsgBox "Spelling options for checking mixed digits is disabled."
 Else
 MsgBox "Spelling options for checking mixed digits is enabled."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.KoreanCombineAux Property (Excel)

 Copy code hover
[image]

SpellingOptions.KoreanCombineAux Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True, Microsoft Excel combines Korean auxiliary verbs and adjectives when spelling is checked. Read/write Boolean.

Syntax

expression .KoreanCombineAux

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel checks to see if the option to combine Korean auxiliary verbs and adjectives when checking spelling is on or off and notifies the user accordingly.

VBA Copy code Copy code
Sub KoreanSpellCheck()

 If Application.SpellingOptions.KoreanCombineAux = True Then
 MsgBox "The option to combine Korean auxiliary verbs and adjectives while checking spelling is on."
 Else
 MsgBox "The option to combine Korean auxiliary verbs and adjectives while checking spelling is off."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.KoreanProcessCompound Property (Excel)

 Copy code hover
[image]

SpellingOptions.KoreanProcessCompound Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True, this enables Microsoft Excel to process Korean compound nouns when using the spelling checker. Read/write Boolean.

Syntax

expression .KoreanProcessCompound

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel checks to see if the spell checking option to process Korean compound nouns is on or off and notifies the user accordingly.

VBA Copy code Copy code
Sub KoreanSpellCheck()

 If Application.SpellingOptions.KoreanProcessCompound = True Then
 MsgBox "The spell checking feature to process Korean compound nouns is on."
 Else
 MsgBox "The spell checking feature to process Korean compound nouns is off."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.KoreanUseAutoChangeList Property (Excel)

 Copy code hover
[image]

SpellingOptions.KoreanUseAutoChangeList Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True, this enables Microsoft Excel to use the auto-change list for Korean words when using the spelling checker. Read/write Boolean.

Syntax

expression .KoreanUseAutoChangeList

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel checks to see if the spell checking option to auto-change Korean words is on or off and notifies the user accordingly.

VBA Copy code Copy code
Sub KoreanSpellCheck()

 If Application.SpellingOptions.KoreanUseAutoChangeList = True Then
 MsgBox "The spell checking feature to auto-change Korean words is on."
 Else
 MsgBox "The spell checking feature to auto-change Korean words is off."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.PortugalReform Property (Excel)

 Copy code hover
[image]

SpellingOptions.PortugalReform Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for checking the spelling of European Portuguese. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .PortugalReform

expression A variable that represents a SpellingOptions object.

Return Value

XlPortugueseReform

Remarks

Note Note

This property does not set the mode for checking the spelling of Brazilian Portuguese. To do that, use the BrazilReform property.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.RussianStrictE Property (Excel)

 Copy code hover
[image]

SpellingOptions.RussianStrictE Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the spelling checker uses rules regarding Russian words containing the character ë. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .RussianStrictE

expression A variable that represents a SpellingOptions object.

Return Value

Boolean

Remarks

True if the spelling checker uses rules regarding Russian words containing the character ë; otherwise False.

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.SpanishModes Property (Excel)

 Copy code hover
[image]

SpellingOptions.SpanishModes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for checking the spelling of Spanish. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .SpanishModes

expression A variable that represents a SpellingOptions object.

Return Value

XlSpanishModes

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.SuggestMainOnly Property (Excel)

 Copy code hover
[image]

SpellingOptions.SuggestMainOnly Property (Excel)
See also Send feedback

Published: July 16, 2012

When set to True, instructs Microsoft Excel to suggest words from only the main dictionary, for using the spelling checker. False removes the limits of suggesting words from only the main dictionary, for using the spelling checker. Read/write Boolean.

Syntax

expression .SuggestMainOnly

expression A variable that represents a SpellingOptions object.

Example

In this example, Microsoft Excel checks the spell checking options for suggesting words only from the main dictionary and reports the status to the user.

VBA Copy code Copy code
Sub UsingMainDictionary()

 ' Check the setting of suggesting words only from the main dictionary.
 If Application.SpellingOptions.SuggestMainOnly = True Then
 MsgBox "Spell checking option suggestions will only come from the main dictionary."
 Else
 MsgBox "Spell checking option suggestions are not limited to the main dictionary."
 End If

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


SpellingOptions.UserDict Property (Excel)

 Copy code hover
[image]

SpellingOptions.UserDict Property (Excel)
See also Send feedback

Published: July 16, 2012

Instructs Microsoft Excel to create a custom dictionary to which new words can be added to, when performing spelling checks on a worksheet. Read/write String.

Syntax

expression .UserDict

expression A variable that represents a SpellingOptions object.

Example

This example instructs Microsoft Excel to create custom dictionary called "Custom1.dic" in the spelling options feature and notifies the user.

VBA Copy code Copy code
Sub SpecialWord()

 Application.SpellingOptions.UserDict = "Custom1.dic"
 MsgBox "The custom dictionary is currently set to: " _
 & Application.SpellingOptions.UserDict

End Sub

See also

Concepts

SpellingOptions Object

Other resources

SpellingOptions Object Members


Style Object (Excel)

 Copy code hover
[image]

Style Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a style description for a range.

Remarks

The Style object contains all style attributes (font, number format, alignment, and so on) as properties. There are several built-in styles, including Normal, Currency, and Percent. Using the Style object is a fast and efficient way to change several cell-formatting properties on multiple cells at the same time.

For the Workbook object, the Style object is a member of the Styles collection. The Styles collection contains all the defined styles for the workbook.

You can change the appearance of a cell by changing properties of the style applied to that cell. Keep in mind, however, that changing a style property will affect all cells already formatted with that style.

Styles are sorted alphabetically by style name. The style index number denotes the position of the specified style in the sorted list of style names. Styles(1) is the first style in the alphabetic list, and Styles(Styles.Count) is the last one in the list.

For more information about creating and modifying a style, see the Styles object.

Example

Use the Style property to return the Style object used with a Range object. The following example applies the Percent style to cells A1:A10 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1:A10").Style = "Percent"

Use Styles(index), where index is the style index number or name, to return a single Style object from the workbook Styles collection. The following example changes the Normal style for the active workbook by setting the style's Bold property.

VBA Copy code Copy code
ActiveWorkbook.Styles("Normal").Font.Bold = True

See also

Concepts

Excel Object Model Reference

Other resources

Style Object Members


Style Members (Excel)

 Copy code hover
[image]

Style Members (Excel)
Send feedback

Published: July 16, 2012

Represents a style description for a range.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
AddIndent | Returns or sets a Boolean value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
BuiltIn | True if the style is a built-in style. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
FormulaHidden | Returns or sets a Boolean value that indicates if the formula will be hidden when the worksheet is protected.
HorizontalAlignment | Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.
IncludeAlignment | True if the style includes the AddIndent, HorizontalAlignment, VerticalAlignment, WrapText, IndentLevel, and Orientation properties. Read/write Boolean.
IncludeBorder | True if the style includes the Color, ColorIndex, LineStyle, and Weight border properties. Read/write Boolean.
IncludeFont | True if the style includes the Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, Size, Strikethrough, Subscript, Superscript, and Underline font properties. Read/write Boolean.
IncludeNumber | True if the style includes the NumberFormat property. Read/write Boolean
IncludePatterns | True if the style includes the Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex interior properties. Read/write Boolean.
IncludeProtection | True if the style includes the FormulaHidden and Locked protection properties. Read/write Boolean.
IndentLevel | Returns or sets a Long value that represents the indent level for the style.
Interior | Returns an Interior object that represents the interior of the specified object.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
MergeCells | True if the style contains merged cells. Read/write Variant.
Name | Returns a String value that represents the name of the object.
NameLocal | Returns or sets the name of the object, in the language of the user. Read-only String.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLocal | Returns or sets a String value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a XlOrientation value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
ShrinkToFit | Returns or sets a Boolean value that indicates if text automatically shrinks to fit in the available column width.
Value | Returns a String value that represents the name of the specified style.
VerticalAlignment | Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.
WrapText | Returns or sets a Boolean value that indicates if Microsoft Excel wraps the text in the object.


Style Properties (Excel)

 Copy code hover
[image]

Style Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddIndent | Returns or sets a Boolean value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Borders | Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
BuiltIn | True if the style is a built-in style. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object.
FormulaHidden | Returns or sets a Boolean value that indicates if the formula will be hidden when the worksheet is protected.
HorizontalAlignment | Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.
IncludeAlignment | True if the style includes the AddIndent, HorizontalAlignment, VerticalAlignment, WrapText, IndentLevel, and Orientation properties. Read/write Boolean.
IncludeBorder | True if the style includes the Color, ColorIndex, LineStyle, and Weight border properties. Read/write Boolean.
IncludeFont | True if the style includes the Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, Size, Strikethrough, Subscript, Superscript, and Underline font properties. Read/write Boolean.
IncludeNumber | True if the style includes the NumberFormat property. Read/write Boolean
IncludePatterns | True if the style includes the Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex interior properties. Read/write Boolean.
IncludeProtection | True if the style includes the FormulaHidden and Locked protection properties. Read/write Boolean.
IndentLevel | Returns or sets a Long value that represents the indent level for the style.
Interior | Returns an Interior object that represents the interior of the specified object.
Locked | Returns or sets a Boolean value that indicates if the object is locked.
MergeCells | True if the style contains merged cells. Read/write Variant.
Name | Returns a String value that represents the name of the object.
NameLocal | Returns or sets the name of the object, in the language of the user. Read-only String.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLocal | Returns or sets a String value that represents the format code for the object as a string in the language of the user.
Orientation | Returns or sets a XlOrientation value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
ShrinkToFit | Returns or sets a Boolean value that indicates if text automatically shrinks to fit in the available column width.
Value | Returns a String value that represents the name of the specified style.
VerticalAlignment | Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.
WrapText | Returns or sets a Boolean value that indicates if Microsoft Excel wraps the text in the object.


Style.AddIndent Property (Excel)

 Copy code hover
[image]

Style.AddIndent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if text is automatically indented when the text alignment in a cell is set to equal distribution (either horizontally or vertically.)

Syntax

expression .AddIndent

expression A variable that represents a Style object.

Remarks

Set the value of this property to True to autmatically indent text when the text alignment in the cell is set, either horizontally or vertically, to equal distribution.

To set text alignment to equal distribution, you can set the VerticalAlignment property to xlVAlignDistributed when the value of the Orientation property is xlVertical, and you can set the HorizontalAlignment property to xlHAlignDistributed when the value of the Orientation property is xlHorizontal.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Application Property (Excel)

 Copy code hover
[image]

Style.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Style object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Borders Property (Excel)

 Copy code hover
[image]

Style.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).

Syntax

expression .Borders

expression A variable that represents a Style object.

Example

This example sets the color of the bottom border of cell B2 on Sheet1 to a thin red border.

VBA Copy code Copy code
Sub SetRangeBorder()

 With Worksheets("Sheet1").Range("B2").Borders(xlEdgeBottom)
 .LineStyle = xlContinuous
 .Weight = xlThin
 .ColorIndex = 3
 End With

End Sub

See also

Concepts

Style Object

Other resources

Style Object Members


Style.BuiltIn Property (Excel)

 Copy code hover
[image]

Style.BuiltIn Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style is a built-in style. Read-only Boolean.

Syntax

expression .BuiltIn

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Creator Property (Excel)

 Copy code hover
[image]

Style.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Style object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Font Property (Excel)

 Copy code hover
[image]

Style.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.FormulaHidden Property (Excel)

 Copy code hover
[image]

Style.FormulaHidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the formula will be hidden when the worksheet is protected.

Syntax

expression .FormulaHidden

expression A variable that represents a Style object.

Remarks

Don't confuse this property with the Hidden property. The formula will not be hidden if the workbook is protected and the worksheet is not, but only if the worksheet is protected.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

Style.HorizontalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a Style object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludeAlignment Property (Excel)

 Copy code hover
[image]

Style.IncludeAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the AddIndent, HorizontalAlignment, VerticalAlignment, WrapText, IndentLevel, and Orientation properties. Read/write Boolean.

Syntax

expression .IncludeAlignment

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include alignment format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludeAlignment = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludeBorder Property (Excel)

 Copy code hover
[image]

Style.IncludeBorder Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the Color, ColorIndex, LineStyle, and Weight border properties. Read/write Boolean.

Syntax

expression .IncludeBorder

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include border format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludeBorder = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludeFont Property (Excel)

 Copy code hover
[image]

Style.IncludeFont Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the Background, Bold, Color, ColorIndex, FontStyle, Italic, Name, Size, Strikethrough, Subscript, Superscript, and Underline font properties. Read/write Boolean.

Syntax

expression .IncludeFont

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include font format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludeFont = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludeNumber Property (Excel)

 Copy code hover
[image]

Style.IncludeNumber Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the NumberFormat property. Read/write Boolean

Syntax

expression .IncludeNumber

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include number format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludeNumber = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludePatterns Property (Excel)

 Copy code hover
[image]

Style.IncludePatterns Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the Color, ColorIndex, InvertIfNegative, Pattern, PatternColor, and PatternColorIndex interior properties. Read/write Boolean.

Syntax

expression .IncludePatterns

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include pattern format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludePatterns = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IncludeProtection Property (Excel)

 Copy code hover
[image]

Style.IncludeProtection Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style includes the FormulaHidden and Locked protection properties. Read/write Boolean.

Syntax

expression .IncludeProtection

expression A variable that represents a Style object.

Example

This example sets the style attached to cell A1 on Sheet1 to include protection format.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Style.IncludeProtection = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.IndentLevel Property (Excel)

 Copy code hover
[image]

Style.IndentLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the indent level for the style.

Syntax

expression .IndentLevel

expression A variable that represents a Style object.

Remarks

Using this property to set the indent level to a number less than 0 (zero) or greater than 15 causes an error.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Interior Property (Excel)

 Copy code hover
[image]

Style.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object.

Syntax

expression .Interior

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Locked Property (Excel)

 Copy code hover
[image]

Style.Locked Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the object is locked.

Syntax

expression .Locked

expression A variable that represents a Style object.

Remarks

This property returns True if the object is locked or False if the object can be modified when the sheet is protected.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.MergeCells Property (Excel)

 Copy code hover
[image]

Style.MergeCells Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style contains merged cells. Read/write Variant.

Syntax

expression .MergeCells

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Name Property (Excel)

 Copy code hover
[image]

Style.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Style object.

Example

This example displays the name of style one in the active workbook, first in the language of the macro and then in the language of the user.

VBA Copy code Copy code
With ActiveWorkbook.Styles(1)
 MsgBox "The name of the style: " & .Name
 MsgBox "The localized name of the style: " & .NameLocal
End With

The following example displays the name of the default ListObject object in sheet1 of the active workbook.

VBA Copy code Copy code

Sub Test
 Dim wrksht As Worksheet
 Dim oListObj As ListObject

 Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
 Set oListObj = wrksht.ListObjects(1)

 MsgBox oListObj.Name
End Sub

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NameLocal Property (Excel)

 Copy code hover
[image]

Style.NameLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the object, in the language of the user. Read-only String.

Syntax

expression .NameLocal

expression A variable that represents a Style object.

Remarks

If the style is a built-in style, this property returns the name of the style in the language of the current locale.

Example

This example displays the name and localized name of style one in the active workbook.

VBA Copy code Copy code
With ActiveWorkbook.Styles(1)
 MsgBox "The name of the style is " & .Name
 MsgBox "The localized name of the style is " & .NameLocal
End With

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NumberFormat Property (Excel)

 Copy code hover
[image]

Style.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a Style object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

Style.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a Style object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Orientation Property (Excel)

 Copy code hover
[image]

Style.Orientation Property (Excel)
See also Send feedback

Returns or sets a XlOrientation value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Parent Property (Excel)

 Copy code hover
[image]

Style.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.ReadingOrder Property (Excel)

 Copy code hover
[image]

Style.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.ShrinkToFit Property (Excel)

 Copy code hover
[image]

Style.ShrinkToFit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if text automatically shrinks to fit in the available column width.

Syntax

expression .ShrinkToFit

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Value Property (Excel)

 Copy code hover
[image]

Style.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the specified style.

Syntax

expression .Value

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.VerticalAlignment Property (Excel)

 Copy code hover
[image]

Style.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a Style object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.WrapText Property (Excel)

 Copy code hover
[image]

Style.WrapText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if Microsoft Excel wraps the text in the object.

Syntax

expression .WrapText

expression A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style Methods (Excel)

 Copy code hover
[image]

Style Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


Style.Delete Method (Excel)

 Copy code hover
[image]

Style.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Style object.

Return Value

Variant

See also

Concepts

Style Object

Other resources

Style Object Members


Styles Object (Excel)

 Copy code hover
[image]

Styles Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Style objects in the specified or active workbook.

Remarks

Each Style object represents a style description for a range. The Style object contains all style attributes (font, number format, alignment, and so on) as properties. There are several built-in styles — including Normal, Currency, and Percent.

Example

Use the Styles property to return the Styles collection. The following example creates a list of style names on worksheet one in the active workbook.

VBA Copy code Copy code
For i = 1 To ActiveWorkbook.Styles.Count
 Worksheets(1).Cells(i, 1) = ActiveWorkbook.Styles(i).Name
Next

Use the Add method to create a new style and add it to the collection. The following example creates a new style based on the Normal style, modifies the border and font, and then applies the new style to cells A25:A30.

VBA Copy code Copy code
With ActiveWorkbook.Styles.Add(Name:="Bookman Top Border")
 .Borders(xlTop).LineStyle = xlDouble
 .Font.Bold = True
 .Font.Name = "Bookman"
End With
Worksheets(1).Range("A25:A30").Style = "Bookman Top Border"

Use Styles(index), where index is the style index number or name, to return a single Style object from the workbook Styles collection. The following example changes the Normal style for the active workbook by setting its Bold property.

VBA Copy code Copy code
ActiveWorkbook.Styles("Normal").Font.Bold = True

See also

Concepts

Excel Object Model Reference

Other resources

Styles Object Members


Styles Members (Excel)

 Copy code hover
[image]

Styles Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Style objects in the specified or active workbook.

Methods

Name | Description
Add | Creates a new style and adds it to the list of styles that are available for the current workbook.
Merge | Merges the styles from another workbook into the Styles collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Styles Properties (Excel)

 Copy code hover
[image]

Styles Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Styles.Application Property (Excel)

 Copy code hover
[image]

Styles.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Styles object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles.Count Property (Excel)

 Copy code hover
[image]

Styles.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Styles object.

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles.Creator Property (Excel)

 Copy code hover
[image]

Styles.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Styles object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles.Item Property (Excel)

 Copy code hover
[image]

Styles.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example changes the Normal style for the active workbook by setting the style's Bold property.

VBA Copy code Copy code
ActiveWorkbook.Styles.Item("Normal").Font.Bold = True

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles.Parent Property (Excel)

 Copy code hover
[image]

Styles.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Styles object.

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles Methods (Excel)

 Copy code hover
[image]

Styles Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new style and adds it to the list of styles that are available for the current workbook.
Merge | Merges the styles from another workbook into the Styles collection.


Styles.Add Method (Excel)

 Copy code hover
[image]

Styles.Add Method (Excel)
See also Send feedback

Creates a new style and adds it to the list of styles that are available for the current workbook.

Syntax

expression .Add(Name)

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The new style name.

Return Value

A Style object that represents the new style.

Example

This example defines a new style based on cell A1 on Sheet1.

VBA Copy code Copy code
With ActiveWorkbook.Styles.Add("theNewStyle")
 .IncludeNumber = False
 .IncludeFont = True
 .IncludeAlignment = False
 .IncludeBorder = False
 .IncludePatterns = False
 .IncludeProtection = False
 .Font.Name = "Arial"
 .Font.Size = 18
End With

See also

Concepts

Styles Object

Other resources

Styles Object Members


Styles.Merge Method (Excel)

 Copy code hover
[image]

Styles.Merge Method (Excel)
See also Send feedback

Published: July 16, 2012

Merges the styles from another workbook into the Styles collection.

Syntax

expression .Merge(Workbook)

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Workbook | Required | Variant | A Workbook object that represents the workbook containing styles to be merged.

Return Value

Variant

Example

This example merges the styles from the workbook Template.xls into the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Styles.Merge Workbook:=Workbooks("TEMPLATE.XLS")

See also

Concepts

Styles Object

Other resources

Styles Object Members


Tab Object (Excel)

 Copy code hover
[image]

Tab Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a tab in a chart or a worksheet.

Remarks

Use the Tab property of the Chart object or Worksheet object to return a Tab object.

Once a Tab object is returned, you can use the ColorIndex property determine the settings of a tab for a chart or worksheet.

Example

In the following example, Microsoft Excel determines if the worksheet's first tab color index is set to none and notifies the user.

VBA Copy code Copy code
Sub CheckTab()

 ' Determine if color index of 1st tab is set to none.
 If Worksheets(1).Tab.ColorIndex = xlColorIndexNone Then
 MsgBox "The color index is set to none for the first " & _
 "worksheet tab."
 Else
 MsgBox "The color index for the tab of the first worksheet " & _
 "is not set none."
 End If

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Tab Object Members


Tab Members (Excel)

 Copy code hover
[image]

Tab Members (Excel)
Send feedback

Represents a tab in a chart or a worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the specified worksheet or chart tab.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write XlThemeColor.
TintAndShade | Returns or sets a Single that lightens or darkens a color.


Tab Properties (Excel)

 Copy code hover
[image]

Tab Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
ColorIndex | Returns or sets a Variant value that represents the color of the specified worksheet or chart tab.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
ThemeColor | Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write XlThemeColor.
TintAndShade | Returns or sets a Single that lightens or darkens a color.


Tab.Application Property (Excel)

 Copy code hover
[image]

Tab.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Tab object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.Color Property (Excel)

 Copy code hover
[image]

Tab.Color Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.

Syntax

expression .Color

expression An expression that returns a Tab object.

Remarks

Object | Color
Border | The color of the border.
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero).
Font | The color of the font.
Interior | The cell shading color or the drawing object fill color.
Tab | The color of the tab.

Example

This example sets the color of the tick-mark labels on the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.ColorIndex Property (Excel)

 Copy code hover
[image]

Tab.ColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the color of the specified worksheet or chart tab.

Syntax

expression .ColorIndex

expression A variable that represents a Tab object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexNone

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.Creator Property (Excel)

 Copy code hover
[image]

Tab.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Tab object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.Parent Property (Excel)

 Copy code hover
[image]

Tab.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Tab object.

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.ThemeColor Property (Excel)

 Copy code hover
[image]

Tab.ThemeColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the theme color in the applied color scheme that is associated with the specified object. Read/write XlThemeColor.

Version Information

Version Added: Excel 2007

Syntax

expression .ThemeColor

expression A variable that represents a Tab object.

Remarks

Attempting to access a theme color for an object whose color is not currently themed will result in an invalid request run-time error.

See also

Concepts

Tab Object

Other resources

Tab Object Members


Tab.TintAndShade Property (Excel)

 Copy code hover
[image]

Tab.TintAndShade Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that lightens or darkens a color.

Version Information

Version Added: Excel 2007

Syntax

expression .TintAndShade

expression A variable that represents a Tab object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.

Attempting to set this property to a value less than -1 or more than 1, is not recommended. Excel will correct the value internally to some value that falls with the range of valid values. This property works for both theme colors and nontheme colors.

See also

Concepts

Tab Object

Other resources

Tab Object Members


TableObject Object (Excel)

 Copy code hover
[image]

TableObject Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a worksheet table built from data returned from a PowerPivot model.

Version information

Version Added: Excel 2013

Example

The following sample code creates a PowerPivot query table by connecting to a data source.

VBA Copy code Copy code
Sub CreateTable()
Dim objWBConnection As WorkbookConnection
Dim objWorksheet As Worksheet
Dim objTable As TableObject   'This is the new Table object

Set objWorksheet = ActiveWorkbook.Worksheets("Sheet1")

'Create a WorkbookConnection to the external data source first.
Set objWBConnection = ActiveWorkbook.Connections.Add2( _
        "Cubes3 AdventureWorksDW DimEmployee1", "", Array( _
        "OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=AdventureWorksDW;Data Source=MyServer;Use " _
        , _
        "Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MYWORKSTATION;Use Encryption for Data=False;Tag with co" _
        , "lumn collation when possible=False"), Array( _
        """AdventureWorksDW"".""dbo"".""DimEmployee"""), 3, True)

'Create a new table connected to the model.
Set objTable = objWorksheet.ListObjects.Add(SourceType:=xlSrcModel, Source:=objWBConnection, Destination:=Range("$A$1")).TableObject

objTable.Refresh

End Sub

See also

Other resources

TableObject Object Members


TableObject Members (Excel)

 Copy code hover
[image]

TableObject Members (Excel)
Send feedback

Published: July 16, 2012

Represents a worksheet table built from data returned from a PowerPivot model.

Methods

Name | Description
Delete | Deletes the TableObject object.
Refresh | This method updates the TableObject object.

Properties

Name | Description
AdjustColumnWidth | Specifies if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. The default value is True. Boolean Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Destination | Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the TableObject object. Range. Read-only
EnableEditing | True if the user can edit the specified query table. False if the user can only refresh the query table. Boolean Read/Write
EnableRefresh | Specifies if the query table can be refreshed by the user. Boolean Read/Write
FetchedRowOverflow | Specifies if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Boolean Read-only
ListObject | Returns a ListObject Object (Excel) object for the TableObject Object (Excel) object. Read-only
Parent | Returns an Object that represents the parent object of the specified TableObject Object (Excel) object. Read-only.
PreserveColumnInfo | Specifies if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is False. Boolean Read/Write
PreserveFormatting | True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True. Boolean Read/Write
RefreshStyle | Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a record set returned by a query. XlCellInsertionMode Enumeration (Excel) Read/Write
ResultRange | Returns a Range Object (Excel) object that represents the area of the worksheet occupied by the specified query table. Read-only
RowNumbers | Specifies if row numbers are added as the first column of the specified query table. Boolean Read/Write
WorkbookConnection | Returns the WorkbookConnection Object (Excel) used by the TableObject for connecting to the model. The WorkbookConnection.ModelConnection Property (Excel) property on the WorkbookConnection object can then be used to get to and edit DAX etc. Read-only


TableObject Properties (Excel)

 Copy code hover
[image]

TableObject Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AdjustColumnWidth | Specifies if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. The default value is True. Boolean Read/Write
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Destination | Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the TableObject object. Range. Read-only
EnableEditing | True if the user can edit the specified query table. False if the user can only refresh the query table. Boolean Read/Write
EnableRefresh | Specifies if the query table can be refreshed by the user. Boolean Read/Write
FetchedRowOverflow | Specifies if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Boolean Read-only
ListObject | Returns a ListObject Object (Excel) object for the TableObject Object (Excel) object. Read-only
Parent | Returns an Object that represents the parent object of the specified TableObject Object (Excel) object. Read-only.
PreserveColumnInfo | Specifies if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is False. Boolean Read/Write
PreserveFormatting | True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True. Boolean Read/Write
RefreshStyle | Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a record set returned by a query. XlCellInsertionMode Enumeration (Excel) Read/Write
ResultRange | Returns a Range Object (Excel) object that represents the area of the worksheet occupied by the specified query table. Read-only
RowNumbers | Specifies if row numbers are added as the first column of the specified query table. Boolean Read/Write
WorkbookConnection | Returns the WorkbookConnection Object (Excel) used by the TableObject for connecting to the model. The WorkbookConnection.ModelConnection Property (Excel) property on the WorkbookConnection object can then be used to get to and edit DAX etc. Read-only


TableObject.AdjustColumnWidth Property (Excel)

 Copy code hover
[image]

TableObject.AdjustColumnWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if the column widths are automatically adjusted for the best fit each time you refresh the specified query table. The default value is True. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .AdjustColumnWidth

expression A variable that represents a ModelTable Object (Excel) object.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.Application Property (Excel)

 Copy code hover
[image]

TableObject.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a TableObject Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.Creator Property (Excel)

 Copy code hover
[image]

TableObject.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a TableObject Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.Destination Property (Excel)

 Copy code hover
[image]

TableObject.Destination Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cell in the upper-left corner of the query table destination range (the range where the resulting query table will be placed). The destination range must be on the worksheet that contains the TableObject object. Range. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Destination

expression A variable that represents a ModelTable Object (Excel) object.

Property value

RANGE

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.EnableEditing Property (Excel)

 Copy code hover
[image]

TableObject.EnableEditing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the user can edit the specified query table. False if the user can only refresh the query table. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .EnableEditing

expression A variable that represents a ModelTable Object (Excel) object.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.EnableRefresh Property (Excel)

 Copy code hover
[image]

TableObject.EnableRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if the query table can be refreshed by the user. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .EnableRefresh

expression A variable that represents a ModelTable Object (Excel) object.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.FetchedRowOverflow Property (Excel)

 Copy code hover
[image]

TableObject.FetchedRowOverflow Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if the number of rows returned by the last use of the Refresh method is greater than the number of rows available on the worksheet. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .FetchedRowOverflow

expression A variable that represents a ModelTable Object (Excel) object.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.ListObject Property (Excel)

 Copy code hover
[image]

TableObject.ListObject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ListObject Object (Excel) object for the TableObject Object (Excel) object. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ListObject

expression A variable that represents a ModelTable Object (Excel) object.

Property value

LISTOBJECT

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.Parent Property (Excel)

 Copy code hover
[image]

TableObject.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TableObject Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a TableObject Object (Excel) object.

Property value

OBJECT

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.PreserveColumnInfo Property (Excel)

 Copy code hover
[image]

TableObject.PreserveColumnInfo Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if column sorting, filtering, and layout information is preserved whenever a query table is refreshed. The default value is False. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .PreserveColumnInfo

expression A variable that represents a TableObject object.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.PreserveFormatting Property (Excel)

 Copy code hover
[image]

TableObject.PreserveFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren't formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .PreserveFormatting

expression A variable that represents a TableObjectobject.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.RefreshStyle Property (Excel)

 Copy code hover
[image]

TableObject.RefreshStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a record set returned by a query. XlCellInsertionMode Enumeration (Excel) Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .RefreshStyle

expression A variable that represents a TableObject object.

Property value

XLCELLINSERTIONMODE

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.ResultRange Property (Excel)

 Copy code hover
[image]

TableObject.ResultRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range Object (Excel) object that represents the area of the worksheet occupied by the specified query table. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ResultRange

expression A variable that represents a TableObjectobject.

Property value

RANGE

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.RowNumbers Property (Excel)

 Copy code hover
[image]

TableObject.RowNumbers Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies if row numbers are added as the first column of the specified query table. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .RowNumbers

expression A variable that represents a TableObjectobject.

Property value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.WorkbookConnection Property (Excel)

 Copy code hover
[image]

TableObject.WorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the WorkbookConnection Object (Excel) used by the TableObject for connecting to the model. The WorkbookConnection.ModelConnection Property (Excel) property on the WorkbookConnection object can then be used to get to and edit DAX etc. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .WorkbookConnection

expression A variable that represents a TableObject object.

Property value

WORKBOOKCONNECTION

See also

Other resources

TableObject Object Members
TableObject Object


TableObject Methods (Excel)

 Copy code hover
[image]

TableObject Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the TableObject object.
Refresh | This method updates the TableObject object.


TableObject.Delete Method (Excel)

 Copy code hover
[image]

TableObject.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the TableObject object.

Version information

Version Added: Excel 2013

Syntax

expression .Delete

expression A variable that represents a ModelTable Object (Excel) object.

Return value

VOID

See also

Other resources

TableObject Object Members
TableObject Object


TableObject.Refresh Method (Excel)

 Copy code hover
[image]

TableObject.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

This method updates the TableObject object.

Version information

Version Added: Excel 2013

Syntax

expression .Refresh

expression A variable that represents a ModelTable Object (Excel) object.

Return value

BOOL

See also

Other resources

TableObject Object Members
TableObject Object


TableStyle Object (Excel)

 Copy code hover
[image]

TableStyle Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single style that can be applied to a table or slicer.

Version Information

Version Added: Excel 2007

Remarks

A table style defines the formatting for one or all of the elements of a table, PivotTable, or slicer. For example, a column is an element of a table. A table style can define that columns in a table are formatted with alternating formatting (also known as banding or stripes).

See also

Concepts

Excel Object Model Reference

Other resources

TableStyle Object Members


TableStyle Members (Excel)

 Copy code hover
[image]

TableStyle Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single style that can be applied to a table or slicer.

Methods

Name | Description
Delete | Deletes the TableStyle object.
Duplicate | Duplicates the TableStyle object and returns a reference to the new copy.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BuiltIn | True if the style is a built-in style. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns the name of the object. Read-only String.
NameLocal | Returns or sets the name of the object, in the language of the user. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
ShowAsAvailablePivotTableStyle | Sets or returns if a style is shown in the gallery for PivotTable styles or not. Read/write Boolean.
ShowAsAvailableSlicerStyle | Returns or sets if the specified table style is shown as available in the slicer styles gallery. Read/write
ShowAsAvailableTableStyle | Returns or sets a table style shown as available in the table styles gallery. Read/write Boolean.
ShowAsAvailableTimelineStyle | Returns or sets whether the specified table style is shown as available in the timeline styles gallery. Boolean. Read/write
TableStyleElements | Returns the TableStyleElements object. Read-only.


TableStyle Properties (Excel)

 Copy code hover
[image]

TableStyle Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
BuiltIn | True if the style is a built-in style. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns the name of the object. Read-only String.
NameLocal | Returns or sets the name of the object, in the language of the user. Read-only String.
Parent | Returns the parent object for the specified object. Read-only.
ShowAsAvailablePivotTableStyle | Sets or returns if a style is shown in the gallery for PivotTable styles or not. Read/write Boolean.
ShowAsAvailableSlicerStyle | Returns or sets if the specified table style is shown as available in the slicer styles gallery. Read/write
ShowAsAvailableTableStyle | Returns or sets a table style shown as available in the table styles gallery. Read/write Boolean.
ShowAsAvailableTimelineStyle | Returns or sets whether the specified table style is shown as available in the timeline styles gallery. Boolean. Read/write
TableStyleElements | Returns the TableStyleElements object. Read-only.


TableStyle.Application Property (Excel)

 Copy code hover
[image]

TableStyle.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a TableStyle object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.BuiltIn Property (Excel)

 Copy code hover
[image]

TableStyle.BuiltIn Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the style is a built-in style. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .BuiltIn

expression A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Creator Property (Excel)

 Copy code hover
[image]

TableStyle.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TableStyle object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Name Property (Excel)

 Copy code hover
[image]

TableStyle.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .Name

expression A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.NameLocal Property (Excel)

 Copy code hover
[image]

TableStyle.NameLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the object, in the language of the user. Read-only String.

Version Information

Version Added: Excel 2007

Syntax

expression .NameLocal

expression A variable that represents a TableStyle object.

Remarks

If the style is a built-in style, this property returns the name of the style in the language of the current locale.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Parent Property (Excel)

 Copy code hover
[image]

TableStyle.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.ShowAsAvailablePivotTableStyle Property (Excel)

 Copy code hover
[image]

TableStyle.ShowAsAvailablePivotTableStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets or returns if a style is shown in the gallery for PivotTable styles or not. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowAsAvailablePivotTableStyle

expression A variable that represents a TableStyle object.

Remarks

The property returns True, if the style is shown in the gallery for PivotTable styles.

Note Note

Users can set the ShowAsAvailableTableStyle or ShowAsAvailablePivotTableStyle properties to False even when the style is already applied to a table or PivotTable. In this case, the gallery will not show the style and no style is shown as selected when the active cell is in the table or the PivotTable.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.ShowAsAvailableSlicerStyle Property (Excel)

 Copy code hover
[image]

TableStyle.ShowAsAvailableSlicerStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the specified table style is shown as available in the slicer styles gallery. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .ShowAsAvailableSlicerStyle

expression A variable that represents a TableStyle object.

Return Value

Boolean

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.ShowAsAvailableTableStyle Property (Excel)

 Copy code hover
[image]

TableStyle.ShowAsAvailableTableStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a table style shown as available in the table styles gallery. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowAsAvailableTableStyle

expression A variable that represents a TableStyle object.

Remarks

If True, this style is shown in the gallery for table styles.

You can set this property to False even when the style is already applied to a table. In this case the gallery will not show the style and when the active cell is in that table, no style is shown as selected.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.ShowAsAvailableTimelineStyle Property (Excel)

 Copy code hover
[image]

TableStyle.ShowAsAvailableTimelineStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified table style is shown as available in the timeline styles gallery. Boolean. Read/write

Version information

Version Added: Excel 2013

Syntax

expression .ShowAsAvailableTimelineStyle

expression A variable that represents a TableStyle Object (Excel) object.

Property value

BOOL

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.TableStyleElements Property (Excel)

 Copy code hover
[image]

TableStyle.TableStyleElements Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the TableStyleElements object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TableStyleElements

expression A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle Methods (Excel)

 Copy code hover
[image]

TableStyle Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the TableStyle object.
Duplicate | Duplicates the TableStyle object and returns a reference to the new copy.


TableStyle.Delete Method (Excel)

 Copy code hover
[image]

TableStyle.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the TableStyle object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a TableStyle object.

Return Value

Nothing

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Duplicate Method (Excel)

 Copy code hover
[image]

TableStyle.Duplicate Method (Excel)
See also Send feedback

Published: July 16, 2012

Duplicates the TableStyle object and returns a reference to the new copy.

Version Information

Version Added: Excel 2007

Syntax

expression .Duplicate(NewTableStyleName)

expression A variable that represents a TableStyle object.

Parameters

Name | Required/Optional | Data Type | Description
NewTableStyleName | Optional | Variant | The name of the new table style.

Return Value

TableStyle

Remarks

If no name is specified, the Duplicate method uses the same default name as the user interface.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyleElement Object (Excel)

 Copy code hover
[image]

TableStyleElement Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a single table style element.

Version Information

Version Added: Excel 2007

Remarks

Table styles define formatting for one or all of the elements of a table, PivotTable, or slicer. For example, a header row is an element of a table. A table style can define that the fill color of the header row is red.

Each table style element in a table can have formatting specified in a table style applied to the element.

See also

Concepts

Excel Object Model Reference

Other resources

TableStyleElement Object Members


TableStyleElement Members (Excel)

 Copy code hover
[image]

TableStyleElement Members (Excel)
Send feedback

Published: July 16, 2012

Represents a single table style element.

Methods

Name | Description
Clear | Clears the formatting for this element.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Borders | Returns a Borders collection that represents the borders of a table style element. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object. Read-only.
HasFormat | Returns whether a table style element has formatting applied to the specified element. Read-only Boolean.
Interior | Returns an Interior object that represents the interior of the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
StripeSize | Returns or sets the size of banding. Read/write Long.


TableStyleElement Properties (Excel)

 Copy code hover
[image]

TableStyleElement Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Borders | Returns a Borders collection that represents the borders of a table style element. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that represents the font of the specified object. Read-only.
HasFormat | Returns whether a table style element has formatting applied to the specified element. Read-only Boolean.
Interior | Returns an Interior object that represents the interior of the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
StripeSize | Returns or sets the size of banding. Read/write Long.


TableStyleElement.Application Property (Excel)

 Copy code hover
[image]

TableStyleElement.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a TableStyleElement object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.Borders Property (Excel)

 Copy code hover
[image]

TableStyleElement.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents the borders of a table style element. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Borders

expression A variable that represents a TableStyleElement object.

Example

This example sets the color of the top border of a table to red.

VBA Copy code Copy code
With ActiveWorkbook.TableStyles("Table Style 4").TableStyleElements( _
 xlWholeTable).Borders(xlEdgeTop)
 .Color = 255
 .TintAndShade = 0
 .Weight = 2
 .LineStyle = 1
End With

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.Creator Property (Excel)

 Copy code hover
[image]

TableStyleElement.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TableStyleElement object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.Font Property (Excel)

 Copy code hover
[image]

TableStyleElement.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Font

expression A variable that represents a TableStyleElement object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.HasFormat Property (Excel)

 Copy code hover
[image]

TableStyleElement.HasFormat Property (Excel)
See also Send feedback

Returns whether a table style element has formatting applied to the specified element. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .HasFormat

expression A variable that represents a TableStyleElement object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.Interior Property (Excel)

 Copy code hover
[image]

TableStyleElement.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Interior

expression A variable that represents a TableStyleElement object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.Parent Property (Excel)

 Copy code hover
[image]

TableStyleElement.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a TableStyleElement object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement.StripeSize Property (Excel)

 Copy code hover
[image]

TableStyleElement.StripeSize Property (Excel)
See also Send feedback

Returns or sets the size of banding. Read/write Long.

Version Information

Version Added: Excel 2007

Syntax

expression .StripeSize

expression A variable that represents a TableStyleElement object.

Remarks

This property does not apply to all TableStyleElement objects. It applies only to xlColumnStripe1, xlColumnStripe2, xlRowStripe1 and xlRowStripe2 types.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElement Methods (Excel)

 Copy code hover
[image]

TableStyleElement Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Clears the formatting for this element.


TableStyleElement.Clear Method (Excel)

 Copy code hover
[image]

TableStyleElement.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting for this element.

Version Information

Version Added: Excel 2007

Syntax

expression .Clear

expression A variable that represents a TableStyleElement object.

See also

Concepts

TableStyleElement Object

Other resources

TableStyleElement Object Members


TableStyleElements Object (Excel)

 Copy code hover
[image]

TableStyleElements Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents table style elements.

Version Information

Version Added: Excel 2007

Remarks

Table styles define formatting for one or all of the elements of a table, PivotTable, or slicer. For example, a header row, last column, or total row are elements of a table and a table style can define that the fill color of the header row is blue, the last column is red.

A table style element in a table can have formatting specified in a table style applied to the element. XlTableStyleElementType enumeration contains the types of table style element that are available for use.

See also

Concepts

Excel Object Model Reference

Other resources

TableStyleElements Object Members


TableStyleElements Members (Excel)

 Copy code hover
[image]

TableStyleElements Members (Excel)
Send feedback

Published: July 16, 2012

Represents table style elements.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


TableStyleElements Properties (Excel)

 Copy code hover
[image]

TableStyleElements Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


TableStyleElements.Application Property (Excel)

 Copy code hover
[image]

TableStyleElements.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a TableStyleElements object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

TableStyleElements Object

Other resources

TableStyleElements Object Members


TableStyleElements.Count Property (Excel)

 Copy code hover
[image]

TableStyleElements.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a TableStyleElements object.

See also

Concepts

TableStyleElements Object

Other resources

TableStyleElements Object Members


TableStyleElements.Creator Property (Excel)

 Copy code hover
[image]

TableStyleElements.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TableStyleElements object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TableStyleElements Object

Other resources

TableStyleElements Object Members


TableStyleElements.Parent Property (Excel)

 Copy code hover
[image]

TableStyleElements.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a TableStyleElements object.

See also

Concepts

TableStyleElements Object

Other resources

TableStyleElements Object Members


TableStyleElements Methods (Excel)

 Copy code hover
[image]

TableStyleElements Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


TableStyleElements.Item Method (Excel)

 Copy code hover
[image]

TableStyleElements.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a TableStyleElements object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | XlTableStyleElementType | A table style element.

Return Value

TableStyleElement

See also

Concepts

TableStyleElements Object

Other resources

TableStyleElements Object Members


TableStyles Object (Excel)

 Copy code hover
[image]

TableStyles Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents styles that can be applied to a table.

Version Information

Version Added: Excel 2007

Remarks

Table styles provide a way to format an entire table or Pivot Table. Table styles replaces the existing auto format feature for formatting an entire table.

Table styles differ from auto format in the following ways:

  • You can create and reuse custom table styles.

  • Table styles work with themes.

  • Changing the document theme color scheme and/or font scheme will change the look of the built-in table styles.

  • Table styles can reapply styles to objects like PivotTables and tables as the object changes. The tables will remember the style applied to them and will re-display appropriately when cells are added, removed, hidden, and shown.

  • Table styles have a visual user interface in the ribbon.

See also

Concepts

Excel Object Model Reference

Other resources

TableStyles Object Members


TableStyles Members (Excel)

 Copy code hover
[image]

TableStyles Members (Excel)
Send feedback

Published: July 16, 2012

Represents styles that can be applied to a table.

Methods

Name | Description
Add | Creates a new TableStyle object and adds it to the collection.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


TableStyles Properties (Excel)

 Copy code hover
[image]

TableStyles Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


TableStyles.Application Property (Excel)

 Copy code hover
[image]

TableStyles.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a TableStyles object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TableStyles.Count Property (Excel)

 Copy code hover
[image]

TableStyles.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Count

expression A variable that represents a TableStyles object.

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TableStyles.Creator Property (Excel)

 Copy code hover
[image]

TableStyles.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TableStyles object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TableStyles.Parent Property (Excel)

 Copy code hover
[image]

TableStyles.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a TableStyles object.

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TableStyles Methods (Excel)

 Copy code hover
[image]

TableStyles Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new TableStyle object and adds it to the collection.
Item | Returns a single object from a collection.


TableStyles.Add Method (Excel)

 Copy code hover
[image]

TableStyles.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new TableStyle object and adds it to the collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Add(TableStyleName)

expression A variable that represents a TableStyles object.

Parameters

Name | Required/Optional | Data Type | Description
TableStyleName | Required | String | The name of the table style.

Return Value

TableStyle

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TableStyles.Item Method (Excel)

 Copy code hover
[image]

TableStyles.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Excel 2007

Syntax

expression .Item(Index)

expression A variable that represents a TableStyles object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

TableStyle

See also

Concepts

TableStyles Object

Other resources

TableStyles Object Members


TextConnection Object (Excel)

 Copy code hover
[image]

TextConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source.

Version information

Version Added: Excel 2013

See also

Other resources

TextConnection Object Members


TextConnection Members (Excel)

 Copy code hover
[image]

TextConnection Members (Excel)
Send feedback

Published: July 16, 2012

Contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Connection | Returns or sets a string that contains text file names that enable Microsoft Excel to connect to text data sources. Variant Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TextConnection Object (Excel) object. Read-only.
TextFileColumnDataTypes | Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you're importing into a query table. The default constant for each column is xlGeneral. Variant. Read/Write
TextFileCommaDelimiter | True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/Write Boolean.
TextFileConsecutiveDelimiter | True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Boolean Read/Write
TextFileDecimalSeparator | Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/Write String.
TextFileFixedColumnWidths | Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/Write Variant.
TextFileHeaderRow | Returns or sets value that specifies whether or not the first row (from the starting row) should be treated as a header row. Boolean Read/Write
TextFileOtherDelimiter | Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/Write String.
TextFileParseType | Returns or sets the column format for the data in the text file that you're importing into a query table. Read/Write XlTextParsingType Enumeration (Excel)
TextFilePlatform | Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform Enumeration (Excel)
TextFilePromptOnRefresh | True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/Write Boolean.
TextFileSemicolonDelimiter | True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextConnection.TextFileParseType Property (Excel) property is xlDelimited. The default value is False. Read/Write Boolean.
TextFileSpaceDelimiter | True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean
TextFileStartRow | Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/Write Long.
TextFileTabDelimiter | True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean
TextFileTextQualifier | Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/Write XlTextQualifier Enumeration (Excel)
TextFileThousandsSeparator | Returns or sets the thousands separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/Write String
TextFileTrailingMinusNumbers | True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/Write Boolean
TextFileVisualLayout | Returns or sets a XlTextVisualLayoutType Enumeration (Excel) enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left. Read/Write


TextConnection Properties (Excel)

 Copy code hover
[image]

TextConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Connection | Returns or sets a string that contains text file names that enable Microsoft Excel to connect to text data sources. Variant Read/Write
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TextConnection Object (Excel) object. Read-only.
TextFileColumnDataTypes | Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you're importing into a query table. The default constant for each column is xlGeneral. Variant. Read/Write
TextFileCommaDelimiter | True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/Write Boolean.
TextFileConsecutiveDelimiter | True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Boolean Read/Write
TextFileDecimalSeparator | Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/Write String.
TextFileFixedColumnWidths | Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/Write Variant.
TextFileHeaderRow | Returns or sets value that specifies whether or not the first row (from the starting row) should be treated as a header row. Boolean Read/Write
TextFileOtherDelimiter | Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/Write String.
TextFileParseType | Returns or sets the column format for the data in the text file that you're importing into a query table. Read/Write XlTextParsingType Enumeration (Excel)
TextFilePlatform | Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform Enumeration (Excel)
TextFilePromptOnRefresh | True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/Write Boolean.
TextFileSemicolonDelimiter | True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextConnection.TextFileParseType Property (Excel) property is xlDelimited. The default value is False. Read/Write Boolean.
TextFileSpaceDelimiter | True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean
TextFileStartRow | Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/Write Long.
TextFileTabDelimiter | True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean
TextFileTextQualifier | Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/Write XlTextQualifier Enumeration (Excel)
TextFileThousandsSeparator | Returns or sets the thousands separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/Write String
TextFileTrailingMinusNumbers | True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/Write Boolean
TextFileVisualLayout | Returns or sets a XlTextVisualLayoutType Enumeration (Excel) enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left. Read/Write


TextConnection.Application Property (Excel)

 Copy code hover
[image]

TextConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a TextConnection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.Connection Property (Excel)

 Copy code hover
[image]

TextConnection.Connection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that contains text file names that enable Microsoft Excel to connect to text data sources. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .Connection

expression A variable that represents a TextConnection object.

Property value

VARIANT

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.Creator Property (Excel)

 Copy code hover
[image]

TextConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a TextConnection Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.Parent Property (Excel)

 Copy code hover
[image]

TextConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextConnection Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a TextConnection Object (Excel) object.

Property value

OBJECT

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileColumnDataTypes Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileColumnDataTypes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an ordered array of constants that specify the data types applied to the corresponding columns in the text file that you're importing into a query table. The default constant for each column is xlGeneral. Variant. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .TextFileColumnDataTypes

expression A variable that represents a TextConnection object.

Property value

VARIANT

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileCommaDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileCommaDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the comma is the delimiter when you import a text file into a query table. False if you want to use some other character as the delimiter. The default value is False. Read/Write Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileCommaDelimiter

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileConsecutiveDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileConsecutiveDelimiter Property (Excel)
See also Send feedback

True if consecutive delimiters are treated as a single delimiter when you import a text file into a query table. The default value is False. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .TextFileConsecutiveDelimiter

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileDecimalSeparator Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileDecimalSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the decimal separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system decimal separator character. Read/Write String.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileDecimalSeparator

expression A variable that represents a TextConnection object.

Property value

STRING

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileFixedColumnWidths Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileFixedColumnWidths Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an array of integers that correspond to the widths of the columns (in characters) in the text file that you're importing into a query table. Valid widths are from 1 through 32767 characters. Read/Write Variant.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileFixedColumnWidths

expression A variable that represents a TextConnection object.

Property value

VARIANT

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileHeaderRow Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileHeaderRow Property (Excel)
See also Send feedback

Returns or sets value that specifies whether or not the first row (from the starting row) should be treated as a header row. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .TextFileHeaderRow

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileOtherDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileOtherDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the character used as the delimiter when you import a text file into a query table. The default value is null. Read/Write String.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileOtherDelimiter

expression A variable that represents a TextConnection object.

Property value

STRING

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileParseType Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileParseType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the column format for the data in the text file that you're importing into a query table. Read/Write XlTextParsingType Enumeration (Excel)

Version information

Version Added: Excel 2013

Syntax

expression .TextFileParseType

expression A variable that represents a TextConnection object.

Property value

XLTEXTPARSINGTYPE

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFilePlatform Property (Excel)

 Copy code hover
[image]

TextConnection.TextFilePlatform Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the origin of the text file you're importing into the query table. This property determines which code page is used during the data import. Read/write XlPlatform Enumeration (Excel)

Version information

Version Added: Excel 2013

Syntax

expression .TextFilePlatform

expression A variable that represents a TextConnection object.

Property value

XLPLATFORM

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFilePromptOnRefresh Property (Excel)

 Copy code hover
[image]

TextConnection.TextFilePromptOnRefresh Property (Excel)
See also Send feedback

Published: July 16, 2012

True if you want to specify the name of the imported text file each time the query table is refreshed. The Import Text File dialog box allows you to specify the path and file name. The default value is False. Read/Write Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .TextFilePromptOnRefresh

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileSemicolonDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileSemicolonDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the semicolon is the delimiter when you import a text file into a query table, and if the value of the TextConnection.TextFileParseType Property (Excel) property is xlDelimited. The default value is False. Read/Write Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileSemicolonDelimiter

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileSpaceDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileSpaceDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the space character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean

Version information

Version Added: Excel 2013

Syntax

expression .TextFileSpaceDelimiter

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileStartRow Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileStartRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the row number at which text parsing will begin when you import a text file into a query table. Valid values are integers from 1 through 32767. The default value is 1. Read/Write Long.

Version information

Version Added: Excel 2013

Syntax

expression .TextFileStartRow

expression A variable that represents a TextConnection object.

Property value

INT32

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileTabDelimiter Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileTabDelimiter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the tab character is the delimiter when you import a text file into a query table. The default value is False. Read/Write Boolean

Version information

Version Added: Excel 2013

Syntax

expression .TextFileTabDelimiter

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileTextQualifier Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileTextQualifier Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text qualifier when you import a text file into a query table. The text qualifier specifies that the enclosed data is in text format. Read/Write XlTextQualifier Enumeration (Excel)

Version information

Version Added: Excel 2013

Syntax

expression .TextFileTextQualifier

expression A variable that represents a TextConnection object.

Property value

XLTEXTQUALIFIER

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileThousandsSeparator Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileThousandsSeparator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the thousands separator character that Microsoft Excel uses when you import a text file into a query table. The default is the system thousands separator character. Read/Write String

Version information

Version Added: Excel 2013

Syntax

expression .TextFileThousandsSeparator

expression A variable that represents a TextConnection object.

Property value

STRING

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileTrailingMinusNumbers Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileTrailingMinusNumbers Property (Excel)
See also Send feedback

Published: July 16, 2012

True for Microsoft Excel to treat numbers imported as text that begin with a "-" symbol as a negative symbol. False for Excel to treat numbers imported as text that begin with a "-" symbol as text. Read/Write Boolean

Version information

Version Added: Excel 2013

Syntax

expression .TextFileTrailingMinusNumbers

expression A variable that represents a TextConnection object.

Property value

BOOL

See also

Other resources

TextConnection Object Members
TextConnection Object


TextConnection.TextFileVisualLayout Property (Excel)

 Copy code hover
[image]

TextConnection.TextFileVisualLayout Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlTextVisualLayoutType Enumeration (Excel) enumeration that indicates whether the visual layout of the text being imported is left-to-right or right-to-left. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .TextFileVisualLayout

expression A variable that represents a TextConnection object.

Property value

XLTEXTVISUALLAYOUTTYPE

See also

Other resources

TextConnection Object Members
TextConnection Object


TextEffectFormat Object (Excel)

 Copy code hover
[image]

TextEffectFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to WordArt objects.

Remarks

Use the TextEffect property to return a TextEffectFormat object.

Example

The following example sets the font name and formatting for shape one on myDocument. For this example to work, shape one must be a WordArt object.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).TextEffect
 .FontName = "Courier New"
 .FontBold = True
 .FontItalic = True
End With

See also

Concepts

Excel Object Model Reference

Other resources

TextEffectFormat Object Members


TextEffectFormat Members (Excel)

 Copy code hover
[image]

TextEffectFormat Members (Excel)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to WordArt objects.

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Properties

Name | Description
Alignment | Returns or sets an MsoTextEffectAlignment value that represents the alignment for WordArt.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FontBold | True if the font in the specified WordArt is bold. Read/write MsoTriState.
FontItalic | Returns msoTrue if the font in the specified WordArt is italic. Read/write MsoTriState.
FontName | Returns or sets the name of the font in the specified WordArt. Read/write String.
FontSize | Returns or sets the font size for the specified WordArt, in points. Read/write Single.
KernedPairs | True if character pairs in the specified WordArt are kerned. Read/write MsoTriState.
NormalizedHeight | True if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.
Parent | Returns the parent object for the specified object. Read-only.
PresetShape | Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.
PresetTextEffect | Returns or sets the style of the specified WordArt. Read/write MsoPresetTextEffect.
RotatedChars | True if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. False if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.
Text | Returns or sets the text for the specified object. Read/write String.
Tracking | Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt to the width of the character. Can be a value from 0 (zero) through 5. (Large values for this property specify ample space between characters; values less than 1 can produce character overlap.) Read/write Single.


TextEffectFormat Properties (Excel)

 Copy code hover
[image]

TextEffectFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets an MsoTextEffectAlignment value that represents the alignment for WordArt.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
FontBold | True if the font in the specified WordArt is bold. Read/write MsoTriState.
FontItalic | Returns msoTrue if the font in the specified WordArt is italic. Read/write MsoTriState.
FontName | Returns or sets the name of the font in the specified WordArt. Read/write String.
FontSize | Returns or sets the font size for the specified WordArt, in points. Read/write Single.
KernedPairs | True if character pairs in the specified WordArt are kerned. Read/write MsoTriState.
NormalizedHeight | True if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.
Parent | Returns the parent object for the specified object. Read-only.
PresetShape | Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.
PresetTextEffect | Returns or sets the style of the specified WordArt. Read/write MsoPresetTextEffect.
RotatedChars | True if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. False if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.
Text | Returns or sets the text for the specified object. Read/write String.
Tracking | Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt to the width of the character. Can be a value from 0 (zero) through 5. (Large values for this property specify ample space between characters; values less than 1 can produce character overlap.) Read/write Single.


TextEffectFormat.Alignment Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Alignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTextEffectAlignment value that represents the alignment for WordArt.

Syntax

expression .Alignment

expression A variable that represents a TextEffectFormat object.

Example

This example adds a WordArt object to worksheet one and then right aligns the WordArt.

VBA Copy code Copy code
Set mySh = Worksheets(1).Shapes
Set myTE = mySh.AddTextEffect(PresetTextEffect:=msoTextEffect1, _
    Text:="Test Text", FontName:="Palatino", FontSize:=54, _
    FontBold:=True, FontItalic:=False, Left:=100, Top:=50)
myTE.TextEffect.Alignment = msoTextEffectAlignmentRight

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Application Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a TextEffectFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Creator Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TextEffectFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontBold Property (Excel)

 Copy code hover
[image]

TextEffectFormat.FontBold Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the font in the specified WordArt is bold. Read/write MsoTriState.

Syntax

expression .FontBold

expression A variable that represents a TextEffectFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue The specified WordArt is bold.

Example

This example sets the font to bold for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
    If .Type = msoTextEffect Then
        .TextEffect.FontBold = msoTrue
    End If
End With

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontItalic Property (Excel)

 Copy code hover
[image]

TextEffectFormat.FontItalic Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns msoTrue if the font in the specified WordArt is italic. Read/write MsoTriState.

Syntax

expression .FontItalic

expression A variable that represents a TextEffectFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue Does not apply to this property.

msoFalse The specified WordArt is not italic.

msoTriStateMixed Does not apply to this property.

msoTriStateToggle Does not apply to this property.

msoTrue The specified WordArt is italic.

Example

This example sets the font to italic for the shape named "WordArt 4" in myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes("WordArt 4").TextEffect.FontItalic = msoTrue

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontName Property (Excel)

 Copy code hover
[image]

TextEffectFormat.FontName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the font in the specified WordArt. Read/write String.

Syntax

expression .FontName

expression A variable that represents a TextEffectFormat object.

Example

This example sets the font name to "Courier New" for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontName = "Courier New"
 End If
End With

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontSize Property (Excel)

 Copy code hover
[image]

TextEffectFormat.FontSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the font size for the specified WordArt, in points. Read/write Single.

Syntax

expression .FontSize

expression A variable that represents a TextEffectFormat object.

Example

This example sets the font size to 16 points for the shape named "WordArt 4" in myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes("WordArt 4").TextEffect.FontSize = 16

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.KernedPairs Property (Excel)

 Copy code hover
[image]

TextEffectFormat.KernedPairs Property (Excel)
See also Send feedback

Published: July 16, 2012

True if character pairs in the specified WordArt are kerned. Read/write MsoTriState.

Syntax

expression .KernedPairs

expression A variable that represents a TextEffectFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue Character pairs in the specified WordArt are kerned.

Example

This example turns on character pair kerning for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.KernedPairs = msoTrue
 End If
End With

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.NormalizedHeight Property (Excel)

 Copy code hover
[image]

TextEffectFormat.NormalizedHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

True if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.

Syntax

expression .NormalizedHeight

expression A variable that represents a TextEffectFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue All characters (both uppercase and lowercase) in the specified WordArt are the same height.

Example

This example adds WordArt that contains the text "Test Effect" to myDocument and gives the new WordArt the name "texteff1." The code then makes all characters in the shape named "texteff1" the same height.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, _
 Text:="Test Effect", FontName:="Courier New", _
 FontSize:=44, FontBold:=True, _
 FontItalic:=False, Left:=10, Top:=10).Name = "texteff1"
myDocument.Shapes("texteff1").TextEffect.NormalizedHeight = msoTrue

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Parent Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextEffectFormat object.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.PresetShape Property (Excel)

 Copy code hover
[image]

TextEffectFormat.PresetShape Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.

Syntax

expression .PresetShape

expression A variable that represents a TextEffectFormat object.

Remarks

MsoPresetTextEffectShape can be one of these MsoPresetTextEffectShape constants.

msoTextEffectShapeArchDownCurve

msoTextEffectShapeArchDownPour

msoTextEffectShapeArchUpCurve

msoTextEffectShapeArchUpPour

msoTextEffectShapeButtonCurve

msoTextEffectShapeButtonPour

msoTextEffectShapeCanDown

msoTextEffectShapeCanUp

msoTextEffectShapeCascadeDown

msoTextEffectShapeCascadeUp

msoTextEffectShapeChevronDown

msoTextEffectShapeChevronUp

msoTextEffectShapeCircleCurve

msoTextEffectShapeCirclePour

msoTextEffectShapeCurveDown

msoTextEffectShapeCurveUp

msoTextEffectShapeDeflate

msoTextEffectShapeDeflateBottom

msoTextEffectShapeDeflateInflateDeflate

msoTextEffectShapeDoubleWave1

msoTextEffectShapeFadeDown

msoTextEffectShapeFadeRight

msoTextEffectShapeInflate

msoTextEffectShapeInflateTop

msoTextEffectShapePlainText

msoTextEffectShapeRingOutside

msoTextEffectShapeSlantUp

msoTextEffectShapeTriangleDown

msoTextEffectShapeWave1

msoTextEffectShapeDeflateInflate

msoTextEffectShapeDeflateTop

msoTextEffectShapeDoubleWave2

msoTextEffectShapeFadeLeft

msoTextEffectShapeFadeUp

msoTextEffectShapeInflateBottom

msoTextEffectShapeMixed

msoTextEffectShapeRingInside

msoTextEffectShapeSlantDown

msoTextEffectShapeStop

msoTextEffectShapeTriangleUp

msoTextEffectShapeWave2

Setting the PresetTextEffect property automatically sets the PresetShape property.

Example

This example sets the shape of all WordArt on myDocument to a chevron whose center points down.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 If s.Type = msoTextEffect Then
 s.TextEffect.PresetShape = msoTextEffectShapeChevronDown
 End If
Next

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.PresetTextEffect Property (Excel)

 Copy code hover
[image]

TextEffectFormat.PresetTextEffect Property (Excel)
See also Send feedback

Returns or sets the style of the specified WordArt. Read/write MsoPresetTextEffect.

Syntax

expression .PresetTextEffect

expression A variable that represents a TextEffectFormat object.

Remarks

The values for this property correspond to the formats in the WordArt Gallery dialog box (numbered from left to right, top to bottom).

MsoPresetTextEffect can be one of these MsoPresetTextEffect constants.

msoTextEffect1

msoTextEffect10

msoTextEffect11

msoTextEffect12

msoTextEffect13

msoTextEffect14

msoTextEffect15

msoTextEffect16

msoTextEffect17

msoTextEffect18

msoTextEffect19

msoTextEffect2

msoTextEffect20

msoTextEffect21

msoTextEffect22

msoTextEffect23

msoTextEffect24

msoTextEffect25

msoTextEffect26

msoTextEffect27

msoTextEffect28

msoTextEffect29

msoTextEffect3

msoTextEffect30

msoTextEffect4

msoTextEffect5

msoTextEffect6

msoTextEffect7

msoTextEffect8

msoTextEffect9

msoTextEffectMixed

Setting the PresetTextEffect property automatically sets many other formatting properties of the specified shape.

Example

This example sets the style for all WordArt on myDocument to the first style listed in the WordArt Gallery dialog box.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 If s.Type = msoTextEffect Then
 s.TextEffect.PresetTextEffect = msoTextEffect1
 End If
Next

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.RotatedChars Property (Excel)

 Copy code hover
[image]

TextEffectFormat.RotatedChars Property (Excel)
See also Send feedback

Published: July 16, 2012

True if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. False if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.

Syntax

expression .RotatedChars

expression A variable that represents a TextEffectFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse Characters in the specified WordArt retain their original orientation relative to the bounding shape.

msoTriStateMixed

msoTriStateToggle

msoTrue Characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape.

If the WordArt has horizontal text, setting the RotatedChars property to msoTrue rotates the characters 90 degrees counterclockwise. If the WordArt has vertical text, setting the RotatedChars property to msoFalse rotates the characters 90 degrees clockwise. Use the ToggleVerticalText method to switch between horizontal and vertical text flow.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to myDocument and rotates the characters 90 degrees counterclockwise.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=10, _
 Top:=10)
newWordArt.TextEffect.RotatedChars = msoTrue

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Text Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Text Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a TextEffectFormat object.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Tracking Property (Excel)

 Copy code hover
[image]

TextEffectFormat.Tracking Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt to the width of the character. Can be a value from 0 (zero) through 5. (Large values for this property specify ample space between characters; values less than 1 can produce character overlap.) Read/write Single.

Syntax

expression .Tracking

expression A variable that represents a TextEffectFormat object.

Remarks

The following table gives the values of the Tracking property that correspond to the settings available in the user interface.

User interface setting | Equivalent Tracking property value
Very Tight | 0.8
Tight | 0.9
Normal | 1.0
Loose | 1.2
Very Loose | 1.5

Example

This example adds WordArt that contains the text "Test" to myDocument and specifies that the characters be very tightly spaced.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=100, _
 Top:=100)
newWordArt.TextEffect.Tracking =0.8

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat Methods (Excel)

 Copy code hover
[image]

TextEffectFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.


TextEffectFormat.ToggleVerticalText Method (Excel)

 Copy code hover
[image]

TextEffectFormat.ToggleVerticalText Method (Excel)
See also Send feedback

Published: July 16, 2012

Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Syntax

expression .ToggleVerticalText

expression A variable that represents a TextEffectFormat object.

Remarks

Using the ToggleVerticalText method swaps the values of the Width and Height properties of the Shape object that represents the WordArt and leaves the Left and Top properties unchanged.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and the direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to myDocument and switches from horizontal text flow (the default for the specified WordArt style, msoTextEffect1) to vertical text flow.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=100, _
 Top:=100)
newWordArt.TextEffect.ToggleVerticalText

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextFrame Object (Excel)

 Copy code hover
[image]

TextFrame Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the text frame in a Shape object. Contains the text in the text frame as well as the properties and methods that control the alignment and anchoring of the text frame.

Remarks

Use the TextFrame property to return a TextFrame object.

Example

The following example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .Characters.Text = "Here is some test text"
 .MarginBottom = 10
 .MarginLeft = 10
 .MarginRight = 10
 .MarginTop = 10
End With

See also

Concepts

Excel Object Model Reference

Other resources

TextFrame Object Members


TextFrame Members (Excel)

 Copy code hover
[image]

TextFrame Members (Excel)
Send feedback

Published: July 16, 2012

Represents the text frame in a Shape object. Contains the text in the text frame as well as the properties and methods that control the alignment and anchoring of the text frame.

Methods

Name | Description
Characters | Returns a Characters object that represents a range of characters within a shape's text frame. You can use the Characters object to add and format characters within the text frame.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoMargins | Returns or sets whether Excel automatically calculates text frame margins. Read/write
AutoSize | True if the size of the specified object is changed automatically to fit text within its boundaries. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HorizontalAlignment | Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.
HorizontalOverflow | Returns or sets the horizontal overflow setting for the specified object. Read/write
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
Orientation | Returns or sets a Long value that represents the text frame orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
VerticalAlignment | Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.
VerticalOverflow | Returns or sets the vertical overflow setting for the specified object. Read/write


TextFrame Properties (Excel)

 Copy code hover
[image]

TextFrame Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoMargins | Returns or sets whether Excel automatically calculates text frame margins. Read/write
AutoSize | True if the size of the specified object is changed automatically to fit text within its boundaries. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HorizontalAlignment | Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.
HorizontalOverflow | Returns or sets the horizontal overflow setting for the specified object. Read/write
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
Orientation | Returns or sets a Long value that represents the text frame orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.
VerticalAlignment | Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.
VerticalOverflow | Returns or sets the vertical overflow setting for the specified object. Read/write


TextFrame.Application Property (Excel)

 Copy code hover
[image]

TextFrame.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a TextFrame object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.AutoMargins Property (Excel)

 Copy code hover
[image]

TextFrame.AutoMargins Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether Excel automatically calculates text frame margins. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AutoMargins

expression A variable that represents a TextFrame object.

Return Value

Boolean

Remarks

True if Excel automatically calculates text frame margins; otherwise False. When this property is True, the MarginLeft, MarginRight, MarginTop, and MarginBottom properties are ignored.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.AutoSize Property (Excel)

 Copy code hover
[image]

TextFrame.AutoSize Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the size of the specified object is changed automatically to fit text within its boundaries. Read/write Boolean.

Syntax

expression .AutoSize

expression A variable that represents a TextFrame object.

Example

This example adjusts the size of the text frame on shape one to fit its text.

VBA Copy code Copy code
Worksheets(1).Shapes(1).TextFrame.AutoSize = True

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Creator Property (Excel)

 Copy code hover
[image]

TextFrame.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TextFrame object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.HorizontalAlignment Property (Excel)

 Copy code hover
[image]

TextFrame.HorizontalAlignment Property (Excel)
See also Send feedback

Returns or sets a XlHAlign value that represents the horizontal alignment for the specified object.

Syntax

expression .HorizontalAlignment

expression A variable that represents a TextFrame object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.HorizontalOverflow Property (Excel)

 Copy code hover
[image]

TextFrame.HorizontalOverflow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal overflow setting for the specified object. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .HorizontalOverflow

expression A variable that represents a TextFrame object.

Return Value

XlOartHorizontalOverflow

Remarks

This property only has an effect when the WordWrap property is msoFalse (0).

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginBottom Property (Excel)

 Copy code hover
[image]

TextFrame.MarginBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginBottom

expression A variable that represents a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .Characters.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginLeft Property (Excel)

 Copy code hover
[image]

TextFrame.MarginLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginLeft

expression A variable that represents a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .Characters.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginRight Property (Excel)

 Copy code hover
[image]

TextFrame.MarginRight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginRight

expression A variable that represents a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .Characters.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginTop Property (Excel)

 Copy code hover
[image]

TextFrame.MarginTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginTop

expression A variable that represents a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .Characters.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Orientation Property (Excel)

 Copy code hover
[image]

TextFrame.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the text frame orientation.

Syntax

expression .Orientation

expression A variable that represents a TextFrame object.

Remarks

The value of this property can be set to an integer value from - 90 to 90 degrees or one of the MsoTextOrientation constants.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Parent Property (Excel)

 Copy code hover
[image]

TextFrame.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.ReadingOrder Property (Excel)

 Copy code hover
[image]

TextFrame.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.VerticalAlignment Property (Excel)

 Copy code hover
[image]

TextFrame.VerticalAlignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlVAlign value that represents the vertical alignment of the specified object.

Syntax

expression .VerticalAlignment

expression A variable that represents a TextFrame object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.VerticalOverflow Property (Excel)

 Copy code hover
[image]

TextFrame.VerticalOverflow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical overflow setting for the specified object. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .VerticalOverflow

expression A variable that represents a TextFrame object.

Return Value

XlOartVerticalOverflow

Remarks

This property only has an effect when the AutoSize property is False.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame Methods (Excel)

 Copy code hover
[image]

TextFrame Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Characters | Returns a Characters object that represents a range of characters within a shape's text frame. You can use the Characters object to add and format characters within the text frame.


TextFrame.Characters Method (Excel)

 Copy code hover
[image]

TextFrame.Characters Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Characters object that represents a range of characters within a shape's text frame. You can use the Characters object to add and format characters within the text frame.

Syntax

expression .Characters(Start, Length)

expression An expression that returns a TextFrame object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either set to 1 or omitted, the Characters method returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, the Characters method returns the remainder of the string (everything after the character that was set as the Start argument).

Return Value

Characters

Remarks

The Characters object isn't a collection.

Example

This example formats as bold the third character in the first shape's text frame on the active worksheet.

VBA Copy code Copy code
With ActiveSheet.Shapes(1).TextFrame
 .Characters.Text = "abcdefg"
 .Characters(3, 1).Font.Bold = True
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame2 Object (Excel)

 Copy code hover
[image]

TextFrame2 Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the text frame in a Shape, ShapeRange, or ChartFormat object.

Version Information

Version Added: Excel 2007

Remarks

This object contains the text in the text frame as well as the properties and methods that control the alignment and anchoring of the text frame. Use the TextFrame2 property to return a TextFrame2 object.

Example

The following example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame2
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 10
 .MarginLeft = 10
 .MarginRight = 10
 .MarginTop = 10
End With

See also

Concepts

Excel Object Model Reference

Other resources

TextFrame2 Object Members


TextFrame2 Members (Excel)

 Copy code hover
[image]

TextFrame2 Members (Excel)
Send feedback

Published: July 16, 2012

Represents the text frame in a Shape, ShapeRange, or ChartFormat object.

Methods

Name | Description
DeleteText | Deletes the text from a text frame and all the associated text properties.

Properties

Name | Description
Application | Returns an Application object. Read-only.
AutoSize | The size of the specified object that changes automatically to fit text within its boundaries. Read/write MsoAutoSize.
Column | Returns the TextColumn2 object that represents the columns within the text frame. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HasText | Returns whether the specified text frame has text. Read-only MsoTriState.
HorizontalAnchor | Returns or sets the horizontal anchor type for the specified text. Read/write MsoHorizontalAnchor.
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
NoTextRotation | Returns or sets whether text remains flat when the specified object is rotated. Read/write
Orientation | Returns or sets a value that represents the text frame orientation. Read/write MsoTextOrientation.
Parent | Returns the parent object for the specified object. Read-only.
PathFormat | Returns or sets the path type for the specified text frame. Read/write MsoPathFormat.
Ruler | Returns a Ruler2 object that represents the ruler for the specified text. Read-only.
TextRange | Returns the TextRange2 object that represents the text in the object. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified text. Read-only.
VerticalAnchor | Returns or sets the vertical anchor type for the specified text. Read/write MsoVerticalAnchor.
WarpFormat | Returns or sets the warp type for the specified text frame. Read/write MsoWarpFormat.
WordArtformat | Returns or sets the Word Art type for the specified text frame. Read/write MsoPresetTextEffect.
WordWrap | Returns or sets text break lines within or past the boundaries of the shape. Read/write MsoTriState.


TextFrame2 Properties (Excel)

 Copy code hover
[image]

TextFrame2 Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object. Read-only.
AutoSize | The size of the specified object that changes automatically to fit text within its boundaries. Read/write MsoAutoSize.
Column | Returns the TextColumn2 object that represents the columns within the text frame. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HasText | Returns whether the specified text frame has text. Read-only MsoTriState.
HorizontalAnchor | Returns or sets the horizontal anchor type for the specified text. Read/write MsoHorizontalAnchor.
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
NoTextRotation | Returns or sets whether text remains flat when the specified object is rotated. Read/write
Orientation | Returns or sets a value that represents the text frame orientation. Read/write MsoTextOrientation.
Parent | Returns the parent object for the specified object. Read-only.
PathFormat | Returns or sets the path type for the specified text frame. Read/write MsoPathFormat.
Ruler | Returns a Ruler2 object that represents the ruler for the specified text. Read-only.
TextRange | Returns the TextRange2 object that represents the text in the object. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified text. Read-only.
VerticalAnchor | Returns or sets the vertical anchor type for the specified text. Read/write MsoVerticalAnchor.
WarpFormat | Returns or sets the warp type for the specified text frame. Read/write MsoWarpFormat.
WordArtformat | Returns or sets the Word Art type for the specified text frame. Read/write MsoPresetTextEffect.
WordWrap | Returns or sets text break lines within or past the boundaries of the shape. Read/write MsoTriState.


TextFrame2.Application Property (Excel)

 Copy code hover
[image]

TextFrame2.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a TextFrame2 object.

Remarks

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object).

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.AutoSize Property (Excel)

 Copy code hover
[image]

TextFrame2.AutoSize Property (Excel)
See also Send feedback

Published: July 16, 2012

The size of the specified object that changes automatically to fit text within its boundaries. Read/write MsoAutoSize.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoSize

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.Column Property (Excel)

 Copy code hover
[image]

TextFrame2.Column Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the TextColumn2 object that represents the columns within the text frame. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Column

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.Creator Property (Excel)

 Copy code hover
[image]

TextFrame2.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Version Information

Version Added: Excel 2007

Syntax

expression .Creator

expression A variable that represents a TextFrame2 object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

Example

This example displays a message about the creator of an Excel workbook.

VBA Copy code Copy code
Sub FindCreator()

 Dim myObject As Excel.Workbook
 Set myObject = ActiveWorkbook
 If myObject.TextFrame2.Creator = &h5843454c Then
 MsgBox "This is a Microsoft Excel object."
 Else
 MsgBox "This is not a Microsoft Excel object."
 End If

End Sub

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.HasText Property (Excel)

 Copy code hover
[image]

TextFrame2.HasText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the specified text frame has text. Read-only MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .HasText

expression A variable that represents a TextFrame2 object.

Example

This example formats the text in the text frame, if the text frame contains text.

VBA Copy code Copy code
With ActiveSheet.Shapes(1).TextFrame2
If .HasText Then
.TextRange2.Font.Name = "Arial"

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.HorizontalAnchor Property (Excel)

 Copy code hover
[image]

TextFrame2.HorizontalAnchor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal anchor type for the specified text. Read/write MsoHorizontalAnchor.

Version Information

Version Added: Excel 2007

Syntax

expression .HorizontalAnchor

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.MarginBottom Property (Excel)

 Copy code hover
[image]

TextFrame2.MarginBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .MarginBottom

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.MarginLeft Property (Excel)

 Copy code hover
[image]

TextFrame2.MarginLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .MarginLeft

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.MarginRight Property (Excel)

 Copy code hover
[image]

TextFrame2.MarginRight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .MarginRight

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.MarginTop Property (Excel)

 Copy code hover
[image]

TextFrame2.MarginTop Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .MarginTop

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.NoTextRotation Property (Excel)

 Copy code hover
[image]

TextFrame2.NoTextRotation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether text remains flat when the specified object is rotated. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .NoTextRotation

expression A variable that represents a TextFrame2 object.

Return Value

MsoTriState

Remarks

msoTrue (-1) if text will remain flat when the text frame is rotated; otherwise msoFalse (0).

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.Orientation Property (Excel)

 Copy code hover
[image]

TextFrame2.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that represents the text frame orientation. Read/write MsoTextOrientation.

Version Information

Version Added: Excel 2007

Syntax

expression .Orientation

expression A variable that represents a TextFrame2 object.

Remarks

The value of this property can be set to an integer value from -90 to 90 degrees, or to one of the MsoTextOrientation constants.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.Parent Property (Excel)

 Copy code hover
[image]

TextFrame2.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.PathFormat Property (Excel)

 Copy code hover
[image]

TextFrame2.PathFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the path type for the specified text frame. Read/write MsoPathFormat.

Version Information

Version Added: Excel 2007

Syntax

expression .PathFormat

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.Ruler Property (Excel)

 Copy code hover
[image]

TextFrame2.Ruler Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Ruler2 object that represents the ruler for the specified text. Read-only.

Syntax

expression .Ruler

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.TextRange Property (Excel)

 Copy code hover
[image]

TextFrame2.TextRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the TextRange2 object that represents the text in the object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TextRange

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.ThreeD Property (Excel)

 Copy code hover
[image]

TextFrame2.ThreeD Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D-effect formatting properties for the specified text. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ThreeD

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.VerticalAnchor Property (Excel)

 Copy code hover
[image]

TextFrame2.VerticalAnchor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical anchor type for the specified text. Read/write MsoVerticalAnchor.

Version Information

Version Added: Excel 2007

Syntax

expression .VerticalAnchor

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.WarpFormat Property (Excel)

 Copy code hover
[image]

TextFrame2.WarpFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the warp type for the specified text frame. Read/write MsoWarpFormat.

Version Information

Version Added: Excel 2007

Syntax

expression .WarpFormat

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.WordArtformat Property (Excel)

 Copy code hover
[image]

TextFrame2.WordArtformat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the Word Art type for the specified text frame. Read/write MsoPresetTextEffect.

Version Information

Version Added: Access 2007

Syntax

expression .WordArtformat

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2.WordWrap Property (Excel)

 Copy code hover
[image]

TextFrame2.WordWrap Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets text break lines within or past the boundaries of the shape. Read/write MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .WordWrap

expression A variable that represents a TextFrame2 object.

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


TextFrame2 Methods (Excel)

 Copy code hover
[image]

TextFrame2 Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
DeleteText | Deletes the text from a text frame and all the associated text properties.


TextFrame2.DeleteText Method (Excel)

 Copy code hover
[image]

TextFrame2.DeleteText Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the text from a text frame and all the associated text properties.

Version Information

Version Added: Excel 2007

Syntax

expression .DeleteText

expression A variable that represents a TextFrame2 object.

Remarks

The associated text properties include Font attributes such as bold, underline, and so on.

Example

This example deletes the text in the text frame, if the text frame contains text.

VBA Copy code Copy code
With ActiveSheet.Shapes(1).TextFrame2
 If .HasText Then
 .DeleteText ()

See also

Concepts

TextFrame2 Object

Other resources

TextFrame2 Object Members


ThreeDFormat Object (Excel)

 Copy code hover
[image]

ThreeDFormat Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a shape's three-dimensional formatting.

Remarks

You cannot apply three-dimensional formatting to some kinds of shapes, such as beveled shapes or multiple-disjoint paths. Most of the properties and methods of the ThreeDFormat object for such a shape will fail.

Example

Use the ThreeD property to return a ThreeDFormat object. The following example adds an oval to myDocument and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myShape = myDocument.Shapes.AddShape(msoShapeOval, _
 90, 90, 90, 40)
With myShape.ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 ' RGB value for purple
End With

See also

Concepts

Excel Object Model Reference

Other resources

ThreeDFormat Object Members


ThreeDFormat Members (Excel)

 Copy code hover
[image]

ThreeDFormat Members (Excel)
Send feedback

Published: July 16, 2012

Represents a shape's three-dimensional formatting.

Methods

Name | Description
IncrementRotationHorizontal | Changes the rotation of the specified shape horizontally by the specified number of degrees.
IncrementRotationVertical | Changes the rotation of the specified shape vertically by the specified number of degrees.
IncrementRotationX | Changes the rotation of the specified shape around the x-axis by the specified number of degrees. Use the RotationX property to set the absolute rotation of the shape around the x-axis.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis by the specified number of degrees. Use the RotationY property to set the absolute rotation of the shape around the y-axis.
IncrementRotationZ | Changes the rotation of the specified shape around the z-axis by the specified number of degrees.
ResetRotation | Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward. This method doesn't reset the rotation around the z-axis.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetPresetCamera | Sets the camera for the specified ThreeDFormat object.
SetThreeDFormat | Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BevelBottomDepth | Returns or sets the bottom depth when using the bevel effect on a ThreeDFormat object. Read/write Single.
BevelBottomInset | Returns or sets a value indicating whether the bottom insert bevel should be raised for a ThreeDFormat object. Read/write Single.
BevelBottomType | Returns or sets the bottom bevel type for a ThreeDFormat object. Read/write MsoBevelType.
BevelTopDepth | Returns or sets the top depth when using the bevel effect on a ThreeDFormat object. Read/write Single.
BevelTopInset | Returns or sets a value indicating whether the top insert bevel should be raised for a ThreeDFormat object. Read/write Single.
BevelTopType | Returns or sets the top Bevel type for a ThreeDFormat object. Read/write MsoBevelType.
ContourColor | Returns the contour color for a ThreeDFormat object. Read-only ColorFormat.
ContourWidth | Returns or sets the contour width for a ThreeDFormat object. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Depth | Returns or sets a Single value that represents the depth of the shape's extrusion.
ExtrusionColor | Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.
ExtrusionColorType | Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.
FieldOfView | Returns or sets the angle at which a ThreeDFormat object can be viewed. Read/write Single.
LightAngle | Returns or sets the angle of the extrusion lights set on a ThreeDFormat object. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
Perspective | Returns or sets an MsoTriState value that determines whether the extrusion appears in perspective.
PresetCamera | Returns or sets the extrusion preset camera for a ThreeDFormat object. Read-only MsoPresetCamera.
PresetExtrusionDirection | Returns the direction that the extrusion's sweep path takes away from the extruded shape (the front face of the extrusion). Read-only MsoPresetExtrusionDirection.
PresetLighting | Returns or sets the extrusion preset lighting for a ThreeDFormat object. Read-only MsoLightRigType.
PresetLightingDirection | Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.
PresetLightingSoftness | Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.
PresetMaterial | Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.
PresetThreeDFormat | Returns the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion. Read-only MsoPresetThreeDFormat.
ProjectText | Returns or sets the project text state for the specified ThreeDFormat object. Read/write MsoTriState.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.
RotationZ | Returns or sets the rotation of the extruded shape around the z-axis in degrees. Read/write Single.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Z | Returns the Z order of the specified ThreeDFormat object. Read/write Single.


ThreeDFormat Properties (Excel)

 Copy code hover
[image]

ThreeDFormat Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
BevelBottomDepth | Returns or sets the bottom depth when using the bevel effect on a ThreeDFormat object. Read/write Single.
BevelBottomInset | Returns or sets a value indicating whether the bottom insert bevel should be raised for a ThreeDFormat object. Read/write Single.
BevelBottomType | Returns or sets the bottom bevel type for a ThreeDFormat object. Read/write MsoBevelType.
BevelTopDepth | Returns or sets the top depth when using the bevel effect on a ThreeDFormat object. Read/write Single.
BevelTopInset | Returns or sets a value indicating whether the top insert bevel should be raised for a ThreeDFormat object. Read/write Single.
BevelTopType | Returns or sets the top Bevel type for a ThreeDFormat object. Read/write MsoBevelType.
ContourColor | Returns the contour color for a ThreeDFormat object. Read-only ColorFormat.
ContourWidth | Returns or sets the contour width for a ThreeDFormat object. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Depth | Returns or sets a Single value that represents the depth of the shape's extrusion.
ExtrusionColor | Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.
ExtrusionColorType | Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.
FieldOfView | Returns or sets the angle at which a ThreeDFormat object can be viewed. Read/write Single.
LightAngle | Returns or sets the angle of the extrusion lights set on a ThreeDFormat object. Read/write Single.
Parent | Returns the parent object for the specified object. Read-only.
Perspective | Returns or sets an MsoTriState value that determines whether the extrusion appears in perspective.
PresetCamera | Returns or sets the extrusion preset camera for a ThreeDFormat object. Read-only MsoPresetCamera.
PresetExtrusionDirection | Returns the direction that the extrusion's sweep path takes away from the extruded shape (the front face of the extrusion). Read-only MsoPresetExtrusionDirection.
PresetLighting | Returns or sets the extrusion preset lighting for a ThreeDFormat object. Read-only MsoLightRigType.
PresetLightingDirection | Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.
PresetLightingSoftness | Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.
PresetMaterial | Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.
PresetThreeDFormat | Returns the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion. Read-only MsoPresetThreeDFormat.
ProjectText | Returns or sets the project text state for the specified ThreeDFormat object. Read/write MsoTriState.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.
RotationZ | Returns or sets the rotation of the extruded shape around the z-axis in degrees. Read/write Single.
Visible | Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.
Z | Returns the Z order of the specified ThreeDFormat object. Read/write Single.


ThreeDFormat.Application Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a ThreeDFormat object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomDepth Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelBottomDepth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the bottom depth when using the bevel effect on a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelBottomDepth

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomInset Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelBottomInset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value indicating whether the bottom insert bevel should be raised for a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelBottomInset

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomType Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelBottomType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the bottom bevel type for a ThreeDFormat object. Read/write MsoBevelType.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelBottomType

expression A variable that represents a ThreeDFormat object.

Remarks

MsoBevelType can be one of these MsoBevelType constants.

msoBevelAngle

msoBevelArtDeco

msoBevelCircle

msoBevelConvex

msoBevelCoolSlant

msoBevelCross

msoBevelDivot

msoBevelHardEdge

msoBevelNone

msoBevelRelaxedInset

msoBevelRiblet

msoBevelSlope

msoBevelSoftRound

msoBevelTypeMixed

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopDepth Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelTopDepth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the top depth when using the bevel effect on a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelTopDepth

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopInset Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelTopInset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value indicating whether the top insert bevel should be raised for a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelTopInset

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopType Property (Excel)

 Copy code hover
[image]

ThreeDFormat.BevelTopType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the top Bevel type for a ThreeDFormat object. Read/write MsoBevelType.

Version Information

Version Added: Excel 2007

Syntax

expression .BevelTopType

expression A variable that represents a ThreeDFormat object.

Remarks

MsoBevelType can be one of these MsoBevelType constants.

msoBevelAngle

msoBevelArtDeco

msoBevelCircle

msoBevelConvex

msoBevelCoolSlant

msoBevelCross

msoBevelDivot

msoBevelHardEdge

msoBevelNone

msoBevelRelaxedInset

msoBevelRiblet

msoBevelSlope

msoBevelSoftRound

msoBevelTypeMixed

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ContourColor Property (Excel)

 Copy code hover
[image]

ThreeDFormat.ContourColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the contour color for a ThreeDFormat object. Read-only ColorFormat.

Version Information

Version Added: Excel 2007

Syntax

expression .ContourColor

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ContourWidth Property (Excel)

 Copy code hover
[image]

ThreeDFormat.ContourWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the contour width for a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .ContourWidth

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Creator Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ThreeDFormat object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Depth Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Depth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single value that represents the depth of the shape's extrusion.

Syntax

expression .Depth

expression A variable that represents a ThreeDFormat object.

Remarks

The value of this property can be a value from -600 through 9600 (positive values produce an extrusion whose front face is the original shape; negative values produce an extrusion whose back face is the original shape).

Example

This example adds an oval to myDocument and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myShape = myDocument.Shapes.AddShape(msoShapeOval, _
 90, 90, 90, 40)
With myShape.ThreeD
 .Visible = True
 .Depth = 50
 ' RGB value for purple
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ExtrusionColor Property (Excel)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColor Property (Excel)
See also Send feedback

Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.

Syntax

expression .ExtrusionColor

expression A variable that represents a ThreeDFormat object.

Example

This example adds an oval to myDocument and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
Set myShape = myDocument.Shapes.AddShape(msoShapeOval, _
 90, 90, 90, 40)
With myShape.ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 ' RGB value for purple
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ExtrusionColorType Property (Excel)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColorType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.

Syntax

expression .ExtrusionColorType

expression A variable that represents a ThreeDFormat object.

Remarks

MsoExtrusionColorType can be one of these MsoExtrusionColorType constants.

msoExtrusionColorAutomatic. Extrusion color based on shape fill.

msoExtrusionColorTypeMixed

msoExtrusionColorCustom. Extrusion color independent of shape fill.

Example

If shape one on myDocument has an automatic extrusion color, this example gives the extrusion a custom yellow color.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
    If .ExtrusionColorType = msoExtrusionColorAutomatic Then
        .ExtrusionColor.RGB = RGB(240, 235, 16)
    End If
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.FieldOfView Property (Excel)

 Copy code hover
[image]

ThreeDFormat.FieldOfView Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle at which a ThreeDFormat object can be viewed. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .FieldOfView

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.LightAngle Property (Excel)

 Copy code hover
[image]

ThreeDFormat.LightAngle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the extrusion lights set on a ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .LightAngle

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Parent Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Perspective Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Perspective Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTriState value that determines whether the extrusion appears in perspective.

Syntax

expression .Perspective

expression A variable that represents a ThreeDFormat object.

Remarks

This property can be set to one of the following MsoTriState constants:

msoCTrue Does not apply to this property.

msoFalse The extrusion is a parallel, or orthographic, projection—that is, the walls don't narrow toward a vanishing point.

msoTriStateMixed

msoTriStateToggle

msoTrue The extrusion appears in perspective—that is, the walls of the extrusion narrow toward a vanishing point.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetCamera Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetCamera Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the extrusion preset camera for a ThreeDFormat object. Read-only MsoPresetCamera.

Version Information

Version Added: Excel 2007

Syntax

expression .PresetCamera

expression A variable that represents a ThreeDFormat object.

Remarks

MsoPresetCamera can be one of these MsoPresetCamera constants.

msoCameraIsometricBottomDown

msoCameraIsometricBottomUp

msoCameraIsometricLeftDown

msoCameraIsometricLeftUp

msoCameraIsometricOffAxis1Left

msoCameraIsometricOffAxis1Right

msoCameraIsometricOffAxis1Top

msoCameraIsometricOffAxis2Left

msoCameraIsometricOffAxis2Right

msoCameraIsometricOffAxis2Top

msoCameraIsometricOffAxis3Bottom

msoCameraIsometricOffAxis3Left

msoCameraIsometricOffAxis3Right

msoCameraIsometricOffAxis4Bottom

msoCameraIsometricOffAxis4Left

msoCameraIsometricOffAxis4Right

msoCameraIsometricRightDown

msoCameraIsometricRightUp

msoCameraIsometricTopDown

msoCameraIsometricTopUp

msoCameraLegacyObliqueBottom

msoCameraLegacyObliqueBottomLeft

msoCameraLegacyObliqueBottomRight

msoCameraLegacyObliqueFront

msoCameraLegacyObliqueLeft

msoCameraLegacyObliqueRight

msoCameraLegacyObliqueTop

msoCameraLegacyObliqueTopLeft

msoCameraLegacyObliqueTopRight

msoCameraLegacyPerspectiveBottom

msoCameraLegacyPerspectiveBottomLeft

msoCameraLegacyPerspectiveBottomRight

msoCameraLegacyPerspectiveFront

msoCameraLegacyPerspectiveLeft

msoCameraLegacyPerspectiveRight

msoCameraLegacyPerspectiveTop

msoCameraLegacyPerspectiveTopLeft

msoCameraLegacyPerspectiveTopRight

msoCameraObliqueBottom

msoCameraObliqueBottomLeft

msoCameraObliqueBottomRight

msoCameraObliqueLeft

msoCameraObliqueRight

msoCameraObliqueTop

msoCameraObliqueTopLeft

msoCameraObliqueTopRight

msoCameraOrthographicFront

msoCameraPerspectiveAbove

msoCameraPerspectiveAboveLeftFacing

msoCameraPerspectiveAboveRightFacing

msoCameraPerspectiveBelow

msoCameraPerspectiveContrastingLeftFacing

msoCameraPerspectiveContrastingRightFacing

msoCameraPerspectiveFront

msoCameraPerspectiveHeroicExtremeLeftFacing

msoCameraPerspectiveHeroicExtremeRightFacing

msoCameraPerspectiveHeroicLeftFacing

msoCameraPerspectiveHeroicRightFacing

msoCameraPerspectiveLeft

msoCameraPerspectiveRelaxed

msoCameraPerspectiveRelaxedModerately

msoCameraPerspectiveRight

msoPresetCameraMixed

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetExtrusionDirection Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetExtrusionDirection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the direction that the extrusion's sweep path takes away from the extruded shape (the front face of the extrusion). Read-only MsoPresetExtrusionDirection.

Syntax

expression .PresetExtrusionDirection

expression A variable that represents a ThreeDFormat object.

Remarks

MsoPresetExtrusionDirection can be one of these MsoPresetExtrusionDirection constants.

msoExtrusionTop

msoExtrusionTopRight

msoExtrusionBottom

msoExtrusionBottomLeft

msoExtrusionBottomRight

msoExtrusionLeft

msoExtrusionNone

msoExtrusionRight

msoExtrusionTopLeft

msoPresetExtrusionDirectionMixed

This property is read-only. To set the value of this property, use the SetExtrusionDirection method.

Example

This example changes each extrusion on myDocument that extends toward the upper-left corner of the extrusion's front face to an extrusion that extends toward the lower-right corner of the front face.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
For Each s In myDocument.Shapes
 With s.ThreeD
 If .PresetExtrusionDirection = msoExtrusionTopLeft Then
 .SetExtrusionDirection msoExtrusionBottomRight
 End If
 End With
Next

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLighting Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetLighting Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the extrusion preset lighting for a ThreeDFormat object. Read-only MsoLightRigType.

Version Information

Version Added: Excel 2007

Syntax

expression .PresetLighting

expression A variable that represents a ThreeDFormat object.

Remarks

MsoLightRigType can be one of these MsoLightRigType constants.

msoLightRigBalanced

msoLightRigBrightRoom

msoLightRigChilly

msoLightRigContrasting

msoLightRigFlat

msoLightRigFlood

msoLightRigFreezing

msoLightRigGlow

msoLightRigHarsh

msoLightRigLegacyFlat1

msoLightRigLegacyFlat2

msoLightRigLegacyFlat3

msoLightRigLegacyFlat4

msoLightRigLegacyHarsh1

msoLightRigLegacyHarsh2

msoLightRigLegacyHarsh3

msoLightRigLegacyHarsh4

msoLightRigLegacyNormal1

msoLightRigLegacyNormal2

msoLightRigLegacyNormal3

msoLightRigLegacyNormal4

msoLightRigMixed

msoLightRigMorning

msoLightRigSoft

msoLightRigSunrise

msoLightRigSunset

msoLightRigThreePoint

msoLightRigTwoPoint

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLightingDirection Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetLightingDirection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.

Syntax

expression .PresetLightingDirection

expression A variable that represents a ThreeDFormat object.

Remarks

MsoPresetLightingDirection can be one of these MsoPresetLightingDirection constants.

msoLightingBottom

msoLightingBottomLeft

msoLightingBottomRight

msoLightingLeft

msoLightingNone

msoLightingRight

msoLightingTop

msoLightingTopLeft

msoLightingTopRight

msoPresetLightingDirectionMixed

You won't see the lighting effects you set if the extrusion has a wire frame surface.

Example

This example specifies that the extrusion for shape one on myDocument extend toward the top of the shape and that the lighting for the extrusion come from the left.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLightingSoftness Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetLightingSoftness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.

Syntax

expression .PresetLightingSoftness

expression A variable that represents a ThreeDFormat object.

Remarks

MsoPresetLightingSoftness can be one of these MsoPresetLightingSoftness constants.

msoLightingBright

msoLightingDim

msoLightingNormal

msoPresetLightingSoftnessMixed

Example

This example specifies that the extrusion for shape one on myDocument be lit brightly from the left.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .PresetLightingSoftness = msoLightingBright
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetMaterial Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetMaterial Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.

Syntax

expression .PresetMaterial

expression A variable that represents a ThreeDFormat object.

Remarks

MsoPresetMaterial can be one of these MsoPresetMaterial constants.

msoMaterialMatte

msoMaterialMetal

msoMaterialPlastic

msoMaterialWireFrame

msoPresetMaterialMixed

Example

This example specifies that the extrusion surface for shape one in myDocument be wire frame.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .PresetMaterial = msoMaterialWireFrame
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetThreeDFormat Property (Excel)

 Copy code hover
[image]

ThreeDFormat.PresetThreeDFormat Property (Excel)
See also Send feedback

Returns the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion. Read-only MsoPresetThreeDFormat.

Syntax

expression .PresetThreeDFormat

expression A variable that represents a ThreeDFormat object.

Remarks

If the extrusion has a custom format rather than a preset format, this property returns msoPresetThreeDFormatMixed.

MsoPresetThreeDFormat can be one of these MsoPresetThreeDFormat constants.

msoThreeD1

msoThreeD11

msoThreeD13

msoThreeD15

msoThreeD17

msoThreeD19

msoThreeD20

msoThreeD4

msoThreeD6

msoThreeD8

msoPresetThreeDFormatMixed

msoThreeD10

msoThreeD12

msoThreeD14

msoThreeD16

msoThreeD18

msoThreeD2

msoThreeD3

msoThreeD5

msoThreeD7

msoThreeD9

This property is read-only. To set the preset extrusion format, use the SetThreeDFormat method.

Example

This example sets the extrusion format for shape one on myDocument to 3D Style 12 if the shape initially has a custom extrusion format.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
 If .PresetThreeDFormat = msoPresetThreeDFormatMixed Then
 .SetThreeDFormat msoThreeD12
 End If
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ProjectText Property (Excel)

 Copy code hover
[image]

ThreeDFormat.ProjectText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the project text state for the specified ThreeDFormat object. Read/write MsoTriState.

Version Information

Version Added: Excel 2007

Syntax

expression .ProjectText

expression A variable that represents a ThreeDFormat object.

Remarks

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationX Property (Excel)

 Copy code hover
[image]

ThreeDFormat.RotationX Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.

Syntax

expression .RotationX

expression A variable that represents a ThreeDFormat object.

Remarks

To set the rotation of the extruded shape around the y-axis, use the RotationY property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to myDocument and sets their rotation around the x-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 With .AddShape(msoShapeOval, 30, 30, 50, 25).ThreeD
 .Visible = True
 .RotationX = -30
 End With
 With .AddShape(msoShapeOval, 30, 70, 50, 25).ThreeD
 .Visible = True
 .RotationX = 0
 End With
 With .AddShape(msoShapeOval, 30, 110, 50, 25).ThreeD
 .Visible = True
 .RotationX = 30
 End With
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationY Property (Excel)

 Copy code hover
[image]

ThreeDFormat.RotationY Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the extruded shape around the y-axis in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.

Syntax

expression .RotationY

expression A variable that represents a ThreeDFormat object.

Remarks

To set the rotation of the extruded shape around the x-axis, use the RotationX property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to myDocument and sets their rotation around the y-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes
 With .AddShape(msoShapeOval, 30, 30, 50, 25).ThreeD
 .Visible = True
 .RotationY = -30
 End With
 With .AddShape(msoShapeOval, 30, 70, 50, 25).ThreeD
 .Visible = True
 .RotationY = 0
 End With
 With .AddShape(msoShapeOval, 30, 110, 50, 25).ThreeD
 .Visible = True
 .RotationY = 30
 End With
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationZ Property (Excel)

 Copy code hover
[image]

ThreeDFormat.RotationZ Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation of the extruded shape around the z-axis in degrees. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .RotationZ

expression A variable that represents a ThreeDFormat object.

Remarks

The RotationZ property can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation.

To set the rotation of the extruded shape around the y-axis, use the RotationY property of the ThreeDFormat object. To set the rotation of the extruded shape around the x-axis, use the RotationX property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Visible Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoTriState value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Z Property (Excel)

 Copy code hover
[image]

ThreeDFormat.Z Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Z order of the specified ThreeDFormat object. Read/write Single.

Version Information

Version Added: Excel 2007

Syntax

expression .Z

expression A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat Methods (Excel)

 Copy code hover
[image]

ThreeDFormat Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementRotationHorizontal | Changes the rotation of the specified shape horizontally by the specified number of degrees.
IncrementRotationVertical | Changes the rotation of the specified shape vertically by the specified number of degrees.
IncrementRotationX | Changes the rotation of the specified shape around the x-axis by the specified number of degrees. Use the RotationX property to set the absolute rotation of the shape around the x-axis.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis by the specified number of degrees. Use the RotationY property to set the absolute rotation of the shape around the y-axis.
IncrementRotationZ | Changes the rotation of the specified shape around the z-axis by the specified number of degrees.
ResetRotation | Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward. This method doesn't reset the rotation around the z-axis.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetPresetCamera | Sets the camera for the specified ThreeDFormat object.
SetThreeDFormat | Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion.


ThreeDFormat.IncrementRotationHorizontal Method (Excel)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationHorizontal Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape horizontally by the specified number of degrees.

Version Information

Version Added: Excel 2007

Syntax

expression .IncrementRotationHorizontal(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape is to be changed horizontally. Can be a value from -90 through 90. A positive value moves the shape left; a negative value moves it to the right.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationVertical Method (Excel)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationVertical Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape vertically by the specified number of degrees.

Version Information

Version Added: Excel 2007

Syntax

expression .IncrementRotationVertical(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape is to be changed horizontally. Can be a value from -90 through 90. A positive value tilts the shape up; a negative value tilts it down.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationX Method (Excel)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationX Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the x-axis by the specified number of degrees. Use the RotationX property to set the absolute rotation of the shape around the x-axis.

Syntax

expression .IncrementRotationX(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape around the x-axis is to be changed. Can be a value from - 90 through 90. A positive value tilts the shape up; a negative value tilts it down.

Remarks

You cannot adjust the specified shape's rotation around the x-axis past the upper or lower limit for the RotationX property (90 degrees to - 90 degrees). For example, if the RotationX property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationX property) instead of 120.

To change the rotation of a shape around the y-axis, use the IncrementRotationY method. To change the rotation around the z-axis, use the IncrementRotationZ method.

Example

This example tilts shape one on myDocument up 10 degrees. Shape one must be an extruded shape for you to see the effect of this code.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).ThreeD.IncrementRotationX 10

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationY Method (Excel)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationY Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the y-axis by the specified number of degrees. Use the RotationY property to set the absolute rotation of the shape around the y-axis.

Syntax

expression .IncrementRotationY(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape around the y-axis is to be changed. Can be a value from - 90 through 90. A positive value tilts the shape to the left; a negative value tilts it to the right.

Remarks

To change the rotation of a shape around the x-axis, use the IncrementRotationX method. To change the rotation around the z-axis, use the IncrementRotationZ method.

You cannot adjust the specified shape's rotation around the y-axis shape past the upper or lower limit for the RotationY property (90 degrees to - 90 degrees). For example, if the RotationY property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationY property) instead of 120.

Example

This example tilts shape one on myDocument 10 degrees to the right. Shape one must be an extruded shape for you to see the effect of this code.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).ThreeD.IncrementRotationY -10

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationZ Method (Excel)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationZ Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the z-axis by the specified number of degrees.

Version Information

Version Added: Excel 2007

Syntax

expression .IncrementRotationZ(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape around the z-axis is to be changed. Can be a value from - 90 through 90. A positive value tilts the shape to the left; a negative value tilts it to the right.

Remarks

Use the RotationZ property to set the absolute rotation of the shape around the z-axis.

To change the rotation of a shape around the z-axis, use the IncrementRotation method.

You cannot adjust the rotation around the z-axis of the specified shape past the upper or lower limit for the RotationZ property (90 degrees to - 90 degrees). For example, if the RotationZ property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationZ property) instead of 120.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ResetRotation Method (Excel)

 Copy code hover
[image]

ThreeDFormat.ResetRotation Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward. This method doesn't reset the rotation around the z-axis.

Syntax

expression .ResetRotation

expression A variable that represents a ThreeDFormat object.

Remarks

To set the extrusion rotation around the x-axis and the y-axis to anything other than 0 (zero), use the RotationX and RotationY properties of the ThreeDFormat object. To set the extrusion rotation around the z-axis, use the Rotation property of the Shape object that represents the extruded shape.

Example

This example resets the rotation around the x-axis and the y-axis to 0 (zero) for the extrusion of shape one on myDocument.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
myDocument.Shapes(1).ThreeD.ResetRotation

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetExtrusionDirection Method (Excel)

 Copy code hover
[image]

ThreeDFormat.SetExtrusionDirection Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the direction that the extrusion's sweep path takes away from the extruded shape.

Syntax

expression .SetExtrusionDirection(PresetExtrusionDirection)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetExtrusionDirection | Required | MsoPresetExtrusionDirection | Specifies the extrusion direction.

Remarks

MsoPresetExtrusionDirection can be one of these MsoPresetExtrusionDirection constants.

msoExtrusionBottom

msoExtrusionBottomLeft

msoExtrusionBottomRight

msoExtrusionLeft

msoExtrusionNone

msoExtrusionRight

msoExtrusionTop

msoExtrusionTopLeft

msoExtrusionTopRight

msoPresetExtrusionDirectionMixed

This method sets the PresetExtrusionDirection property to the direction specified by the PresetExtrusionDirection argument.

Example

This example specifies that the extrusion for shape one on myDocument extend toward the top of the shape and that the lighting for the extrusion come from the left.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes(1).ThreeD
    .Visible = True
    .SetExtrusionDirection msoExtrusionTop
    .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetPresetCamera Method (Excel)

 Copy code hover
[image]

ThreeDFormat.SetPresetCamera Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the camera for the specified ThreeDFormat object.

Version Information

Version Added: Excel 2007

Syntax

expression .SetPresetCamera(PresetCamera)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetCamera | Required | MsoPresetCamera | Specifies the preset camera.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetThreeDFormat Method (Excel)

 Copy code hover
[image]

ThreeDFormat.SetThreeDFormat Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the various properties of the extrusion.

Syntax

expression .SetThreeDFormat(PresetThreeDFormat)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetThreeDFormat | Required | MsoPresetThreeDFormat | Specifies a preset extrusion format that corresponds to one of the options (numbered from left to right, from top to bottom) displayed when you click the 3-D button on the Drawing toolbar.

Remarks

This method sets the PresetThreeDFormat property to the format specified by the PresetThreeDFormat argument.

Example

This example adds an oval to myDocument and sets its extrusion format to 3D Style 12.

VBA Copy code Copy code
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeOval, _
        30, 30, 50, 25).ThreeD
    .Visible = True
    .SetThreeDFormat msoThreeD12
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


TickLabels Object (Excel)

 Copy code hover
[image]

TickLabels Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the tick-mark labels associated with tick marks on a chart axis.

Remarks

This object isn't a collection. There's no object that represents a single tick-mark label; you must return all the tick-mark labels as a unit.

Tick-mark label text for the category axis comes from the name of the associated category in the chart. The default tick-mark label text for the category axis is the number that indicates the position of the category relative to the left end of this axis. To change the number of unlabeled tick marks between tick-mark labels, you must change the TickLabelSpacing property for the category axis.

Tick-mark label text for the value axis is calculated based on the MajorUnit, MinimumScale, and MaximumScale properties of the value axis. To change the tick-mark label text for the value axis, you must change thte values of these properties.

Example

Use the TickLabels property to return the TickLabels object. The following example sets the number format for the tick-mark labels on the value axis in embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Axes(xlValue).TickLabels.NumberFormat = "0.00"

See also

Concepts

Excel Object Model Reference

Other resources

TickLabels Object Members


TickLabels Members (Excel)

 Copy code hover
[image]

TickLabels Members (Excel)
Send feedback

Published: July 16, 2012

Represents the tick-mark labels associated with tick marks on a chart axis.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Depth | Returns a Long value that represents the number of levels of category tick labels.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
MultiLevel | Sets whether an axis is multilevel or not. Read/write Boolean.
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Offset | Returns or sets a Long value that represents the distance between the levels of labels, and the distance between the first level and the axis line.
Orientation | Returns or sets a Long value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.


TickLabels Properties (Excel)

 Copy code hover
[image]

TickLabels Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Depth | Returns a Long value that represents the number of levels of category tick labels.
Font | Returns a Font object that represents the font of the specified object.
Format | Returns the ChartFormat object. Read-only.
MultiLevel | Sets whether an axis is multilevel or not. Read/write Boolean.
Name | Returns a String value that represents the name of the object.
NumberFormat | Returns or sets a String value that represents the format code for the object.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.
Offset | Returns or sets a Long value that represents the distance between the levels of labels, and the distance between the first level and the axis line.
Orientation | Returns or sets a Long value that represents the text orientation.
Parent | Returns the parent object for the specified object. Read-only.
ReadingOrder | Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.


TickLabels.Alignment Property (Excel)

 Copy code hover
[image]

TickLabels.Alignment Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the alignment for the specified phonetic text or tick label.

Syntax

expression .Alignment

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Application Property (Excel)

 Copy code hover
[image]

TickLabels.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a TickLabels object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Creator Property (Excel)

 Copy code hover
[image]

TickLabels.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TickLabels object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Depth Property (Excel)

 Copy code hover
[image]

TickLabels.Depth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of levels of category tick labels.

Syntax

expression .Depth

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Font Property (Excel)

 Copy code hover
[image]

TickLabels.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object.

Syntax

expression .Font

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Format Property (Excel)

 Copy code hover
[image]

TickLabels.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.MultiLevel Property (Excel)

 Copy code hover
[image]

TickLabels.MultiLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets whether an axis is multilevel or not. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .MultiLevel

expression A variable that represents a TickLabels object.

Remarks

The default for this property is true.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Name Property (Excel)

 Copy code hover
[image]

TickLabels.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormat Property (Excel)

 Copy code hover
[image]

TickLabels.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the format code for the object.

Syntax

expression .NumberFormat

expression A variable that represents a TickLabels object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormatLinked Property (Excel)

 Copy code hover
[image]

TickLabels.NumberFormatLinked Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Syntax

expression .NumberFormatLinked

expression A variable that represents a TickLabels object.

Example

This example links the number format for tick-mark labels to its cells for the value axis in Chart1.

VBA Copy code Copy code
Charts("Chart1").Axes(xlValue).TickLabels.NumberFormatLinked = True

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormatLocal Property (Excel)

 Copy code hover
[image]

TickLabels.NumberFormatLocal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the format code for the object as a string in the language of the user.

Syntax

expression .NumberFormatLocal

expression A variable that represents a TickLabels object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Offset Property (Excel)

 Copy code hover
[image]

TickLabels.Offset Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the distance between the levels of labels, and the distance between the first level and the axis line.

Syntax

expression .Offset

expression A variable that represents a TickLabels object.

Remarks

The default distance is 100 percent, which represents the default spacing between the axis labels and the axis line. The value can be an integer percentage from 0 through 1000, relative to the axis label's font size.

Example

This example sets the label spacing of the category axis in Chart1 to twice the current setting, if the offset is less than 500.

VBA Copy code Copy code
With Charts("Chart1").Axes(xlCategory).TickLabels
 If .Offset < 500 then
 .Offset = .Offset * 2
 End If
End With

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Orientation Property (Excel)

 Copy code hover
[image]

TickLabels.Orientation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the text orientation.

Syntax

expression .Orientation

expression A variable that represents a TickLabels object.

Remarks

The value of this property can be an integer value from - 90 to 90 degrees or one of the XlTickLabelOrientation constants.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Parent Property (Excel)

 Copy code hover
[image]

TickLabels.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.ReadingOrder Property (Excel)

 Copy code hover
[image]

TickLabels.ReadingOrder Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext. Read/write Long.

Syntax

expression .ReadingOrder

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels Methods (Excel)

 Copy code hover
[image]

TickLabels Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


TickLabels.Delete Method (Excel)

 Copy code hover
[image]

TickLabels.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a TickLabels object.

Return Value

Variant

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Select Method (Excel)

 Copy code hover
[image]

TickLabels.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a TickLabels object.

Return Value

Variant

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TimelineState Object (Excel)

 Copy code hover
[image]

TimelineState Object (Excel)
See also Send feedback

Published: July 16, 2012

The timeline-specific state of a SlicerCache Object (Excel) object.

Version information

Version Added: Excel 2013

Remarks

Supported contiguous ranges can be set through the TimelineState.SetFilterDateRange Method (Excel) method. When the Timeline has such a contiguous filter state, the state can be retrieved from the two properties TimelineState.StartDate Property (Excel) and TimelineState.EndDate Property (Excel). Any state that the filter may have, including non-contiguous states, can be retrieved through the three properties: TimelineState.FilterType Property (Excel), TimelineState.FilterValue1 Property (Excel), and TimelineState.FilterValue2 Property (Excel).

See also

Other resources

TimelineState Object Members


TimelineState Members (Excel)

 Copy code hover
[image]

TimelineState Members (Excel)
Send feedback

Published: July 16, 2012

The timeline-specific state of a SlicerCache Object (Excel) object.

Methods

Name | Description
SetFilterDateRange | Sets the Timeline's filter.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EndDate | Returns the end of the filtering date range (equals to TimelineState.StartDate Property (Excel) if range is a single day). Variant Read-only
FilterType | Returns the type of the date filter. XlPivotFilterType Enumeration (Excel) Read-only
FilterValue1 | Returns the 1st value associated with the date filter (semantics vary by filter type). Variant Read-only
FilterValue2 | Returns the 2nd value associated with the date filter (semantics vary by filter type). Variant Read-only
Parent | Returns an Object that represents the parent object of the specified TimelineState Object (Excel) object. Read-only.
SingleRangeFilterState | True when the filtering state is a contiguous date range; False otherwise. Boolean Read-only
StartDate | Returns the start of the filtering date range. Variant Read-only


TimelineState Properties (Excel)

 Copy code hover
[image]

TimelineState Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EndDate | Returns the end of the filtering date range (equals to TimelineState.StartDate Property (Excel) if range is a single day). Variant Read-only
FilterType | Returns the type of the date filter. XlPivotFilterType Enumeration (Excel) Read-only
FilterValue1 | Returns the 1st value associated with the date filter (semantics vary by filter type). Variant Read-only
FilterValue2 | Returns the 2nd value associated with the date filter (semantics vary by filter type). Variant Read-only
Parent | Returns an Object that represents the parent object of the specified TimelineState Object (Excel) object. Read-only.
SingleRangeFilterState | True when the filtering state is a contiguous date range; False otherwise. Boolean Read-only
StartDate | Returns the start of the filtering date range. Variant Read-only


TimelineState.Application Property (Excel)

 Copy code hover
[image]

TimelineState.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a TimelineState Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.Creator Property (Excel)

 Copy code hover
[image]

TimelineState.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a TimelineState Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.EndDate Property (Excel)

 Copy code hover
[image]

TimelineState.EndDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the end of the filtering date range (equals to TimelineState.StartDate Property (Excel) if range is a single day). Variant Read-only

Version information

Version Added: Excel 2013

Syntax

expression .EndDate

expression A variable that represents a TimelineState object.

Remarks

This property will return an error for either of the following conditions:

  • TimelineState.SingleRangeFilterState Property (Excel) == False

  • SlicerCache.FilterCleared Property (Excel) == True

Property value

VARIANT

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.FilterType Property (Excel)

 Copy code hover
[image]

TimelineState.FilterType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the date filter. XlPivotFilterType Enumeration (Excel) Read-only

Version information

Version Added: Excel 2013

Syntax

expression .FilterType

expression A variable that represents a TimelineState object.

Property value

XLPIVOTFILTERTYPE

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.FilterValue1 Property (Excel)

 Copy code hover
[image]

TimelineState.FilterValue1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the 1st value associated with the date filter (semantics vary by filter type). Variant Read-only

Version information

Version Added: Excel 2013

Syntax

expression .FilterValue1

expression A variable that represents a TimelineState object.

Property value

VARIANT

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.FilterValue2 Property (Excel)

 Copy code hover
[image]

TimelineState.FilterValue2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the 2nd value associated with the date filter (semantics vary by filter type). Variant Read-only

Version information

Version Added: Excel 2013

Syntax

expression .FilterValue2

expression A variable that represents a TimelineState object.

Property value

VARIANT

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.Parent Property (Excel)

 Copy code hover
[image]

TimelineState.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TimelineState Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a TimelineState Object (Excel) object.

Property value

OBJECT

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.SingleRangeFilterState Property (Excel)

 Copy code hover
[image]

TimelineState.SingleRangeFilterState Property (Excel)
See also Send feedback

Published: July 16, 2012

True when the filtering state is a contiguous date range; False otherwise. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .SingleRangeFilterState

expression A variable that represents a TimelineState object.

Property value

BOOL

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState.StartDate Property (Excel)

 Copy code hover
[image]

TimelineState.StartDate Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the start of the filtering date range. Variant Read-only

Version information

Version Added: Excel 2013

Syntax

expression .StartDate

expression A variable that represents a TimelineState object.

Remarks

This property will return an error for either of the following conditions:

  • TimelineState.SingleRangeFilterState Property (Excel) == False

  • SlicerCache.FilterCleared Property (Excel) == True

Property value

VARIANT

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineState Methods (Excel)

 Copy code hover
[image]

TimelineState Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
SetFilterDateRange | Sets the Timeline's filter.


TimelineState.SetFilterDateRange Method (Excel)

 Copy code hover
[image]

TimelineState.SetFilterDateRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the Timeline's filter.

Version information

Version Added: Excel 2013

Syntax

expression .SetFilterDateRange(StartDate,EndDate)

expression A variable that represents a TimelineState object.

Parameters

Name | Required/Optional | Data type | Description
StartDate | Required | VARIANT | The start of the filtering date range.
EndDate | Required | VARIANT | The end of the filtering date range.

Return value

XLFILTERSTATUS

See also

Other resources

TimelineState Object Members
TimelineState Object


TimelineViewState Object (Excel)

 Copy code hover
[image]

TimelineViewState Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the Timeline-specific members of a Slicer view.

Version information

Version Added: Excel 2013

See also

Other resources

TimelineViewState Object Members


TimelineViewState Members (Excel)

 Copy code hover
[image]

TimelineViewState Members (Excel)
Send feedback

Published: July 16, 2012

Represents the Timeline-specific members of a Slicer view.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Level | Get or set the displayed level. XlTimelineLevel Enumeration (Excel) Read/Write
Parent | Returns an Object that represents the parent object of the specified TimelineViewState Object (Excel) object. Read-only.
ShowHeader | Get or set whether the control's header is displayed. Boolean Read/Write
ShowHorizontalScrollbar | Get or set whether the control's horizontal scrollbar is displayed. Boolean Read/Write
ShowSelectionLabel | Get or set whether the control's filter selection label is displayed. Boolean Read/Write
ShowTimeLevel | Get or set whether the control's time level drop-down is displayed. Boolean Read/Write


TimelineViewState Properties (Excel)

 Copy code hover
[image]

TimelineViewState Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Level | Get or set the displayed level. XlTimelineLevel Enumeration (Excel) Read/Write
Parent | Returns an Object that represents the parent object of the specified TimelineViewState Object (Excel) object. Read-only.
ShowHeader | Get or set whether the control's header is displayed. Boolean Read/Write
ShowHorizontalScrollbar | Get or set whether the control's horizontal scrollbar is displayed. Boolean Read/Write
ShowSelectionLabel | Get or set whether the control's filter selection label is displayed. Boolean Read/Write
ShowTimeLevel | Get or set whether the control's time level drop-down is displayed. Boolean Read/Write


TimelineViewState.Application Property (Excel)

 Copy code hover
[image]

TimelineViewState.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a TimelineViewState Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.Creator Property (Excel)

 Copy code hover
[image]

TimelineViewState.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a TimelineViewState Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.Level Property (Excel)

 Copy code hover
[image]

TimelineViewState.Level Property (Excel)
See also Send feedback

Published: July 16, 2012

Get or set the displayed level. XlTimelineLevel Enumeration (Excel) Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .Level

expression A variable that represents a TimelineViewState object.

Property value

XLTIMELINELEVEL

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.Parent Property (Excel)

 Copy code hover
[image]

TimelineViewState.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TimelineViewState Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a TimelineViewState Object (Excel) object.

Property value

OBJECT

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.ShowHeader Property (Excel)

 Copy code hover
[image]

TimelineViewState.ShowHeader Property (Excel)
See also Send feedback

Published: July 16, 2012

Get or set whether the control's header is displayed. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowHeader

expression A variable that represents a TimelineViewState object.

Property value

BOOL

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.ShowHorizontalScrollbar Property (Excel)

 Copy code hover
[image]

TimelineViewState.ShowHorizontalScrollbar Property (Excel)
See also Send feedback

Published: July 16, 2012

Get or set whether the control's horizontal scrollbar is displayed. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowHorizontalScrollbar

expression A variable that represents a TimelineViewStateobject.

Property value

BOOL

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.ShowSelectionLabel Property (Excel)

 Copy code hover
[image]

TimelineViewState.ShowSelectionLabel Property (Excel)
See also Send feedback

Get or set whether the control's filter selection label is displayed. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowSelectionLabel

expression A variable that represents a TimelineViewState object.

Property value

BOOL

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


TimelineViewState.ShowTimeLevel Property (Excel)

 Copy code hover
[image]

TimelineViewState.ShowTimeLevel Property (Excel)
See also Send feedback

Published: July 16, 2012

Get or set whether the control's time level drop-down is displayed. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ShowTimeLevel

expression A variable that represents a TimelineViewState object.

Property value

BOOL

See also

Other resources

TimelineViewState Object Members
TimelineViewState Object


Top10 Object (Excel)

 Copy code hover
[image]

Top10 Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a top ten visual of a conditional formatting rule. Applying a color to a range helps you see the value of a cell relative to other cells.

Version Information

Version Added: Excel 2007

Remarks

All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create a top 10 formatting rule by using either the Add or AddTop10 method of the FormatConditions collection.

Example

The following example builds a dynamic data set and applies color to the top 10 values through conditional formatting rules.

VBA Copy code Copy code
Sub Top10CF()

' Building data
 Range("A1").Value = "Name"
 Range("B1").Value = "Number"
 Range("A2").Value = "Agent1"
 Range("A2").AutoFill Destination:=Range("A2:A26"), Type:=xlFillDefault
 Range("B2:B26").FormulaArray = "=INT(RAND()*101)"
 Range("B2:B26").Select

' Applying Conditional Formatting Top 10
 Selection.FormatConditions.AddTop10
 Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
 With Selection.FormatConditions(1)
 .TopBottom = xlTop10Top
 .Rank = 10
 .Percent = False
 End With

' Applying color fill
 With Selection.FormatConditions(1).Font
 .Color = -16752384
 .TintAndShade = 0
 End With
 With Selection.FormatConditions(1).Interior
 .PatternColorIndex = xlAutomatic
 .Color = 13561798
 .TintAndShade = 0
 End With
MsgBox "Added Top10 Conditional Format. Press F9 to update values.", vbInformation

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Top10 Object Members


Top10 Members (Excel)

 Copy code hover
[image]

Top10 Members (Excel)
Send feedback

Published: July 16, 2012

Represents a top ten visual of a conditional formatting rule. Applying a color to a range helps you see the value of a cell relative to other cells.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
CalcFor | Returns or sets one of the constants of the XlCalcFor enumeration, which specifies how the conditional format in a PivotTable report should be evaluated.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Percent | Returns or sets a Boolean value, specifying if the rank is determined by a percentage value.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
Rank | Returns or sets a Long value, specifying either the number or percentage of the rank value for the conditional format rule.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
TopBottom | Returns or sets one of the constants of the XlTopBottom enumeration, determining if the ranking is evaluated from the top or bottom.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


Top10 Properties (Excel)

 Copy code hover
[image]

Top10 Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
CalcFor | Returns or sets one of the constants of the XlCalcFor enumeration, which specifies how the conditional format in a PivotTable report should be evaluated.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Percent | Returns or sets a Boolean value, specifying if the rank is determined by a percentage value.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
Rank | Returns or sets a Long value, specifying either the number or percentage of the rank value for the conditional format rule.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
TopBottom | Returns or sets one of the constants of the XlTopBottom enumeration, determining if the ranking is evaluated from the top or bottom.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


Top10.Application Property (Excel)

 Copy code hover
[image]

Top10.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a Top10 object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.AppliesTo Property (Excel)

 Copy code hover
[image]

Top10.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Borders Property (Excel)

 Copy code hover
[image]

Top10.Borders Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Borders

expression A variable that represents a Top10 object.

Remarks

For a conditional formatting object, you can only set the properties for the top, bottom, and side borders of the cell.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.CalcFor Property (Excel)

 Copy code hover
[image]

Top10.CalcFor Property (Excel)
See also Send feedback

Returns or sets one of the constants of the XlCalcFor enumeration, which specifies how the conditional format in a PivotTable report should be evaluated.

Version Information

Version Added: Excel 2007

Syntax

expression .CalcFor

expression A variable that represents a Top10 object.

Remarks

This property is applicable only when the conditional format is being applied to data in a PivotTable report.

This property can be set to xlAllValues, xlColGroups, or xlRowGroups only if the Top10.ScopeType property is set to xlFieldsScope.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Creator Property (Excel)

 Copy code hover
[image]

Top10.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Top10 object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Font Property (Excel)

 Copy code hover
[image]

Top10.Font Property (Excel)
See also Send feedback

Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Font

expression A variable that represents a Top10 object.

Remarks

Not all properties of the Font object are supported for a conditional formatting object. You can set the font style, underline, color, and strikethrough attributes.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Interior Property (Excel)

 Copy code hover
[image]

Top10.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Interior

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.NumberFormat Property (Excel)

 Copy code hover
[image]

Top10.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .NumberFormat

expression A variable that represents a Top10 object.

Remarks

The number format is specified using the same format codes displayed on the Number tab of the Format Cells dialog box. You can use a built-in number format, for example "General", or create a custom number format.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Parent Property (Excel)

 Copy code hover
[image]

Top10.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Percent Property (Excel)

 Copy code hover
[image]

Top10.Percent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value, specifying if the rank is determined by a percentage value.

Version Information

Version Added: Excel 2007

Syntax

expression .Percent

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Priority Property (Excel)

 Copy code hover
[image]

Top10.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a Top10 object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formattting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.PTCondition Property (Excel)

 Copy code hover
[image]

Top10.PTCondition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Rank Property (Excel)

 Copy code hover
[image]

Top10.Rank Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value, specifying either the number or percentage of the rank value for the conditional format rule.

Version Information

Version Added: Excel 2007

Syntax

expression .Rank

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.ScopeType Property (Excel)

 Copy code hover
[image]

Top10.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents a Top10 object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.StopIfTrue Property (Excel)

 Copy code hover
[image]

Top10.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents a Top10 object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.TopBottom Property (Excel)

 Copy code hover
[image]

Top10.TopBottom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlTopBottom enumeration, determining if the ranking is evaluated from the top or bottom.

Version Information

Version Added: Excel 2007

Syntax

expression .TopBottom

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.Type Property (Excel)

 Copy code hover
[image]

Top10.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a Top10 object.

Remarks

This property will always return a Long value of "5", which is equivalent to xlTop10.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10 Methods (Excel)

 Copy code hover
[image]

Top10 Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


Top10.Delete Method (Excel)

 Copy code hover
[image]

Top10.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a Top10 object.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

Top10.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents a Top10 object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.SetFirstPriority Method (Excel)

 Copy code hover
[image]

Top10.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents a Top10 object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


Top10.SetLastPriority Method (Excel)

 Copy code hover
[image]

Top10.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents a Top10 object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

Top10 Object

Other resources

Top10 Object Members


TreeviewControl Object (Excel)

 Copy code hover
[image]

TreeviewControl Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the hierarchical member-selection control of a cube field.

Remarks

You use this object primarily for macro recording; it is not intended for any other use.

Example

Use the TreeviewControl property to return the TreeviewControl object. The following example sets the control to its "drilled" (expanded, or visible) status for the states of California and Maryland in the second PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable2") _
 .CubeFields(1).TreeviewControl.Drilled = _
 Array(Array("", ""), _
 Array("[state].[states].[CA]", _
 "[state].[states].[MD]"))

See also

Concepts

Excel Object Model Reference

Other resources

TreeviewControl Object Members


TreeviewControl Members (Excel)

 Copy code hover
[image]

TreeviewControl Members (Excel)
Send feedback

Represents the hierarchical member-selection control of a cube field.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Drilled | Sets the "drilled" (expanded, or visible) status of the cube field members in the hierarchical member-selection control of a cube field. This property is used primarily for macro recording and isn't intended for any other use. Read/write.
Hidden | Returns or sets a Variant value that represents the hidden status of the cube field members in the hierarchical member selection control of a cube field.
Parent | Returns the parent object for the specified object. Read-only.


TreeviewControl Properties (Excel)

 Copy code hover
[image]

TreeviewControl Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Drilled | Sets the "drilled" (expanded, or visible) status of the cube field members in the hierarchical member-selection control of a cube field. This property is used primarily for macro recording and isn't intended for any other use. Read/write.
Hidden | Returns or sets a Variant value that represents the hidden status of the cube field members in the hierarchical member selection control of a cube field.
Parent | Returns the parent object for the specified object. Read-only.


TreeviewControl.Application Property (Excel)

 Copy code hover
[image]

TreeviewControl.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a TreeviewControl object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

TreeviewControl Object

Other resources

TreeviewControl Object Members


TreeviewControl.Creator Property (Excel)

 Copy code hover
[image]

TreeviewControl.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a TreeviewControl object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

TreeviewControl Object

Other resources

TreeviewControl Object Members


TreeviewControl.Drilled Property (Excel)

 Copy code hover
[image]

TreeviewControl.Drilled Property (Excel)
See also Send feedback

Published: July 16, 2012

Sets the "drilled" (expanded, or visible) status of the cube field members in the hierarchical member-selection control of a cube field. This property is used primarily for macro recording and isn't intended for any other use. Read/write.

Syntax

expression .Drilled

expression A variable that represents a TreeviewControl object.

Remarks

The Drilled property accepts an array. Each element of the array corresponds to a level of the cube field that has been expanded. The maximum number of elements is the number of levels in the cube field. Each element of the array is an array of type String, containing unique member names that are visible (expanded) at the corresponding level of the control. See the TreeviewControl object's Hidden property to determine when members are explicitly hidden in an expanded view.

Note Note

This property does not return an array that represents the drilled status of the cube field members in the hierarchical member-selection control of a cube field.

Example

This example expands the second-level members of the first cube field in the first PivotTable report on the active worksheet.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").CubeFields(1) _
 .TreeviewControl.Drilled = _
 Array(Array("", "", "", "", "", "", "", "", _
 "", "", "", ""), _
 Array("[state].[states].[AB]", _
 "[state].[states].[CA]", _
 "[state].[states].[IN]", _
 "[state].[states].[KS]", _
 "[state].[states].[KY]", _
 "[state].[states].[MD]", _
 "[state].[states].[MI]", _
 "[state].[states].[OH]", _
 "[state].[states].[OR]", _
 "[state].[states].[TN]", _
 "[state].[states].[UT]", _
 "[state].[states].[WA]"))

See also

Concepts

TreeviewControl Object

Other resources

TreeviewControl Object Members


TreeviewControl.Hidden Property (Excel)

 Copy code hover
[image]

TreeviewControl.Hidden Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the hidden status of the cube field members in the hierarchical member selection control of a cube field.

Syntax

expression .Hidden

expression A variable that represents a TreeviewControl object.

Remarks

Don't confuse this property with the FormulaHidden property.

The Hidden property returns or sets an array. Each element of the array corresponds to a level of the cube field that is hidden. The maximum number of elements is the number of levels in the cube field. Each element of the array is an array of type String, containing unique member names that are hidden at the corresponding level of the control. See the DrilledDown property of the PivotItem object to determine when members are visible (expanded) in the control.

Example

This example hides the second level member [state].[states].[CA].[Covelo] of the first cube field in the first PivotTable report.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1").CubeFields(1) _
 .TreeviewControl.Hidden = _
 Array(Array(""), Array(""), _
 Array("[state].[states].[CA].[Covelo]"))

See also

Concepts

TreeviewControl Object

Other resources

TreeviewControl Object Members


TreeviewControl.Parent Property (Excel)

 Copy code hover
[image]

TreeviewControl.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a TreeviewControl object.

See also

Concepts

TreeviewControl Object

Other resources

TreeviewControl Object Members


Trendline Object (Excel)

 Copy code hover
[image]

Trendline Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a trendline in a chart.

Remarks

A trendline shows the trend, or direction, of data in a series. The Trendline object is a member of the Trendlines collection. The Trendlines collection contains all the Trendline objects for a single series.

Example

Use Trendlines(index), where index is the trendline index number, to return a single Trendline object.

The index number denotes the order in which the trendlines were added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.

The following example changes the trendline type for the first series in embedded chart one on worksheet one. If the series has no trendline, this example will fail.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

See also

Concepts

Excel Object Model Reference

Other resources

Trendline Object Members


Trendline Members (Excel)

 Copy code hover
[image]

Trendline Members (Excel)
Send feedback

Published: July 16, 2012

Represents a trendline in a chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Backward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataLabel | Returns a DataLabel object that represents the data label associated with the trendline. Read-only.
DisplayEquation | True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. Read/write Boolean.
DisplayRSquared | True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. Read/write Boolean.
Format | Returns the ChartFormat object. Read-only.
Forward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Intercept | Returns or sets the point where the trendline crosses the value axis. Read/write Double.
InterceptIsAuto | True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
NameIsAuto | True if Microsoft Excel automatically determines the name of the trendline. Read/write Boolean.
Order | Returns or sets a Long value that represents the trendline order (an integer greater than 1) when the trendline type is xlPolynomial.
Parent | Returns the parent object for the specified object. Read-only.
Period | Returns or sets the period for the moving-average trendline. Can be a value from 2 through 255. Read/write Long.
Type | Returns or sets a XlTrendlineType value that represents the trendline type.


Trendline Properties (Excel)

 Copy code hover
[image]

Trendline Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Backward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.
Border | Returns a Border object that represents the border of the object.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataLabel | Returns a DataLabel object that represents the data label associated with the trendline. Read-only.
DisplayEquation | True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. Read/write Boolean.
DisplayRSquared | True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. Read/write Boolean.
Format | Returns the ChartFormat object. Read-only.
Forward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Intercept | Returns or sets the point where the trendline crosses the value axis. Read/write Double.
InterceptIsAuto | True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.
Name | Returns or sets a String value representing the name of the object.
NameIsAuto | True if Microsoft Excel automatically determines the name of the trendline. Read/write Boolean.
Order | Returns or sets a Long value that represents the trendline order (an integer greater than 1) when the trendline type is xlPolynomial.
Parent | Returns the parent object for the specified object. Read-only.
Period | Returns or sets the period for the moving-average trendline. Can be a value from 2 through 255. Read/write Long.
Type | Returns or sets a XlTrendlineType value that represents the trendline type.


Trendline.Application Property (Excel)

 Copy code hover
[image]

Trendline.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Trendline object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Backward2 Property (Excel)

 Copy code hover
[image]

Trendline.Backward2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .Backward2

expression A variable that represents a Trendline object.

Example

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines(1)
 .Forward2 = 5
 .Backward2 = .5
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Border Property (Excel)

 Copy code hover
[image]

Trendline.Border Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the object.

Syntax

expression .Border

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Creator Property (Excel)

 Copy code hover
[image]

Trendline.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Trendline object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DataLabel Property (Excel)

 Copy code hover
[image]

Trendline.DataLabel Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DataLabel object that represents the data label associated with the trendline. Read-only.

Syntax

expression .DataLabel

expression A variable that represents a Trendline object.

Remarks

To turn on data labels for a trendline you need to set the DisplayEquation property or the DisplayRSquared property to True.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DisplayEquation Property (Excel)

 Copy code hover
[image]

Trendline.DisplayEquation Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. Read/write Boolean.

Syntax

expression .DisplayEquation

expression A variable that represents a Trendline object.

Example

This example displays the R-squared value and equation for trendline one in Chart1. The example should be run on a 2-D column chart that has a trendline for the first series.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DisplayRSquared Property (Excel)

 Copy code hover
[image]

Trendline.DisplayRSquared Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. Read/write Boolean.

Syntax

expression .DisplayRSquared

expression A variable that represents a Trendline object.

Example

This example displays the R-squared value and equation for trendline one in Chart1. The example should be run on a 2-D column chart that has a trendline for the first series.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Format Property (Excel)

 Copy code hover
[image]

Trendline.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Forward2 Property (Excel)

 Copy code hover
[image]

Trendline.Forward2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.

Version Information

Version Added: Excel 2007

Syntax

expression .Forward2

expression A variable that represents a Trendline object.

Example

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines(1)
 .Forward2 = 5
 .Backward2 = .5
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Index Property (Excel)

 Copy code hover
[image]

Trendline.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Intercept Property (Excel)

 Copy code hover
[image]

Trendline.Intercept Property (Excel)
See also Send feedback

Returns or sets the point where the trendline crosses the value axis. Read/write Double.

Syntax

expression .Intercept

expression An expression that returns a Trendline object.

Return Value

Double

Remarks

Setting this property sets the InterceptIsAuto property to False.

Example

This example sets trendline one in Chart1 to cross the value axis at 5. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Trendlines(1).Intercept = 5

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.InterceptIsAuto Property (Excel)

 Copy code hover
[image]

Trendline.InterceptIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.

Syntax

expression .InterceptIsAuto

expression A variable that represents a Trendline object.

Remarks

Setting the Intercept property sets this property to False.

Example

This example sets Microsoft Excel to automatically determine the trendline intercept point for Chart1. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1).Trendlines(1) _
 .InterceptIsAuto = True

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Name Property (Excel)

 Copy code hover
[image]

Trendline.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value representing the name of the object.

Syntax

expression .Name

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.NameIsAuto Property (Excel)

 Copy code hover
[image]

Trendline.NameIsAuto Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel automatically determines the name of the trendline. Read/write Boolean.

Syntax

expression .NameIsAuto

expression A variable that represents a Trendline object.

Example

This example sets Microsoft Excel to automatically determine the name for trendline one in Chart1. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
Charts("Chart1").SeriesCollection(1) _
 .Trendlines(1).NameIsAuto = True

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Order Property (Excel)

 Copy code hover
[image]

Trendline.Order Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long value that represents the trendline order (an integer greater than 1) when the trendline type is xlPolynomial.

Syntax

expression .Order

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Parent Property (Excel)

 Copy code hover
[image]

Trendline.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Period Property (Excel)

 Copy code hover
[image]

Trendline.Period Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the period for the moving-average trendline. Can be a value from 2 through 255. Read/write Long.

Syntax

expression .Period

expression A variable that represents a Trendline object.

Example

This example sets the period for the moving-average trendline on Chart1. The example should be run on a 2-D column chart with a single series that contains 10 data points and a moving-average trendline.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines(1)
 If .Type = xlMovingAvg Then .Period = 5
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Type Property (Excel)

 Copy code hover
[image]

Trendline.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlTrendlineType value that represents the trendline type.

Syntax

expression .Type

expression A variable that represents a Trendline object.

Example

This example changes the trendline type for the first series in embedded chart one on worksheet one. If the series has no trendline, this example fails.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline Methods (Excel)

 Copy code hover
[image]

Trendline Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.


Trendline.ClearFormats Method (Excel)

 Copy code hover
[image]

Trendline.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Trendline object.

Return Value

Variant

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Delete Method (Excel)

 Copy code hover
[image]

Trendline.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Trendline object.

Return Value

Variant

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Select Method (Excel)

 Copy code hover
[image]

Trendline.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Trendline object.

Return Value

Variant

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendlines Object (Excel)

 Copy code hover
[image]

Trendlines Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Trendline objects for the specified series.

Remarks

Each Trendline object represents a trendline in a chart. A trendline shows the trend, or direction, of data in a series.

Example

Use the Trendlines method to return the Trendlines collection. The following example displays the number of trendlines for series one in Chart1.

VBA Copy code Copy code
MsgBox Charts(1).SeriesCollection(1).Trendlines.Count

Use the Add method to create a new trendline and add it to the series. The following example adds a linear trendline to the first series in embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart.SeriesCollection(1) _
 .Trendlines.Add type:=xlLinear, name:="Linear Trend"

Use Trendlines(index), where index is the trendline index number, to return a single TrendLine object. The following example changes the trendline type for the first series in embedded chart one on worksheet one. If the series has no trendline, this example will fail.

The index number denotes the order in which the trendlines were added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.

VBA Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

See also

Concepts

Excel Object Model Reference

Other resources

Trendlines Object Members


Trendlines Members (Excel)

 Copy code hover
[image]

Trendlines Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Trendline objects for the specified series.

Methods

Name | Description
Add | Creates a new trendline.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Trendlines Properties (Excel)

 Copy code hover
[image]

Trendlines Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


Trendlines.Application Property (Excel)

 Copy code hover
[image]

Trendlines.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Trendlines object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Count Property (Excel)

 Copy code hover
[image]

Trendlines.Count Property (Excel)
See also Send feedback

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Trendlines object.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Creator Property (Excel)

 Copy code hover
[image]

Trendlines.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Trendlines object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Parent Property (Excel)

 Copy code hover
[image]

Trendlines.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Trendlines object.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines Methods (Excel)

 Copy code hover
[image]

Trendlines Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new trendline.
Item | Returns a single object from a collection.


Trendlines.Add Method (Excel)

 Copy code hover
[image]

Trendlines.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new trendline.

Syntax

expression .Add(Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

expression A variable that represents a Trendlines object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlTrendlineType | The trendline type.
Order | Optional | Variant | Variant. if Type is xlPolynomial. The trendline order. Must be an integer from 2 to 6, inclusive.
Period | Optional | Variant | if Type is xlMovingAvg. The trendline period. Must be an integer greater than 1 and less than the number of data points in the series you're adding a trendline to.
Forward | Optional | Variant | The number of periods (or units on a scatter chart) that the trendline extends forward.
Backward | Optional | Variant | The number of periods (or units on a scatter chart) that the trendline extends backward.
Intercept | Optional | Variant | The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.
DisplayEquation | Optional | Variant | True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default value is False.
DisplayRSquared | Optional | Variant | True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default value is False.
Name | Optional | Variant | The name of the trendline as text. If this argument is omitted, Microsoft Excel generates a name.

Return Value

A Trendline object that represents the new trendline.

Example

This example creates a new linear trendline in Chart1.

VBA Copy code Copy code
ActiveWorkbook.Charts("Chart1").SeriesCollection(1).Trendlines.Add

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Item Method (Excel)

 Copy code hover
[image]

Trendlines.Item Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Trendlines object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The index number for the object.

Return Value

A Trendline object contained by the collection.

Example

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines.Item(1)
 .Forward = 5
 .Backward = .5
End With

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


UniqueValues Object (Excel)

 Copy code hover
[image]

UniqueValues Object (Excel)
See also Send feedback

Published: July 16, 2012

The UniqueValues object uses the DupeUnique property to returns or sets an enum that determines whether the rule should look for duplicate or unique values in the range.

Version Information

Version Added: Excel 2007

See also

Concepts

Excel Object Model Reference

Other resources

UniqueValues Object Members


UniqueValues Members (Excel)

 Copy code hover
[image]

UniqueValues Members (Excel)
Send feedback

Published: July 16, 2012

The UniqueValues object uses the DupeUnique property to returns or sets an enum that determines whether the rule should look for duplicate or unique values in the range.

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DupeUnique | Returns or sets one of the constants of the XlDupeUnique enumeration, specifying if the conditional format rule is looking for unique or duplicate values.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


UniqueValues Properties (Excel)

 Copy code hover
[image]

UniqueValues Properties (Excel)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
AppliesTo | Returns a Range object specifying the cell range to which the formatting rule is applied.
Borders | Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DupeUnique | Returns or sets one of the constants of the XlDupeUnique enumeration, specifying if the conditional format rule is looking for unique or duplicate values.
Font | Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.
Interior | Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.
NumberFormat | Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.
Parent | Returns the parent object for the specified object. Read-only.
Priority | Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
PTCondition | Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.
ScopeType | Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.
StopIfTrue | Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Type | Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.


UniqueValues.Application Property (Excel)

 Copy code hover
[image]

UniqueValues.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a UniqueValues object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.AppliesTo Property (Excel)

 Copy code hover
[image]

UniqueValues.AppliesTo Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object specifying the cell range to which the formatting rule is applied.

Version Information

Version Added: Excel 2007

Syntax

expression .AppliesTo

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Borders Property (Excel)

 Copy code hover
[image]

UniqueValues.Borders Property (Excel)
See also Send feedback

Returns a Borders collection that specifies the formatting of cell borders if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Borders

expression A variable that represents a UniqueValues object.

Remarks

For a conditional formatting object, you can only set the properties for the top, bottom, and side borders of the cell.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Creator Property (Excel)

 Copy code hover
[image]

UniqueValues.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a UniqueValues object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.DupeUnique Property (Excel)

 Copy code hover
[image]

UniqueValues.DupeUnique Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlDupeUnique enumeration, specifying if the conditional format rule is looking for unique or duplicate values.

Version Information

Version Added: Excel 2007

Syntax

expression .DupeUnique

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Font Property (Excel)

 Copy code hover
[image]

UniqueValues.Font Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Font object that specifies the font formatting if the conditional formatting rule evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Font

expression A variable that represents a UniqueValues object.

Remarks

Not all properties of the Font object are supported for a conditional formatting object. You can set the font style, underline, color, and strikethrough attributes.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Interior Property (Excel)

 Copy code hover
[image]

UniqueValues.Interior Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Interior object that specifies a cell's interior attributes for a conditional formatting rule that evaluates to True. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Interior

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.NumberFormat Property (Excel)

 Copy code hover
[image]

UniqueValues.NumberFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .NumberFormat

expression A variable that represents a UniqueValues object.

Remarks

The number format is specified using the same format codes displayed on the Number tab of the Format Cells dialog box. You can use a built-in number format, for example "General", or create a custom number format.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Parent Property (Excel)

 Copy code hover
[image]

UniqueValues.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Priority Property (Excel)

 Copy code hover
[image]

UniqueValues.Priority Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .Priority

expression A variable that represents a UniqueValues object.

Remarks

When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.PTCondition Property (Excel)

 Copy code hover
[image]

UniqueValues.PTCondition Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value indicating if the conditional format is being applied to a PivotTable. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .PTCondition

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.ScopeType Property (Excel)

 Copy code hover
[image]

UniqueValues.ScopeType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .ScopeType

expression A variable that represents a UniqueValues object.

Remarks

The default value is xlSelectionScope, which sets the scope using the AppliesTo property.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.StopIfTrue Property (Excel)

 Copy code hover
[image]

UniqueValues.StopIfTrue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.

Version Information

Version Added: Excel 2007

Syntax

expression .StopIfTrue

expression A variable that represents a UniqueValues object.

Remarks

To support backward compatibility, the default value for this property is True, which is the opposite behavior of a formatting rule created in the user interface.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.Type Property (Excel)

 Copy code hover
[image]

UniqueValues.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns one of the constants of the XlFormatConditionType enumeration, which specifies the type of conditional format. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a UniqueValues object.

Remarks

This property will always return a Long value of "8", which is equivalent to xlUniqueValues.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues Methods (Excel)

 Copy code hover
[image]

UniqueValues Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified conditional formatting rule object.
ModifyAppliesToRange | Sets the cell range to which this formatting rule applies.
SetFirstPriority | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
SetLastPriority | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.


UniqueValues.Delete Method (Excel)

 Copy code hover
[image]

UniqueValues.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified conditional formatting rule object.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a UniqueValues object.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.ModifyAppliesToRange Method (Excel)

 Copy code hover
[image]

UniqueValues.ModifyAppliesToRange Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the cell range to which this formatting rule applies.

Version Information

Version Added: Excel 2007

Syntax

expression .ModifyAppliesToRange(Range)

expression A variable that represents a UniqueValues object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which this formatting rule will be applied.

Remarks

The range must be in the A1 reference style and be entirely contained within the sheet that is the parent of the FormatConditions collection. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). Dollar signs can also be used but they are ignored.

You can also use a local defined name in any part of the range, but the name must be in the language of the macro.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.SetFirstPriority Method (Excel)

 Copy code hover
[image]

UniqueValues.SetFirstPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetFirstPriority

expression A variable that represents a UniqueValues object.

Remarks

When you have multiple conditional formatting rules in a worksheet, if the rule was not previously set to priority "1", this method will cause the priority of all other existing rules on the worksheet to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UniqueValues.SetLastPriority Method (Excel)

 Copy code hover
[image]

UniqueValues.SetLastPriority Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

Version Information

Version Added: Excel 2007

Syntax

expression .SetLastPriority

expression A variable that represents a UniqueValues object.

Remarks

The actual vaule of the priority will be equal to the total number of conditional formatting rules on the worksheet. When you have multiple conditional formatting rules in a worksheet, this method will cause the priority of rules that had a priority value greater than this rule to be increased by one.

Note Note

Priority levels for conditional formatting rules are applied on a worksheet-level basis.

See also

Concepts

UniqueValues Object

Other resources

UniqueValues Object Members


UpBars Object (Excel)

 Copy code hover
[image]

UpBars Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the up bars in a chart group.

Remarks

Up bars connect points on series one with higher values on the last series in the chart group (the lines go up from series one). Only 2-D line groups that contain at least two series can have up bars. This object isn't a collection. There's no object that represents a single up bar; you either have up bars turned on for all points in a chart group or you have them turned off.

If the HasUpDownBars property is False, most properties of the UpBars object are disabled.

Example

Use the UpBars property to return the UpBars object. The following example turns on up and down bars for chart group one in embedded chart one on Sheet5. The example then sets the up bar color to blue and sets the down bar color to red.

VBA Copy code Copy code
With Worksheets("sheet5").ChartObjects(1).Chart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
End With

See also

Concepts

Excel Object Model Reference

Other resources

UpBars Object Members


UpBars Members (Excel)

 Copy code hover
[image]

UpBars Members (Excel)
Send feedback

Published: July 16, 2012

Represents the up bars in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


UpBars Properties (Excel)

 Copy code hover
[image]

UpBars Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.


UpBars.Application Property (Excel)

 Copy code hover
[image]

UpBars.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a UpBars object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Creator Property (Excel)

 Copy code hover
[image]

UpBars.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a UpBars object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Format Property (Excel)

 Copy code hover
[image]

UpBars.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Name Property (Excel)

 Copy code hover
[image]

UpBars.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Parent Property (Excel)

 Copy code hover
[image]

UpBars.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars Methods (Excel)

 Copy code hover
[image]

UpBars Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


UpBars.Delete Method (Excel)

 Copy code hover
[image]

UpBars.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an UpBars object.

Return Value

Variant

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Select Method (Excel)

 Copy code hover
[image]

UpBars.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents an UpBars object.

Return Value

Variant

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UsedObjects Object (Excel)

 Copy code hover
[image]

UsedObjects Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents objects that have been allocated in a workbook.

Example

Use the UsedObjects property of the Application object to return a UsedObjects collection.

Once a UsedObjects collection is returned, you can determine the quantity of used objects in a Microsoft Excel application using the Count property.

In this example, Microsoft Excel determines the quantity of objects that have been allocated and notifies the user. This example assumes a recalculation was performed in the application and was interrupted before finishing.

VBA Copy code Copy code
Sub CountUsedObjects()

 MsgBox "The number of used objects in this application is: " & _
 Application.UsedObjects.Count

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

UsedObjects Object Members


UsedObjects Members (Excel)

 Copy code hover
[image]

UsedObjects Members (Excel)
Send feedback

Published: July 16, 2012

Represents objects that have been allocated in a workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


UsedObjects Properties (Excel)

 Copy code hover
[image]

UsedObjects Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


UsedObjects.Application Property (Excel)

 Copy code hover
[image]

UsedObjects.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a UsedObjects object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

UsedObjects Object

Other resources

UsedObjects Object Members


UsedObjects.Count Property (Excel)

 Copy code hover
[image]

UsedObjects.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an UsedObjects object.

See also

Concepts

UsedObjects Object

Other resources

UsedObjects Object Members


UsedObjects.Creator Property (Excel)

 Copy code hover
[image]

UsedObjects.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a UsedObjects object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

UsedObjects Object

Other resources

UsedObjects Object Members


UsedObjects.Item Property (Excel)

 Copy code hover
[image]

UsedObjects.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an UsedObjects object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

UsedObjects Object

Other resources

UsedObjects Object Members


UsedObjects.Parent Property (Excel)

 Copy code hover
[image]

UsedObjects.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a UsedObjects object.

See also

Concepts

UsedObjects Object

Other resources

UsedObjects Object Members


UserAccess Object (Excel)

 Copy code hover
[image]

UserAccess Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the user access for a protected range.

Example

Use the Add method or the Item property of the UserAccessList collection to return a UserAccess object.

Once a UserAccess object is returned, you can determine if access is allowed for a particular range in an worksheet, using the AllowEdit property. The following example adds a range that can be edited on a protected worksheet and notifies the user the title of that range.

VBA Copy code Copy code
Sub UseAllowEditRanges()

 Dim wksSheet As Worksheet

 Set wksSheet = Application.ActiveSheet

 ' Add a range that can be edited on the protected worksheet.
 wksSheet.Protection.AllowEditRanges.Add "Test", Range("A1")

 ' Notify the user the title of the range that can be edited.
 MsgBox wksSheet.Protection.AllowEditRanges(1).Title

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

UserAccess Object Members


UserAccess Members (Excel)

 Copy code hover
[image]

UserAccess Members (Excel)
Send feedback

Published: July 16, 2012

Represents the user access for a protected range.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
AllowEdit | Returns or sets a Boolean value that indicates if the user is allowed access to the specified range on a protected worksheet.
Name | Returns or sets a String value that represents the name of the object.


UserAccess Properties (Excel)

 Copy code hover
[image]

UserAccess Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowEdit | Returns or sets a Boolean value that indicates if the user is allowed access to the specified range on a protected worksheet.
Name | Returns or sets a String value that represents the name of the object.


UserAccess.AllowEdit Property (Excel)

 Copy code hover
[image]

UserAccess.AllowEdit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that indicates if the user is allowed access to the specified range on a protected worksheet.

Syntax

expression .AllowEdit

expression A variable that represents an UserAccess object.

See also

Concepts

UserAccess Object

Other resources

UserAccess Object Members


UserAccess.Name Property (Excel)

 Copy code hover
[image]

UserAccess.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents an UserAccess object.

See also

Concepts

UserAccess Object

Other resources

UserAccess Object Members


UserAccess Methods (Excel)

 Copy code hover
[image]

UserAccess Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


UserAccess.Delete Method (Excel)

 Copy code hover
[image]

UserAccess.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents an UserAccess object.

See also

Concepts

UserAccess Object

Other resources

UserAccess Object Members


UserAccessList Object (Excel)

 Copy code hover
[image]

UserAccessList Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of UserAccess objects that represent the user access for protected ranges.

Example

Use the Users property of the protected Range object to return a UserAccessList collection.

Once a UserAccessList collection is returned you can use the Count property to determine the number of users that have access to a protected range. In the following example, Microsoft Excel notifies the user the numbers users that have access to the first protected range. This example assumes that a protected range exists on the active worksheet.

VBA Copy code Copy code
Sub UseDeleteAll()

 Dim wksSheet As Worksheet

 Set wksSheet = Application.ActiveSheet

 ' Notify the user the number of users that can access the protected range.
 MsgBox wksSheet.Protection.AllowEditRanges(1).Users.Count

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

UserAccessList Object Members


UserAccessList Members (Excel)

 Copy code hover
[image]

UserAccessList Members (Excel)
Send feedback

Published: July 16, 2012

A collection of UserAccess objects that represent the user access for protected ranges.

Methods

Name | Description
Add | Adds a user access list.
DeleteAll | Removes all users who have access to a protected range on a worksheet.

Properties

Name | Description
Count | Returns a Long value that represents the number of objects in the collection.
Item | Returns a single object from a collection.


UserAccessList Properties (Excel)

 Copy code hover
[image]

UserAccessList Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns a Long value that represents the number of objects in the collection.
Item | Returns a single object from a collection.


UserAccessList.Count Property (Excel)

 Copy code hover
[image]

UserAccessList.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents an UserAccessList object.

See also

Concepts

UserAccessList Object

Other resources

UserAccessList Object Members


UserAccessList.Item Property (Excel)

 Copy code hover
[image]

UserAccessList.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents an UserAccessList object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Remarks

For more information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

UserAccessList Object

Other resources

UserAccessList Object Members


UserAccessList Methods (Excel)

 Copy code hover
[image]

UserAccessList Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a user access list.
DeleteAll | Removes all users who have access to a protected range on a worksheet.


UserAccessList.Add Method (Excel)

 Copy code hover
[image]

UserAccessList.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a user access list.

Syntax

expression .Add(Name, AllowEdit)

expression A variable that represents an UserAccessList object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the user access list.
AllowEdit | Required | Boolean | True allows users on the access list to edit the editable ranges on a protected worksheet.

Return Value

A UserAccess object that represents the new user access list.

See also

Concepts

UserAccessList Object

Other resources

UserAccessList Object Members


UserAccessList.DeleteAll Method (Excel)

 Copy code hover
[image]

UserAccessList.DeleteAll Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all users who have access to a protected range on a worksheet.

Syntax

expression .DeleteAll

expression A variable that represents a UserAccessList object.

Example

In this example, Microsoft Excel removes all users that have access to the first protected range on the active worksheet. This example assumes the worksheet is not protected.

VBA Copy code Copy code
Sub UseDeleteAll()

 Dim wksSheet As Worksheet

 Set wksSheet = Application.ActiveSheet

 ' Remove all users with access to the first protected range.
 wksSheet.Protection.AllowEditRanges(1).Users.DeleteAll

End Sub

See also

Concepts

UserAccessList Object

Other resources

UserAccessList Object Members


Validation Object (Excel)

 Copy code hover
[image]

Validation Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents data validation for a worksheet range.

Example

Use the Validation property to return the Validation object. The following example changes the data validation for cell E5.

VBA Copy code Copy code
Range("e5").Validation _
 .Modify xlValidateList, xlValidAlertStop, "=$A$1:$A$10"

Use the Add method to add data validation to a range and create a new Validation object. The following example adds data validation to cell E5.

VBA Copy code Copy code
With Range("e5").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:=xlValidAlertInformation, _
 Minimum:="5", Maximum:="10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Excel Object Model Reference

Other resources

Validation Object Members


Validation Members (Excel)

 Copy code hover
[image]

Validation Members (Excel)
Send feedback

Represents data validation for a worksheet range.

Methods

Name | Description
Add | Adds data validation to the specified range.
Delete | Deletes the object.
Modify | Modifies data validation for a range.

Properties

Name | Description
AlertStyle | Returns the validation alert style. Read-only XlDVAlertStyle.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorMessage | Returns or sets the data validation error message. Read/write String.
ErrorTitle | Returns or sets the title of the data-validation error dialog box. Read/write String.
Formula1 | Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Formula2 | Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
IgnoreBlank | True if blank values are permitted by the range data validation. Read/write Boolean.
IMEMode | Returns or sets the description of the Japanese input rules. Can be one of the XlIMEMode constants listed in the following table. Read/write Long.
InCellDropdown | True if data validation displays a drop-down list that contains acceptable values. Read/write Boolean.
InputMessage | Returns or sets the data validation input message. Read/write String.
InputTitle | Returns or sets the title of the data-validation input dialog box. Read/write String.
Operator | Returns a Long value that represents the operator for the data validation.
Parent | Returns the parent object for the specified object. Read-only.
ShowError | True if the data validation error message will be displayed whenever the user enters invalid data. Read/write Boolean.
ShowInput | True if the data validation input message will be displayed whenever the user selects a cell in the data validation range. Read/write Boolean.
Type | Returns a Long value, containing a XlDVType constant, that represents the data type validation for a range.
Value | Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).


Validation Properties (Excel)

 Copy code hover
[image]

Validation Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlertStyle | Returns the validation alert style. Read-only XlDVAlertStyle.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
ErrorMessage | Returns or sets the data validation error message. Read/write String.
ErrorTitle | Returns or sets the title of the data-validation error dialog box. Read/write String.
Formula1 | Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
Formula2 | Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.
IgnoreBlank | True if blank values are permitted by the range data validation. Read/write Boolean.
IMEMode | Returns or sets the description of the Japanese input rules. Can be one of the XlIMEMode constants listed in the following table. Read/write Long.
InCellDropdown | True if data validation displays a drop-down list that contains acceptable values. Read/write Boolean.
InputMessage | Returns or sets the data validation input message. Read/write String.
InputTitle | Returns or sets the title of the data-validation input dialog box. Read/write String.
Operator | Returns a Long value that represents the operator for the data validation.
Parent | Returns the parent object for the specified object. Read-only.
ShowError | True if the data validation error message will be displayed whenever the user enters invalid data. Read/write Boolean.
ShowInput | True if the data validation input message will be displayed whenever the user selects a cell in the data validation range. Read/write Boolean.
Type | Returns a Long value, containing a XlDVType constant, that represents the data type validation for a range.
Value | Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).


Validation.AlertStyle Property (Excel)

 Copy code hover
[image]

Validation.AlertStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the validation alert style. Read-only XlDVAlertStyle.

Syntax

expression .AlertStyle

expression A variable that represents a Validation object.

Remarks

Use the Add method to set the alert style for a range. If the range already has data validation, use the Modify method to change the alert style.

Example

This example displays the alert style for cell E5.

VBA Copy code Copy code
MsgBox Range("e5").Validation.AlertStyle

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Application Property (Excel)

 Copy code hover
[image]

Validation.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Validation object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Creator Property (Excel)

 Copy code hover
[image]

Validation.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Validation object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.ErrorMessage Property (Excel)

 Copy code hover
[image]

Validation.ErrorMessage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the data validation error message. Read/write String.

Syntax

expression .ErrorMessage

expression A variable that represents a Validation object.

Example

This example adds data validation to cell E5 and specifies both the input and error messages.

VBA Copy code Copy code
With Range("e5").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:= xlValidAlertStop, _
 Operator:=xlBetween, Formula1:="5", Formula2:="10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.ErrorTitle Property (Excel)

 Copy code hover
[image]

Validation.ErrorTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the data-validation error dialog box. Read/write String.

Syntax

expression .ErrorTitle

expression A variable that represents a Validation object.

Example

This example adds data validation to cell E5.

VBA Copy code Copy code
With Range("e5").Validation
 .Add xlValidateWholeNumber, _
 xlValidAlertInformation, xlBetween, "5", "10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Formula1 Property (Excel)

 Copy code hover
[image]

Validation.Formula1 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.

Syntax

expression .Formula1

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Formula2 Property (Excel)

 Copy code hover
[image]

Validation.Formula2 Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween. Can be a constant value, a string value, a cell reference, or a formula. Read-only String.

Syntax

expression .Formula2

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.IgnoreBlank Property (Excel)

 Copy code hover
[image]

Validation.IgnoreBlank Property (Excel)
See also Send feedback

Published: July 16, 2012

True if blank values are permitted by the range data validation. Read/write Boolean.

Syntax

expression .IgnoreBlank

expression A variable that represents a Validation object.

Remarks

If the IgnoreBlank property is True, cell data is considered valid if the cell is blank, or if a cell referenced by either the MinVal or MaxVal property is blank.

Example

This example causes data validation for cell E5 to allow blank values.

VBA Copy code Copy code
Range("e5").Validation.IgnoreBlank = True

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.IMEMode Property (Excel)

 Copy code hover
[image]

Validation.IMEMode Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the description of the Japanese input rules. Can be one of the XlIMEMode constants listed in the following table. Read/write Long.

Syntax

expression .IMEMode

expression A variable that represents a Validation object.

Remarks

Constant | Description
xlIMEModeAlpha | Half-width alphanumeric
xlIMEModeAlphaFull | Full-width alphanumeric
xlIMEModeDisable | Disable
xlIMEModeHiragana | Hiragana
xlIMEModeKatakana | Katakana
xlIMEModeKatakanaHalf | Katakana (half-width)
xlIMEModeNoControl | No control
xlIMEModeOff | Off (English mode)
xlIMEModeOn | On

Note that this property can be set only when Japanese language support has been installed and selected.

Example

This example sets the data input rule for cell E5.

VBA Copy code Copy code
With Range("E5").Validation
    .Add Type:=xlValidateWholeNumber, _
        AlertStyle:= xlValidAlertStop, _
        Operator:=xlBetween, Formula1:="5", Formula2:="10"
    .InputTitle = "整数値"
    .ErrorTitle = "整数値"
    .InputMessage = "5から10の整数を入カしてください。"
    .ErrorMessage = "入カできるのは5から10までの値です。"
    .IMEMode = xlIMEModeAlpha
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.InCellDropdown Property (Excel)

 Copy code hover
[image]

Validation.InCellDropdown Property (Excel)
See also Send feedback

Published: July 16, 2012

True if data validation displays a drop-down list that contains acceptable values. Read/write Boolean.

Syntax

expression .InCellDropdown

expression A variable that represents a Validation object.

Remarks

This property is ignored if the validation type isn't xlValidateList.

Use the Formula1 argument of the Add or Modify method of the Validation object to specify the range that contains valid data.

Example

This example adds data validation to cell E5. The range A1:A10 contains the acceptable values for the cell and the cell displays a drop-down list that contains those values.

VBA Copy code Copy code
With Range("e5").Validation
 .Add xlValidateList, xlValidAlertStop, xlBetween, "=$A$1:$A$10"
 .InCellDropdown = True
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.InputMessage Property (Excel)

 Copy code hover
[image]

Validation.InputMessage Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the data validation input message. Read/write String.

Syntax

expression .InputMessage

expression A variable that represents a Validation object.

Example

This example adds data validation to cell E5 and specifies both the input and error messages.

VBA Copy code Copy code
With Range("e5").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:= xlValidAlertStop, _
 Operator:=xlBetween, Formula1:="5", Formula2:="10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.InputTitle Property (Excel)

 Copy code hover
[image]

Validation.InputTitle Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the title of the data-validation input dialog box. Read/write String.

Syntax

expression .InputTitle

expression A variable that represents a Validation object.

Example

This example turns on data validation for cell E5.

VBA Copy code Copy code
With Range("e5").Validation
 .Add xlValidateWholeNumber, _
 xlValidAlertInformation, xlBetween, "5", "10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Operator Property (Excel)

 Copy code hover
[image]

Validation.Operator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the operator for the data validation.

Syntax

expression .Operator

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Parent Property (Excel)

 Copy code hover
[image]

Validation.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.ShowError Property (Excel)

 Copy code hover
[image]

Validation.ShowError Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data validation error message will be displayed whenever the user enters invalid data. Read/write Boolean.

Syntax

expression .ShowError

expression A variable that represents a Validation object.

Example

This example adds data validation to cell A10 on worksheet one. The input value must be from 5 through 10; if the user types invalid data, an error message is displayed but no input message is displayed.

VBA Copy code Copy code
With Worksheets(1).Range("A10").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:=xlValidAlertStop, _
 Operator:=xlBetween, Formula1:="5", _
 Formula2:="10"
 .ErrorMessage = "value must be between 5 and 10"
 .ShowInput = False
 .ShowError = True
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.ShowInput Property (Excel)

 Copy code hover
[image]

Validation.ShowInput Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data validation input message will be displayed whenever the user selects a cell in the data validation range. Read/write Boolean.

Syntax

expression .ShowInput

expression A variable that represents a Validation object.

Example

This example adds data validation to cell A10. The input value must be from 5 through 10; if the user types invalid data, an error message is displayed but no input message is displayed.

VBA Copy code Copy code
With Worksheets(1).Range("A10").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:=xlValidAlertStop, _
 Operator:=xlBetween, Formula1:="5", _
 Formula2:="10"
 .ErrorMessage = "value must be between 5 and 10"
 .ShowInput = False
 .ShowError = True
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Type Property (Excel)

 Copy code hover
[image]

Validation.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value, containing a XlDVType constant, that represents the data type validation for a range.

Syntax

expression .Type

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Value Property (Excel)

 Copy code hover
[image]

Validation.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).

Syntax

expression .Value

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation Methods (Excel)

 Copy code hover
[image]

Validation Methods (Excel)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds data validation to the specified range.
Delete | Deletes the object.
Modify | Modifies data validation for a range.


Validation.Add Method (Excel)

 Copy code hover
[image]

Validation.Add Method (Excel)
See also Send feedback

Adds data validation to the specified range.

Syntax

expression .Add(Type, AlertStyle, Operator, Formula1, Formula2)

expression A variable that represents a Validation object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlDVType | The validation type.
AlertStyle | Optional | Variant | The validation alert style. Can be one of the following XlDVAlertStyle constants: xlValidAlertInformation, xlValidAlertStop, or xlValidAlertWarning.
Operator | Optional | Variant | The data validation operator. Can be one of the following XlFormatConditionOperator constants: xlBetween, xlEqual, xlGreater, xlGreaterEqual, xlLess, xlLessEqual, xlNotBetween, or xlNotEqual.
Formula1 | Optional | Variant | The first part of the data validation equation.
Formula2 | Optional | Variant | The second part of the data validation when Operator is xlBetween or xlNotBetween (otherwise, this argument is ignored).

Remarks

The Add method requires different arguments, depending on the validation type, as shown in the following table.

Validation type | Arguments
xlValidateCustom | Formula1 is required, Formula2 is ignored. Formula1 must contain an expression that evaluates to True when data entry is valid and False when data entry is invalid.
xlInputOnly | AlertStyle, Formula1, or Formula2 are used.
xlValidateList | Formula1 is required, Formula2 is ignored. Formula1 must contain either a comma-delimited list of values or a worksheet reference to this list.
xlValidateWholeNumber, xlValidateDate, xlValidateDecimal, xlValidateTextLength, or xlValidateTime | One of either Formula1 or Formula2 must be specified, or both may be specified.

Example

This example adds data validation to cell E5.

VBA Copy code Copy code
With Range("e5").Validation
 .Add Type:=xlValidateWholeNumber, _
 AlertStyle:= xlValidAlertStop, _
 Operator:=xlBetween, Formula1:="5", Formula2:="10"
 .InputTitle = "Integers"
 .ErrorTitle = "Integers"
 .InputMessage = "Enter an integer from five to ten"
 .ErrorMessage = "You must enter a number from five to ten"
End With

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Delete Method (Excel)

 Copy code hover
[image]

Validation.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Validation object.

See also

Concepts

Validation Object

Other resources

Validation Object Members


Validation.Modify Method (Excel)

 Copy code hover
[image]

Validation.Modify Method (Excel)
See also Send feedback

Published: July 16, 2012

Modifies data validation for a range.

Syntax

expression .Modify(Type, AlertStyle, Operator, Formula1, Formula2)

expression A variable that represents a Validation object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | Variant | An XlDVType value that represents the validation type.
AlertStyle | Optional | Variant | An XlDVAlertStyle value that represents the validation alert style.
Operator | Optional | Variant | An XlFormatConditionOperator value that represents the data validation operator.
Formula1 | Optional | Variant | The first part of the data validation equation.
Formula2 | Optional | Variant | The second part of the data validation when Operator is xlBetween or xlNotBetween; otherwise, this argument is ignored.

Remarks

The Modify method requires different arguments, depending on the validation type, as shown in the following table.

Validation type | Arguments
xlInputOnly | AlertStyle, Formula1, and Formula2 are not used.
xlValidateCustom | Formula1 is required; Formula2 is ignored. Formula1 must contain an expression that evaluates to True when data entry is valid and False when data entry is invalid.
xlValidateList | Formula1 is required; Formula2 is ignored. Formula1 must contain either a comma-delimited list of values or a worksheet reference to the list.
xlValidateDate, xlValidateDecimal, xlValidateTextLength, xlValidateTime, or xlValidateWholeNumber | Formula1 or Formula2, or both, must be specified.

Example

This example changes data validation for cell E5.

VBA Copy code Copy code
Range("e5").Validation _
 .Modify xlValidateList, xlValidAlertStop, _
 xlBetween, "=$A$1:$A$10"

See also

Concepts

Validation Object

Other resources

Validation Object Members


ValueChange Object (Excel)

 Copy code hover
[image]

ValueChange Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a value that has been changed in a PivotTable report that is based on an OLAP data source.

Version Information

Version Added: Excel 2010

Remarks

The PivotTableChangeList collection contains ValueChange objects that represent changes a user has made to value cells in a PivotTable report.

The properties of the ValueChange object specify details about the change that was made, such as the value of the change, the tuple associated with the cell that was changed, the order in which the change was made relative to other changes, and whether the cell is visible in the PivotTable. The ValueChange object also provides the PivotCell property that returns a PivotCell object that represents the cell that was changed, and provides additional information about the changed cell.

See also

Concepts

Excel Object Model Reference

Other resources

ValueChange Object Members


ValueChange Members (Excel)

 Copy code hover
[image]

ValueChange Members (Excel)
Send feedback

Published: July 16, 2012

Represents a value that has been changed in a PivotTable report that is based on an OLAP data source.

Methods

Name | Description
Delete | Deletes the specified ValueChange object from the PivotTableChangeList collection.

Properties

Name | Description
AllocationMethod | Returns what method to use to allocate this value when performing what-if analysis. Read-only
AllocationValue | Returns what value to allocate when performing what-if analysis. Read-only
AllocationWeightExpression | Returns the MDX weight expression to use for this value when performing what-if analysis. Read-only
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Order | Returns a value that indicates the order in which this change was performed relative to other changes in the PivotTableChangeList collection. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PivotCell | Returns a PivotCell object that represents the cell (tuple) that was changed. Read-only
Tuple | Returns the MDX tuple of the value was changed in the OLAP data source. Read-only
Value | Returns the value that the user entered in the cell or that the formula in the cell was evaluated to when UPDATE CUBE statement was last run against the OLAP data source. Read-only
VisibleInPivotTable | Returns whether the cell (tuple) is currently visible in the PivotTable report. Read-only


ValueChange Properties (Excel)

 Copy code hover
[image]

ValueChange Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllocationMethod | Returns what method to use to allocate this value when performing what-if analysis. Read-only
AllocationValue | Returns what value to allocate when performing what-if analysis. Read-only
AllocationWeightExpression | Returns the MDX weight expression to use for this value when performing what-if analysis. Read-only
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Order | Returns a value that indicates the order in which this change was performed relative to other changes in the PivotTableChangeList collection. Read-only
Parent | Returns the parent object for the specified object. Read-only.
PivotCell | Returns a PivotCell object that represents the cell (tuple) that was changed. Read-only
Tuple | Returns the MDX tuple of the value was changed in the OLAP data source. Read-only
Value | Returns the value that the user entered in the cell or that the formula in the cell was evaluated to when UPDATE CUBE statement was last run against the OLAP data source. Read-only
VisibleInPivotTable | Returns whether the cell (tuple) is currently visible in the PivotTable report. Read-only


ValueChange.AllocationMethod Property (Excel)

 Copy code hover
[image]

ValueChange.AllocationMethod Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns what method to use to allocate this value when performing what-if analysis. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationMethod

expression A variable that represents a ValueChange object.

Return Value

XlAllocationMethod

Remarks

The AllocationMethod property corresponds to the Allocation Method setting in the What-If Analysis Settings dialog box for a PivotTable report based on an OLAP data source as it was set at the time that this change was originally applied. If the specified ValueChange object was created by using the Add method of the PivotTableChangeList collection and the corresponding AllocationMethod parameter was not supplied, the default allocation method of the OLAP server is returned.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.AllocationValue Property (Excel)

 Copy code hover
[image]

ValueChange.AllocationValue Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns what value to allocate when performing what-if analysis. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationValue

expression A variable that represents a ValueChange object.

Return Value

XlAllocationValue

Remarks

The AllocationValue property corresponds to the Value to Allocate setting in the What-If Analysis Settings dialog box for a PivotTable report based on an OLAP data source as it was set at the time that this change was originally applied. If the specified ValueChange object was created by using the Add method of the PivotTableChangeList collection and the corresponding AllocationValue parameter was not supplied, the default allocation value of the OLAP server is returned.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.AllocationWeightExpression Property (Excel)

 Copy code hover
[image]

ValueChange.AllocationWeightExpression Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the MDX weight expression to use for this value when performing what-if analysis. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .AllocationWeightExpression

expression A variable that represents a ValueChange object.

Return Value

String

Remarks

The AllocationWeightExpression property corresponds to the Weight Expression setting in the What-If Analysis Settings dialog box for a PivotTable report based on an OLAP data source as it was set at the time that this change was originally applied. If the specified ValueChange object was created by using the Add method of the PivotTableChangeList collection and the corresponding AllocationWeightExpression parameter was not supplied, the default weight expression of the OLAP server is returned.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.Application Property (Excel)

 Copy code hover
[image]

ValueChange.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Application

expression A variable that represents a ValueChange object.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.Creator Property (Excel)

 Copy code hover
[image]

ValueChange.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ValueChange object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.Order Property (Excel)

 Copy code hover
[image]

ValueChange.Order Property (Excel)
See also Send feedback

Returns a value that indicates the order in which this change was performed relative to other changes in the PivotTableChangeList collection. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Order

expression A variable that represents a ValueChange object.

Return Value

Integer

Remarks

The value of the Order property is automatically assigned by Excel based on the order that the user applied the changes to value cells in the PivotTable report. If multiple changes were applied in one operation, Excel will arbitrarily assign the order within that set of changes.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.Parent Property (Excel)

 Copy code hover
[image]

ValueChange.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .Parent

expression A variable that represents a ValueChange object.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.PivotCell Property (Excel)

 Copy code hover
[image]

ValueChange.PivotCell Property (Excel)
Send feedback

Published: July 16, 2012

Returns a PivotCell object that represents the cell (tuple) that was changed. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PivotCell

expression A variable that represents a ValueChange object.

Return Value

PivotCell

Remarks

When the value of the VisibleInPivotTable property of the specified ValueChange object is True, the PivotCell property returns a PivotCell object for the cell (tuple) that was changed. When the value of the VisibleInPivotTable property of the specified ValueChange object is False, the PivotCell property returns NULL.


ValueChange.Tuple Property (Excel)

 Copy code hover
[image]

ValueChange.Tuple Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the MDX tuple of the value was changed in the OLAP data source. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Tuple

expression A variable that represents a ValueChange object.

Return Value

String

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.Value Property (Excel)

 Copy code hover
[image]

ValueChange.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value that the user entered in the cell or that the formula in the cell was evaluated to when UPDATE CUBE statement was last run against the OLAP data source. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .Value

expression A variable that represents a ValueChange object.

Return Value

Double

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange.VisibleInPivotTable Property (Excel)

 Copy code hover
[image]

ValueChange.VisibleInPivotTable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns whether the cell (tuple) is currently visible in the PivotTable report. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .VisibleInPivotTable

expression A variable that represents a ValueChange object.

Return Value

Boolean

Remarks

Return True if the cell (tuple) is currently visible in the PivotTable report; otherwise False.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


ValueChange Methods (Excel)

 Copy code hover
[image]

ValueChange Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified ValueChange object from the PivotTableChangeList collection.


ValueChange.Delete Method (Excel)

 Copy code hover
[image]

ValueChange.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the specified ValueChange object from the PivotTableChangeList collection.

Version Information

Version Added: Excel 2010

Syntax

expression .Delete

expression A variable that represents a ValueChange object.

Remarks

You can also delete a ValueChange object by using the Delete method of the PivotTableChangeList collection.

See also

Concepts

ValueChange Object

Other resources

ValueChange Object Members


VPageBreak Object (Excel)

 Copy code hover
[image]

VPageBreak Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a vertical page break.

Remarks

The VPageBreak object is a member of the VPageBreaks collection.

Example

Use VPageBreaks(index), where index is the page break index number of the page break, to return a VPageBreak object. The following example changes the location of vertical page break one.

VBA Copy code Copy code
Worksheets(1).VPageBreaks(1).Location = Worksheets(1).Range("e5")

See also

Concepts

Excel Object Model Reference

Other resources

VPageBreak Object Members


VPageBreak Members (Excel)

 Copy code hover
[image]

VPageBreak Members (Excel)
Send feedback

Published: July 16, 2012

Represents a vertical page break.

Methods

Name | Description
Delete | Deletes the object.
DragOff | Drags a page break out of the print area.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Extent | Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.
Location | Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a XlPageBreak value that represents the page break type.


VPageBreak Properties (Excel)

 Copy code hover
[image]

VPageBreak Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Extent | Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.
Location | Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.
Parent | Returns the parent object for the specified object. Read-only.
Type | Returns or sets a XlPageBreak value that represents the page break type.


VPageBreak.Application Property (Excel)

 Copy code hover
[image]

VPageBreak.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a VPageBreak object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.Creator Property (Excel)

 Copy code hover
[image]

VPageBreak.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a VPageBreak object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.Extent Property (Excel)

 Copy code hover
[image]

VPageBreak.Extent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the type of the specified page break: full-screen or only within a print area. Can be either of the following XlPageBreakExtent constants: xlPageBreakFull or xlPageBreakPartial. Read-only Long.

Syntax

expression .Extent

expression A variable that represents a VPageBreak object.

Example

This example displays the total number of full-screen and print-area horizontal page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).HPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.Location Property (Excel)

 Copy code hover
[image]

VPageBreak.Location Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read/write Range.

Syntax

expression .Location

expression A variable that represents a VPageBreak object.

Example

This example moves the vertical page-break location.

VBA Copy code Copy code
Worksheets(1).VPageBreaks(1).Location = Worksheets(1).Range("e5")

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.Parent Property (Excel)

 Copy code hover
[image]

VPageBreak.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a VPageBreak object.

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.Type Property (Excel)

 Copy code hover
[image]

VPageBreak.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlPageBreak value that represents the page break type.

Syntax

expression .Type

expression A variable that represents a VPageBreak object.

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak Methods (Excel)

 Copy code hover
[image]

VPageBreak Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
DragOff | Drags a page break out of the print area.


VPageBreak.Delete Method (Excel)

 Copy code hover
[image]

VPageBreak.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a VPageBreak object.

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreak.DragOff Method (Excel)

 Copy code hover
[image]

VPageBreak.DragOff Method (Excel)
See also Send feedback

Published: July 16, 2012

Drags a page break out of the print area.

Syntax

expression .DragOff(Direction, RegionIndex)

expression A variable that represents a VPageBreak object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | XlDirection | The direction in which the page break is dragged.
RegionIndex | Required | Long | The print-area region index for the page break (the region where the mouse pointer is located when the mouse button is pressed if the user drags the page break). If the print area is contiguous, there's only one print region. If the print area is discontiguous, there's more than one print region.

Remarks

This method exists primarily for the macro recorder. You can use the Delete method to delete a page break in Visual Basic.

Example

This example deletes vertical page break one from the active sheet by dragging it off the right edge of print region one.

VBA Copy code Copy code
ActiveSheet.VPageBreaks(1).DragOff xlToRight, 1

See also

Concepts

VPageBreak Object

Other resources

VPageBreak Object Members


VPageBreaks Object (Excel)

 Copy code hover
[image]

VPageBreaks Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of vertical page breaks within the print area.

Remarks

Each vertical page break is represented by a VPageBreak object.

When the Application property, Count property, Creator property, Item property, Parent property or Add method is used in conjunction with the VPageBreaks property:

  • For an automatic print area, the VPageBreaks property applies only to the page breaks within the print area.

  • For a user-defined print area of the same range, the VPageBreaks property applies to all of the page breaks.

Example

Use the VPageBreaks property to return the VPageBreaks collection. Use the Add method to add a vertical page break.

If you add a page break that does not intersect the print area, then the newly-added VPageBreak object will not appear in the VPageBreaks collection for the print area. The contents of the collection may change if the print area is resized or redefined.

The following example adds a vertical page break to the left of the active cell.

VBA Copy code Copy code
ActiveSheet.VPageBreaks.Add Before:=ActiveCell

See also

Concepts

Excel Object Model Reference

Other resources

VPageBreaks Object Members


VPageBreaks Members (Excel)

 Copy code hover
[image]

VPageBreaks Members (Excel)
Send feedback

Published: July 16, 2012

A collection of vertical page breaks within the print area.

Methods

Name | Description
Add | Adds a vertical page break.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


VPageBreaks Properties (Excel)

 Copy code hover
[image]

VPageBreaks Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


VPageBreaks.Application Property (Excel)

 Copy code hover
[image]

VPageBreaks.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a VPageBreaks object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


VPageBreaks.Count Property (Excel)

 Copy code hover
[image]

VPageBreaks.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a VPageBreaks object.

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


VPageBreaks.Creator Property (Excel)

 Copy code hover
[image]

VPageBreaks.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a VPageBreaks object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


VPageBreaks.Item Property (Excel)

 Copy code hover
[image]

VPageBreaks.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a VPageBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object.

Example

This example changes the location of vertical page break one.

VBA Copy code Copy code
Worksheets(1).VPageBreaks.Item(1).Location = .Range("e5")

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


VPageBreaks.Parent Property (Excel)

 Copy code hover
[image]

VPageBreaks.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a VPageBreaks object.

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


VPageBreaks Methods (Excel)

 Copy code hover
[image]

VPageBreaks Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a vertical page break.


VPageBreaks.Add Method (Excel)

 Copy code hover
[image]

VPageBreaks.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a vertical page break.

Syntax

expression .Add(Before)

expression A variable that represents a VPageBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Required | Object | A Range object. The range to the left of which the new page break will be added.

Return Value

A VPageBreak object that represents the new vertical page break.

Example

This example adds a horizontal page break above cell F25 and adds a vertical page break to the left of this cell.

VBA Copy code Copy code
With Worksheets(1)
 .HPageBreaks.Add .Range("F25")
 .VPageBreaks.Add.Range("F25")
End With

See also

Concepts

VPageBreaks Object

Other resources

VPageBreaks Object Members


Walls Object (Excel)

 Copy code hover
[image]

Walls Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the walls of a 3-D chart. This object isn't a collection. There's no object that represents a single wall; you must return all the walls as a unit.

Example

Use the Walls property to return the Walls object. The following example sets the pattern on the walls for embedded chart one on Sheet1. If the chart isn't a 3-D chart, this example will fail.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart _
 .Walls.Interior.Pattern = xlGray75

See also

Concepts

Excel Object Model Reference

Other resources

Walls Object Members


Walls Members (Excel)

 Copy code hover
[image]

Walls Members (Excel)
Send feedback

Published: July 16, 2012

Represents the walls of a 3-D chart. This object isn't a collection. There's no object that represents a single wall; you must return all the walls as a unit.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the walls of the specified chart.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.
PictureUnit | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Long.
Thickness | Returns or sets a Long specifying the thickness of the wall. Read/write.


Walls Properties (Excel)

 Copy code hover
[image]

Walls Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Format | Returns the ChartFormat object. Read-only.
Name | Returns a String value that represents the name of the object.
Parent | Returns the parent object for the specified object. Read-only.
PictureType | Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.
PictureUnit | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Long.
Thickness | Returns or sets a Long specifying the thickness of the wall. Read/write.


Walls.Application Property (Excel)

 Copy code hover
[image]

Walls.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Walls object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Creator Property (Excel)

 Copy code hover
[image]

Walls.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Walls object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Format Property (Excel)

 Copy code hover
[image]

Walls.Format Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ChartFormat object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Format

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Name Property (Excel)

 Copy code hover
[image]

Walls.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Parent Property (Excel)

 Copy code hover
[image]

Walls.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.PictureType Property (Excel)

 Copy code hover
[image]

Walls.PictureType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the way pictures are displayed on the walls and faces of a 3-D chart.

Syntax

expression .PictureType

expression A variable that represents a Walls object.

Remarks

This property can be set to one of the following constants: xlStack or xlStretch.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.PictureUnit Property (Excel)

 Copy code hover
[image]

Walls.PictureUnit Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Long.

Syntax

expression .PictureUnit

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Thickness Property (Excel)

 Copy code hover
[image]

Walls.Thickness Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long specifying the thickness of the wall. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .Thickness

expression A variable that represents a Walls object.

Remarks

Use this property to set the thickness of the wall. The default thickness is 0.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls Methods (Excel)

 Copy code hover
[image]

Walls Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the walls of the specified chart.
Select | Selects the object.


Walls.ClearFormats Method (Excel)

 Copy code hover
[image]

Walls.ClearFormats Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Syntax

expression .ClearFormats

expression A variable that represents a Walls object.

Return Value

Variant

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Paste Method (Excel)

 Copy code hover
[image]

Walls.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard on the walls of the specified chart.

Syntax

expression .Paste

expression A variable that represents a Walls object.

Remarks

This method can be used on column, bar, line, or radar charts.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Select Method (Excel)

 Copy code hover
[image]

Walls.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select

expression A variable that represents a Walls object.

Return Value

Variant

See also

Concepts

Walls Object

Other resources

Walls Object Members


Watch Object (Excel)

 Copy code hover
[image]

Watch Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a range which is tracked when the worksheet is recalculated. The Watch object allows users to verify the accuracy of their models and debug problems they encounter.

Remarks

The Watch object is a member of the Watches collection.

Example

Use the Add method or the Item property of the Watches collection to return a Watch object.

In the following example, Microsoft Excel creates a new Watch object using the Add method. This example creates a summation formula in cell A3, and then adds this cell to the watch facility.

VBA Copy code Copy code
Sub AddWatch()

 With Application
 .Range("A1").Formula = 1
 .Range("A2").Formula = 2
 .Range("A3").Formula = "=Sum(A1:A2)"
 .Range("A3").Select
 .Watches.Add Source:=ActiveCell
 End With

End Sub

You can specify to remove individual cells from the watch facility by using the Delete method of the Watches collection. This example deletes cell A3 on worksheet 1 of book 1 from the Watch Window. This example assumes you have added the cell A3 on sheet 1 of book 1 (using the previous example to add a Watch object).

VBA Copy code Copy code
Sub DeleteAWatch()

 Application.Watches(Workbooks("Book1").Sheets("Sheet1").Range("A3")).Delete

End Sub

You can also specify to remove all cells from the Watch Window, by using the Delete method of the Watches collection. This example deletes all cells from the Watch Window.

VBA Copy code Copy code
Sub DeleteAllWatches()

 Application.Watches.Delete

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Watch Object Members


Watch Members (Excel)

 Copy code hover
[image]

Watch Members (Excel)
Send feedback

Published: July 16, 2012

Represents a range which is tracked when the worksheet is recalculated. The Watch object allows users to verify the accuracy of their models and debug problems they encounter.

Methods

Name | Description
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Source | Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.


Watch Properties (Excel)

 Copy code hover
[image]

Watch Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Source | Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.


Watch.Application Property (Excel)

 Copy code hover
[image]

Watch.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Watch object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Watch Object

Other resources

Watch Object Members


Watch.Creator Property (Excel)

 Copy code hover
[image]

Watch.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Watch object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Watch Object

Other resources

Watch Object Members


Watch.Parent Property (Excel)

 Copy code hover
[image]

Watch.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Watch object.

See also

Concepts

Watch Object

Other resources

Watch Object Members


Watch.Source Property (Excel)

 Copy code hover
[image]

Watch.Source Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.

Syntax

expression .Source

expression A variable that represents a Watch object.

Remarks

If the SourceType property is set to xlSourceRange, this property returns a range, which can be a defined name. If the SourceType property is set to xlSourceChart, xlSourcePivotTable, or xlSourceQuery, this property returns the name of the object, such as a chart name, a PivotTable report name, or a query table name.

See also

Concepts

Watch Object

Other resources

Watch Object Members


Watch Methods (Excel)

 Copy code hover
[image]

Watch Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.


Watch.Delete Method (Excel)

 Copy code hover
[image]

Watch.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Watch object.

See also

Concepts

Watch Object

Other resources

Watch Object Members


Watches Object (Excel)

 Copy code hover
[image]

Watches Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Watch objects in a specified application.

Example

Use the Watches property of the Application object to return a Watches collection.

In the following example, Microsoft Excel creates a new Watch object using the Add method. This example creates a summation formula in cell A3, and then adds this cell to the watch facility.

VBA Copy code Copy code
Sub AddWatch()

 With Application
 .Range("A1").Formula = 1
 .Range("A2").Formula = 2
 .Range("A3").Formula = "=Sum(A1:A2)"
 .Range("A3").Select
 .Watches.Add Source:=ActiveCell
 End With

End Sub

You can specify to remove individual cells from the watch facility by using the Delete method of the Watches collection. This example deletes cell A3 on worksheet 1 of book 1 from the Watch Window. This example assumes you have added the cell A3 on sheet 1 of book 1 (using the previous example to add a Watch object).

VBA Copy code Copy code
Sub DeleteAWatch()

 Application.Watches(Workbooks("Book1").Sheets("Sheet1").Range("A3")).Delete

End Sub

You can also specify to remove all cells from the Watch Window, by using the Delete method of the Watches collection. This example deletes all cells from the Watch Window.

VBA Copy code Copy code
Sub DeleteAllWatches()

 Application.Watches.Delete

End Sub

See also

Concepts

Excel Object Model Reference

Other resources

Watches Object Members


Watches Members (Excel)

 Copy code hover
[image]

Watches Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Watch objects in a specified application.

Methods

Name | Description
Add | Adds a range which is tracked when the worksheet is recalculated.
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Watches Properties (Excel)

 Copy code hover
[image]

Watches Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Watches.Application Property (Excel)

 Copy code hover
[image]

Watches.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Watches object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches.Count Property (Excel)

 Copy code hover
[image]

Watches.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Watches object.

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches.Creator Property (Excel)

 Copy code hover
[image]

Watches.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Watches object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches.Item Property (Excel)

 Copy code hover
[image]

Watches.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Watches object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches.Parent Property (Excel)

 Copy code hover
[image]

Watches.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Watches object.

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches Methods (Excel)

 Copy code hover
[image]

Watches Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a range which is tracked when the worksheet is recalculated.
Delete | Deletes the object.


Watches.Add Method (Excel)

 Copy code hover
[image]

Watches.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a range which is tracked when the worksheet is recalculated.

Syntax

expression .Add(Source)

expression A variable that represents a Watches object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The source for the range.

Return Value

A Watch object that represents the new range.

Example

This example creates a summation formula in cell A3 and then adds this cell to the watch facility.

VBA Copy code Copy code
Sub AddWatch()

 With Application
 .Range("A1").Formula = 1
 .Range("A2").Formula = 2
 .Range("A3").Formula = "=Sum(A1:A2)"
 .Range("A3").Select
 .Watches.Add Source:=ActiveCell
 End With

End Sub

See also

Concepts

Watches Object

Other resources

Watches Object Members


Watches.Delete Method (Excel)

 Copy code hover
[image]

Watches.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Watches object.

See also

Concepts

Watches Object

Other resources

Watches Object Members


WebOptions Object (Excel)

 Copy code hover
[image]

WebOptions Object (Excel)
See also Send feedback

Published: July 16, 2012

Contains workbook-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page.

Remarks

You can return or set attributes either at the application (global) level or at the workbook level. (Note that attribute values can be different from one workbook to another, depending on the attribute value at the time the workbook was saved.) Workbook-level attribute settings override application-level attribute settings. Application-level attributes are contained in the DefaultWebOptions object.

Example

Use the WebOptions property to return the WebOptions object. The following example checks to see whether PNG (Portable Network Graphics) is allowed as an image format and then sets the strImageFileType variable accordingly.

VBA Copy code Copy code
Set objAppWebOptions = Workbooks(1).WebOptions
With objAppWebOptions
 If .AllowPNG = True Then
 strImageFileType = "PNG"
 Else
 strImageFileType = "JPG"
 End If
End With

See also

Concepts

Excel Object Model Reference

Other resources

WebOptions Object Members


WebOptions Members (Excel)

 Copy code hover
[image]

WebOptions Members (Excel)
Send feedback

Published: July 16, 2012

Contains workbook-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page.

Methods

Name | Description
UseDefaultFolderSuffix | Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DownloadComponents | True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
LocationOfComponents | Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.
TargetBrowser | Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


WebOptions Properties (Excel)

 Copy code hover
[image]

WebOptions Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DownloadComponents | True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
LocationOfComponents | Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.
TargetBrowser | Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


WebOptions.AllowPNG Property (Excel)

 Copy code hover
[image]

WebOptions.AllowPNG Property (Excel)
See also Send feedback

True if PNG (Portable Network Graphics) is allowed as an image format when you save documents as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.

Syntax

expression .AllowPNG

expression A variable that represents a WebOptions object.

Remarks

If you save images in the PNG format as opposed to any other file format, you might improve the image quality or reduce the size of those image files, and therefore decrease the download time, assuming that the Web browsers you are targeting support the PNG format.

Example

This example enables PNG as an output format for the first workbook.

VBA Copy code Copy code
Application.Workbooks(1).WebOptions.AllowPNG = True

Alternatively, PNG can be enabled as the global default for the application for newly created documents.

VBA Copy code Copy code
Application.DefaultWebOptions.AllowPNG = True

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Application Property (Excel)

 Copy code hover
[image]

WebOptions.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a WebOptions object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Creator Property (Excel)

 Copy code hover
[image]

WebOptions.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a WebOptions object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.DownloadComponents Property (Excel)

 Copy code hover
[image]

WebOptions.DownloadComponents Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the necessary Microsoft Office Web components are downloaded when you view the saved document in a Web browser, but only if the components are not already installed. False if the components are not downloaded. The default value is False. Read/write Boolean.

Syntax

expression .DownloadComponents

expression A variable that represents a WebOptions object.

Remarks

You can set the LocationOfComponents property to a central URL (on the intranet or Web) or path (local or network) to a location from which authorized users can download components when viewing your saved document. The path must be valid and must point to a location that contains the necessary components, and the user must have a valid Microsoft Office license.

Office Web components add interactivity to documents that you save as Web pages. If you view a Web page in a browser on a computer that does not have the components installed, the interactive portions of the page will be static.

Example

This example allows the Office Web components to be downloaded with the specified Web page, if they are not already installed.

VBA Copy code Copy code
Application.DefaultWebOptions.DownloadComponents = True
Application.DefaultWebOptions.LocationOfComponents = _
 Application.Path & Application.PathSeparator & "foo"

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Encoding Property (Excel)

 Copy code hover
[image]

WebOptions.Encoding Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. The default is the system code page. Read/write MsoEncoding.

Syntax

expression .Encoding

expression A variable that represents a WebOptions object.

Remarks

You cannot use any of the constants that have the suffix AutoDetect. These constants are used by the ReloadAs method.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.FolderSuffix Property (Excel)

 Copy code hover
[image]

WebOptions.FolderSuffix Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the folder suffix that Microsoft Excel uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.

Syntax

expression .FolderSuffix

expression A variable that represents a WebOptions object.

Remarks

Newly created documents use the suffix returned by the FolderSuffix property of the DefaultWebOptions object. The value of the FolderSuffix property of the WebOptions object may differ from that of the DefaultWebOptions object if the document was previously edited in a different language version of Microsoft Excel. You can use the UseDefaultFolderSuffix method to change the suffix to the language you are currently using in Microsoft Office.

By default, the name of the supporting folder is the name of the Web page plus an underscore (_), a period (.), or a hyphen (-) and the word "files" (appearing in the language of the version of Excel in which the file was saved as a Web page). For example, suppose that you use the Dutch language version of Excel to save a file called "Page1" as a Web page. The default name of the supporting folder is Page1_bestanden.

The following table lists each language version of Office, and gives its corresponding LanguageID property value and folder suffix. For the languages that are not listed in the table, the suffix ".files" is used.

Language | LanguageID | Folder suffix
Arabic | 1025 | .files
Basque | 1069 | _fitxategiak
Portuguese (Brazil) | 1046 | _arquivos
Bulgarian | 1026 | .files
Catalan | 1027 | _fitxers
Chinese - Simplified | 2052 | .files
Chinese - Traditional | 1028 | .files
Croatian | 1050 | _datoteke
Czech | 1029 | _soubory
Danish | 1030 | -filer
Dutch | 1043 | _bestanden
English | 1033 | _files
Estonian | 1061 | _failid
Finnish | 1035 | _tiedostot
French | 1036 | _fichiers
German | 1031 | -Dateien
Greek | 1032 | .files
Hebrew | 1037 | .files
Hungarian | 1038 | _elemei
Italian | 1040 | -file
Japanese | 1041 | .files
Korean | 1042 | .files
Latvian | 1062 | _fails
Lithuanian | 1063 | _bylos
Norwegian | 1044 | -filer
Polish | 1045 | _pliki
Portuguese | 2070 | _ficheiros
Romanian | 1048 | .files
Russian | 1049 | .files
Serbian (Cyrillic) | 3098 | .files
Serbian (Latin) | 2074 | _fajlovi
Slovakian | 1051 | .files
Slovenian | 1060 | _datoteke
Spanish | 3082 | _archivos
Swedish | 1053 | -filer
Thai | 1054 | .files
Turkish | 1055 | _dosyalar
Ukranian | 1058 | .files
Vietnamese | 1066 | .files

Example

This example returns the folder suffix used by the first workbook. The suffix is returned in the string variable strFolderSuffix.

VBA Copy code Copy code
strFolderSuffix = Workbooks(1).WebOptions.FolderSuffix

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.LocationOfComponents Property (Excel)

 Copy code hover
[image]

WebOptions.LocationOfComponents Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the central URL (on the intranet or Web) or path (local or network) to the location from which authorized users can download Microsoft Office Web components when viewing your saved document. The default value is the local or network installation path for Microsoft Office. Read/write String.

Syntax

expression .LocationOfComponents

expression A variable that represents a WebOptions object.

Remarks

Office Web components are automatically downloaded with the specified Web page if the DownloadComponents property is is set to True, the components are not already installed, the path is valid and points to a location that contains the necessary components, and the user has a valid Microsoft Office license.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.OrganizeInFolder Property (Excel)

 Copy code hover
[image]

WebOptions.OrganizeInFolder Property (Excel)
See also Send feedback

Published: July 16, 2012

True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.

Syntax

expression .OrganizeInFolder

expression A variable that represents a WebOptions object.

Remarks

The new folder is created in the folder where you have saved the Web page, and is named after the document. If long file names are used, a suffix is added to the folder name. The FolderSuffix property returns the folder suffix for the language support you have selected or installed, or the default folder suffix.

If you save a document that was previously saved with the OrganizeInFolder property set to a different value, Microsoft Excel automatically moves the supporting files into or out of the folder, as appropriate.

If you don't use long file names (that is, if the UseLongFileNames property is set to False), Microsoft Excel automatically saves any supporting files in a separate folder. The files cannot be saved in the same folder as the Web page.

Example

This example specifies that all supporting files are saved in the same folder when the document is saved as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.OrganizeInFolder = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Parent Property (Excel)

 Copy code hover
[image]

WebOptions.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebOptions object.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.PixelsPerInch Property (Excel)

 Copy code hover
[image]

WebOptions.PixelsPerInch Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.

Syntax

expression .PixelsPerInch

expression A variable that represents a WebOptions object.

Remarks

This property determines the size of the images and cells on the specified Web page relative to the size of text whenever you view the saved document in a Web browser. The physical dimensions of the resulting image or cell are the result of the original dimensions (in inches) multiplied by the number of pixels per inch.

You use the ScreenSize property to set the optimum screen size for the targeted Web browsers.

Example

This example sets the pixel density depending on the target screen size of the browser. For 800x600 pixel screens, the density is 72 pixels per inch. For 1024x768 pixel screens, the density is 96 pixels per inch. For all other cases, use a density of 120 pixels per inch.

VBA Copy code Copy code
With ThisWorkbook.WebOptions
 Select Case .ScreenSize
 Case msoScreenSize800x600
 .PixelsPerInch = 72
 Case msoScreenSize1024x768
 .PixelsPerInch = 96
 Case Else
 .PixelsPerInch = 120
 End Select
End With

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.RelyOnCSS Property (Excel)

 Copy code hover
[image]

WebOptions.RelyOnCSS Property (Excel)
See also Send feedback

Published: July 16, 2012

True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Microsoft Excel creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True. Read/write Boolean.

Syntax

expression .RelyOnCSS

expression A variable that represents a WebOptions object.

Remarks

You should set this property to True if your Web browser supports cascading style sheets, as this will give you more precise layout and formatting control on your Web page and make it look more like your document (as it appears in Microsoft Excel).

Example

This example enables the use of cascading style sheets as the global default for the application.

VBA Copy code Copy code
ThisWorkbook.WebOptions.RelyOnCSS = True

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.RelyOnVML Property (Excel)

 Copy code hover
[image]

WebOptions.RelyOnVML Property (Excel)
See also Send feedback

Published: July 16, 2012

True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.

Syntax

expression .RelyOnVML

expression A variable that represents a WebOptions object.

Remarks

You can reduce file sizes by not generating images for drawing objects, if your Web browser supports Vector Markup Language (VML). For example, Microsoft Internet Explorer 5 supports this feature, and you should set the RelyOnVML property to True if you are targeting this browser. For browsers that do not support VML, the image will not appear when you view a Web page saved with this property enabled.

For example, you should not generate images if your Web page uses image files that you have generated earlier, and if the location where you save the document is different from the final location of the page on the Web server.

Example

This example specifies that images are generated when saving the worksheet to a Web page.

VBA Copy code Copy code
Workbooks(1).WebOptions.RelyOnVML = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.ScreenSize Property (Excel)

 Copy code hover
[image]

WebOptions.ScreenSize Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Can be one of the MsoScreenSize constants. The default constant is msoScreenSize800x600. Read/write MsoScreenSize.

Syntax

expression .ScreenSize

expression A variable that represents a WebOptions object.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.TargetBrowser Property (Excel)

 Copy code hover
[image]

WebOptions.TargetBrowser Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTargetBrowser constant indicating the browser version. Read/write.

Syntax

expression .TargetBrowser

expression A variable that represents a WebOptions object.

Remarks

MsoTargetBrowser can be one of these MsoTargetBrowser constants.

msoTargetBrowserIE4 . Microsoft Internet Explorer 4.0 or later.

msoTargetBrowserIE5 . Microsoft Internet Explorer 5.0 or later.

msoTargetBrowserIE6 . Microsoft Internet Explorer 6.0 or later.

msoTargetBrowserV3 . Microsoft Internet Explorer 3.0, Netscape Navigator 3.0, or later.

msoTargetBrowserV4 . Microsoft Internet Explorer 4.0, Netscape Navigator 4.0, or later.

Example

In this example, Microsoft Excel determines if the browser version for Web options is IE5 and notifies the user.

VBA Copy code Copy code
Sub CheckWebOptions()

    Dim wkbOne As Workbook

    Set wkbOne = Application.Workbooks(1)

    ' Determine if IE5 is the target browser.
    If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then
        MsgBox "The target browser is IE5 or later."
    Else
        MsgBox "The target browser is not IE5 or later."
    End If

End Sub

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.UseLongFileNames Property (Excel)

 Copy code hover
[image]

WebOptions.UseLongFileNames Property (Excel)
See also Send feedback

Published: July 16, 2012

True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.

Syntax

expression .UseLongFileNames

expression A variable that represents a WebOptions object.

Remarks

If you don't use long file names and your document has supporting files, Microsoft Excel automatically organizes those files in a separate folder. Otherwise, use the OrganizeInFolder property to determine whether supporting files are organized in a separate folder.

Example

This example disallows the use of long file names as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.UseLongFileNames = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions Methods (Excel)

 Copy code hover
[image]

WebOptions Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
UseDefaultFolderSuffix | Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.


WebOptions.UseDefaultFolderSuffix Method (Excel)

 Copy code hover
[image]

WebOptions.UseDefaultFolderSuffix Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.

Syntax

expression .UseDefaultFolderSuffix

expression A variable that represents a WebOptions object.

Remarks

Microsoft Excel uses the folder suffix when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True).

The suffix appears in the folder name after the document name. For example, if the document is called "Book1" and the language is English, the folder name is Book1_files. The available folder suffixes are listed in the FolderSuffix property topic.

Example

This example sets the folder suffix for the first workbook to the default suffix.

VBA Copy code Copy code
Workbooks(1).WebOptions.UseDefaultFolderSuffix

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


Window Object (Excel)

 Copy code hover
[image]

Window Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a window.

Remarks

Many worksheet characteristics, such as scroll bars and gridlines, are actually properties of the window. The Window object is a member of the Windows collection. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Workbook object contains only the windows in the specified workbook.

Example

Use Windows(index), where index is the window name or index number, to return a single Window object. The following example maximizes the active window.

VBA Copy code Copy code
Windows(1).WindowState = xlMaximized

Note that the active window is always Windows(1).

The window caption is the text shown in the title bar at the top of the window when the window isn't maximized. The caption is also shown in the list of open files on the bottom of the Windows menu. Use the Caption property to set or return the window caption. Changing the window caption doesn't change the name of the workbook. The following example turns off cell gridlines for the worksheet shown in the Book1.xls:1 window.

VBA Copy code Copy code
Windows("book1.xls":1).DisplayGridlines = False

See also

Concepts

Excel Object Model Reference

Other resources

Window Object Members


Window Members (Excel)

 Copy code hover
[image]

Window Members (Excel)
Send feedback

Published: July 16, 2012

Represents a window.

Methods

Name | Description
Activate | Brings the window to the front of the z-order.
ActivateNext | Activates the specified window and then sends it to the back of the window z-order.
ActivatePrevious | Activates the specified window and then activates the window at the back of the window z-order.
Close | Closes the object.
LargeScroll | Scrolls the contents of the window by pages.
NewWindow | Creates a new window or a copy of the specified window.
PointsToScreenPixelsX | Converts a horizontal measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PointsToScreenPixelsY | Converts a vertical measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
RangeFromPoint | Returns the Shape or Range object that is positioned at the specified pair of screen coordinates. If there isn't a shape located at the specified coordinates, this method returns Nothing.
ScrollIntoView | Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).
ScrollWorkbookTabs | Scrolls through the workbook tabs at the bottom of the window. Doesn't affect the active sheet in the workbook.
SmallScroll | Scrolls the contents of the window by rows or columns.

Properties

Name | Description
ActiveCell | Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActivePane | Returns a Pane object that represents the active pane in the window. Read-only.
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveSheetView | Returns an object that represents the view of the active sheet in the specified window. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilterDateGrouping | True if the auto filter for date grouping is currently displayed in the specified window. Read/write Boolean.
Caption | Returns or sets a Variant value that represents the name that appears in the title bar of the document window.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFormulas | True if the window is displaying formulas; False if the window is displaying values. Read/write Boolean.
DisplayGridlines | True if gridlines are displayed. Read/write Boolean.
DisplayHeadings | True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.
DisplayHorizontalScrollBar | True if the horizontal scroll bar is displayed. Read/write Boolean.
DisplayOutline | True if outline symbols are displayed. Read/write Boolean.
DisplayRightToLeft | True if the specified window is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
DisplayRuler | True if a ruler is displayed for the specified window. Read/write Boolean.
DisplayVerticalScrollBar | True if the vertical scroll bar is displayed. Read/write Boolean.
DisplayWhitespace | True if whitespace is displayed. Read/write Boolean.
DisplayWorkbookTabs | True if the workbook tabs are displayed. Read/write Boolean.
DisplayZeros | True if zero values are displayed. Read/write Boolean.
EnableResize | True if the window can be resized. Read/write Boolean.
FreezePanes | True if split panes are frozen. Read/write Boolean.
GridlineColor | Returns or sets the gridline color as an RGB value. Read/write Long.
GridlineColorIndex | Returns or sets the gridline color as an index into the current color palette or as the following XlColorIndex constant.
Height | Returns or sets a Double value that represents tThe height, in points, of the window.
Hwnd |
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the client area to the left edge of the window.
OnWindow | Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.
Panes | Returns a Panes collection that represents all the panes in the specified window. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
RangeSelection | Returns a Range object that represents the selected cells on the worksheet in the specified window even if a graphic object is active or selected on the worksheet. Read-only.
ScrollColumn | Returns or sets the number of the leftmost column in the pane or window. Read/write Long.
ScrollRow | Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.
SelectedSheets | Returns a Sheets collection that represents all the selected sheets in the specified window. Read-only.
Selection | Returns the specified window, for a Windows object.
SheetViews | Returns the SheetViews object for the specified window. Read-only.
Split | True if the window is split. Read/write Boolean.
SplitColumn | Returns or sets the column number where the window is split into panes (the number of columns to the left of the split line). Read/write Long.
SplitHorizontal | Returns or sets the location of the horizontal window split, in points. Read/write Double.
SplitRow | Returns or sets the row number where the window is split into panes (the number of rows above the split). Read/write Long.
SplitVertical | Returns or sets the location of the vertical window split, in points. Read/write Double.
TabRatio | Returns or sets the ratio of the width of the workbook's tab area to the width of the window's horizontal scroll bar (as a number between 0 (zero) and 1; the default value is 0.6). Read/write Double.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar).
Type | Returns or sets a XlWindowType value that represents the window type.
UsableHeight | Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.
UsableWidth | Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.
View | Returns or sets the view showing in the window. Read/write XlWindowView.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
VisibleRange | Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.
Width | Returns or sets a Double value that represents the width, in points, of the window.
WindowNumber | Returns the window number. For example, a window named "Book1.xls:2" has 2 as its window number. Most windows have the window number 1. Read-only Long.
WindowState | Returns or sets the state of the window. Read/write XlWindowState.
Zoom | Returns or sets a Variant value that represents the display size of the window, as a percentage (100 equals normal size, 200 equals double size, and so on).


Window Properties (Excel)

 Copy code hover
[image]

Window Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveCell | Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActivePane | Returns a Pane object that represents the active pane in the window. Read-only.
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveSheetView | Returns an object that represents the view of the active sheet in the specified window. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilterDateGrouping | True if the auto filter for date grouping is currently displayed in the specified window. Read/write Boolean.
Caption | Returns or sets a Variant value that represents the name that appears in the title bar of the document window.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFormulas | True if the window is displaying formulas; False if the window is displaying values. Read/write Boolean.
DisplayGridlines | True if gridlines are displayed. Read/write Boolean.
DisplayHeadings | True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.
DisplayHorizontalScrollBar | True if the horizontal scroll bar is displayed. Read/write Boolean.
DisplayOutline | True if outline symbols are displayed. Read/write Boolean.
DisplayRightToLeft | True if the specified window is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
DisplayRuler | True if a ruler is displayed for the specified window. Read/write Boolean.
DisplayVerticalScrollBar | True if the vertical scroll bar is displayed. Read/write Boolean.
DisplayWhitespace | True if whitespace is displayed. Read/write Boolean.
DisplayWorkbookTabs | True if the workbook tabs are displayed. Read/write Boolean.
DisplayZeros | True if zero values are displayed. Read/write Boolean.
EnableResize | True if the window can be resized. Read/write Boolean.
FreezePanes | True if split panes are frozen. Read/write Boolean.
GridlineColor | Returns or sets the gridline color as an RGB value. Read/write Long.
GridlineColorIndex | Returns or sets the gridline color as an index into the current color palette or as the following XlColorIndex constant.
Height | Returns or sets a Double value that represents tThe height, in points, of the window.
Hwnd |
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
Left | Returns or sets a Double value that represents the distance, in points, from the left edge of the client area to the left edge of the window.
OnWindow | Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.
Panes | Returns a Panes collection that represents all the panes in the specified window. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
RangeSelection | Returns a Range object that represents the selected cells on the worksheet in the specified window even if a graphic object is active or selected on the worksheet. Read-only.
ScrollColumn | Returns or sets the number of the leftmost column in the pane or window. Read/write Long.
ScrollRow | Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.
SelectedSheets | Returns a Sheets collection that represents all the selected sheets in the specified window. Read-only.
Selection | Returns the specified window, for a Windows object.
SheetViews | Returns the SheetViews object for the specified window. Read-only.
Split | True if the window is split. Read/write Boolean.
SplitColumn | Returns or sets the column number where the window is split into panes (the number of columns to the left of the split line). Read/write Long.
SplitHorizontal | Returns or sets the location of the horizontal window split, in points. Read/write Double.
SplitRow | Returns or sets the row number where the window is split into panes (the number of rows above the split). Read/write Long.
SplitVertical | Returns or sets the location of the vertical window split, in points. Read/write Double.
TabRatio | Returns or sets the ratio of the width of the workbook's tab area to the width of the window's horizontal scroll bar (as a number between 0 (zero) and 1; the default value is 0.6). Read/write Double.
Top | Returns or sets a Double value that represents the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar).
Type | Returns or sets a XlWindowType value that represents the window type.
UsableHeight | Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.
UsableWidth | Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.
View | Returns or sets the view showing in the window. Read/write XlWindowView.
Visible | Returns or sets a Boolean value that determines whether the object is visible. Read/write.
VisibleRange | Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.
Width | Returns or sets a Double value that represents the width, in points, of the window.
WindowNumber | Returns the window number. For example, a window named "Book1.xls:2" has 2 as its window number. Most windows have the window number 1. Read-only Long.
WindowState | Returns or sets the state of the window. Read/write XlWindowState.
Zoom | Returns or sets a Variant value that represents the display size of the window, as a percentage (100 equals normal size, 200 equals double size, and so on).


Window.ActiveCell Property (Excel)

 Copy code hover
[image]

Window.ActiveCell Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails. Read-only.

Syntax

expression .ActiveCell

expression A variable that represents a Window object.

Remarks

If you don't specify an object qualifier, this property returns the active cell in the active window.

Be careful to distinguish between the active cell and the selection. The active cell is a single cell inside the current selection. The selection may contain more than one cell, but only one is the active cell.

The following expressions all return the active cell, and are all equivalent.

VBA Copy code Copy code
ActiveCell
Application.ActiveCell
ActiveWindow.ActiveCell
Application.ActiveWindow.ActiveCell

Example

This example uses a message box to display the value in the active cell. Because the ActiveCell property fails if the active sheet isn't a worksheet, the example activates Sheet1 before using the ActiveCell property.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox ActiveCell.Value

This example changes the font formatting for the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
With ActiveCell.Font
 .Bold = True
 .Italic = True
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActiveChart Property (Excel)

 Copy code hover
[image]

Window.ActiveChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.

Syntax

expression .ActiveChart

expression A variable that represents a Window object.

Remarks

If you don't specify an object qualifier, this property returns the active chart in the active workbook.

Example

This example turns on the legend for the active chart.

VBA Copy code Copy code
ActiveChart.HasLegend = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActivePane Property (Excel)

 Copy code hover
[image]

Window.ActivePane Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Pane object that represents the active pane in the window. Read-only.

Syntax

expression .ActivePane

expression A variable that represents a Window object.

Remarks

This property can be used only on worksheets and macro sheets.

This property returns a Pane object. You must use the Index property to obtain the index of the active pane.

Example

This example activates the next pane of the active window in Book1.xls. You cannot activate the next pane if the panes are frozen. The example must be run from a workbook other than Book1.xls. Before running the example, make sure that Book1.xls has either two or four panes in the active worksheet.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Activate
If not ActiveWindow.FreezePanes Then
 With ActiveWindow
 i = .ActivePane.Index
 If i = .Panes.Count Then
 .Panes(1).Activate
 Else
 .Panes(i+1).Activate
 End If
 End With
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActiveSheet Property (Excel)

 Copy code hover
[image]

Window.ActiveSheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.

Syntax

expression .ActiveSheet

expression A variable that represents a Window object.

Remarks

If you don't specify an object qualifier, this property returns the active sheet in the active workbook.

If a workbook appears in more than one window, the ActiveSheet property may be different in different windows.

Example

This example displays the name of the active sheet.

VBA Copy code Copy code
MsgBox "The name of the active sheet is " & ActiveSheet.Name

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActiveSheetView Property (Excel)

 Copy code hover
[image]

Window.ActiveSheetView Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the view of the active sheet in the specified window. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ActiveSheetView

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Application Property (Excel)

 Copy code hover
[image]

Window.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Window object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.AutoFilterDateGrouping Property (Excel)

 Copy code hover
[image]

Window.AutoFilterDateGrouping Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the auto filter for date grouping is currently displayed in the specified window. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .AutoFilterDateGrouping

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Caption Property (Excel)

 Copy code hover
[image]

Window.Caption Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the name that appears in the title bar of the document window.

Syntax

expression .Caption

expression A variable that represents a Window object.

Remarks

When you set the name, you can use that name as the index to the Windows collection (as demonstrated in the example.)

Example

This example sets the name of the first window in the active workbook to be "Consolidated Balance Sheet." This name is then used as the index to that window in the Windows collection.

VBA Copy code Copy code
ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet"
ActiveWorkbook.Windows("Consolidated Balance Sheet") _
 .ActiveSheet.Calculate

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Creator Property (Excel)

 Copy code hover
[image]

Window.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Window object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayFormulas Property (Excel)

 Copy code hover
[image]

Window.DisplayFormulas Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the window is displaying formulas; False if the window is displaying values. Read/write Boolean.

Syntax

expression .DisplayFormulas

expression A variable that represents a Window object.

Remarks

This property applies only to worksheets and macro sheets.

Example

This example changes the active window in Book1.xls to display formulas.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayFormulas = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayGridlines Property (Excel)

 Copy code hover
[image]

Window.DisplayGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if gridlines are displayed. Read/write Boolean.

Syntax

expression .DisplayGridlines

expression A variable that represents a Window object.

Remarks

This property applies only to worksheets and macro sheets.

This property affects only displayed gridlines. Use the PrintGridlines property to control the printing of gridlines.

Example

This example toggles the display of gridlines in the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayGridlines = Not(ActiveWindow.DisplayGridlines)

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayHeadings Property (Excel)

 Copy code hover
[image]

Window.DisplayHeadings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.

Syntax

expression .DisplayHeadings

expression A variable that represents a Window object.

Remarks

This property applies only to worksheets and macro sheets.

This property affects only displayed headings. Use the PrintHeadings property to control the printing of headings.

Example

This example turns off the display of row and column headings in the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayHeadings = False

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayHorizontalScrollBar Property (Excel)

 Copy code hover
[image]

Window.DisplayHorizontalScrollBar Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the horizontal scroll bar is displayed. Read/write Boolean.

Syntax

expression .DisplayHorizontalScrollBar

expression A variable that represents a Window object.

Example

This example turns on the horizontal scroll bar for the active window.

VBA Copy code Copy code
ActiveWindow.DisplayHorizontalScrollBar = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayOutline Property (Excel)

 Copy code hover
[image]

Window.DisplayOutline Property (Excel)
See also Send feedback

Published: July 16, 2012

True if outline symbols are displayed. Read/write Boolean.

Syntax

expression .DisplayOutline

expression A variable that represents a Window object.

Remarks

This property applies only to worksheets and macro sheets.

Example

This example displays outline symbols for the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayOutline = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayRightToLeft Property (Excel)

 Copy code hover
[image]

Window.DisplayRightToLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified window is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.

Syntax

expression .DisplayRightToLeft

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayRuler Property (Excel)

 Copy code hover
[image]

Window.DisplayRuler Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a ruler is displayed for the specified window. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayRuler

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayVerticalScrollBar Property (Excel)

 Copy code hover
[image]

Window.DisplayVerticalScrollBar Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the vertical scroll bar is displayed. Read/write Boolean.

Syntax

expression .DisplayVerticalScrollBar

expression A variable that represents a Window object.

Example

This example turns on the vertical scroll bar for the active window.

VBA Copy code Copy code
ActiveWindow.DisplayVerticalScrollBar = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayWhitespace Property (Excel)

 Copy code hover
[image]

Window.DisplayWhitespace Property (Excel)
See also Send feedback

Published: July 16, 2012

True if whitespace is displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayWhitespace

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayWorkbookTabs Property (Excel)

 Copy code hover
[image]

Window.DisplayWorkbookTabs Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook tabs are displayed. Read/write Boolean.

Syntax

expression .DisplayWorkbookTabs

expression A variable that represents a Window object.

Example

This example turns on the workbook tabs.

VBA Copy code Copy code
ActiveWindow.DisplayWorkbookTabs = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayZeros Property (Excel)

 Copy code hover
[image]

Window.DisplayZeros Property (Excel)
See also Send feedback

Published: July 16, 2012

True if zero values are displayed. Read/write Boolean.

Syntax

expression .DisplayZeros

expression A variable that represents a Window object.

Remarks

This property applies only to worksheets and macro sheets.

Example

This example sets the active window in Book1.xls to display zero values.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayZeros = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.EnableResize Property (Excel)

 Copy code hover
[image]

Window.EnableResize Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the window can be resized. Read/write Boolean.

Syntax

expression .EnableResize

expression A variable that represents a Window object.

Example

This example sets the active window so that it cannot be resized.

VBA Copy code Copy code
ActiveWindow.EnableResize = False

See also

Concepts

Window Object

Other resources

Window Object Members


Window.FreezePanes Property (Excel)

 Copy code hover
[image]

Window.FreezePanes Property (Excel)
See also Send feedback

Published: July 16, 2012

True if split panes are frozen. Read/write Boolean.

Syntax

expression .FreezePanes

expression A variable that represents a Window object.

Remarks

It's possible for FreezePanes to be True and Split to be False, or vice versa.

This property applies only to worksheets and macro sheets.

Example

This example freezes split panes in the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.FreezePanes = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.GridlineColor Property (Excel)

 Copy code hover
[image]

Window.GridlineColor Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the gridline color as an RGB value. Read/write Long.

Syntax

expression .GridlineColor

expression A variable that represents a Window object.

Example

This example sets the gridline color in the active window in Book1.xls to red.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.GridlineColor = RGB(255,0,0)

See also

Concepts

Window Object

Other resources

Window Object Members


Window.GridlineColorIndex Property (Excel)

 Copy code hover
[image]

Window.GridlineColorIndex Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the gridline color as an index into the current color palette or as the following XlColorIndex constant.

Syntax

expression .GridlineColorIndex

expression A variable that represents a Window object.

Remarks

XlColorIndex can be the following XlColorIndex constant.

xlColorIndexAutomatic

Set this property to xlColorIndexAutomatic to specify the automatic color.

Example

This example sets the gridline color in the active window to blue.

VBA Copy code Copy code
ActiveWindow.GridlineColorIndex = 5

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Height Property (Excel)

 Copy code hover
[image]

Window.Height Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents tThe height, in points, of the window.

Syntax

expression .Height

expression A variable that represents a Window object.

Remarks

Use the UsableHeight property to determine the maximum size for the window. You cannot set this property if the window is maximized or minimized. Use the WindowState property to determine the window state.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Hwnd Property (Excel)

 Copy code hover
[image]

Window.Hwnd Property (Excel)
See also Send feedback

Returns a Long that indicates the window handle of the specified window. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Hwnd

expression A variable that represents a Window object.

Property value

INT32

See also

Concepts

Window Object

Other resources

Window Members


Window.Index Property (Excel)

 Copy code hover
[image]

Window.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Left Property (Excel)

 Copy code hover
[image]

Window.Left Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the left edge of the client area to the left edge of the window.

Syntax

expression .Left

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.OnWindow Property (Excel)

 Copy code hover
[image]

Window.OnWindow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the procedure that's run whenever you activate a window. Read/write String.

Syntax

expression .OnWindow

expression A variable that represents a Window object.

Remarks

The procedure specified by this property isn't run when other procedures switch to the window or when a command to switch to a window is received through a DDE channel. Instead, the procedure responds to the user's actions, such as clicking a window with the mouse.

If a worksheet or macro sheet has an Auto_Activate or Auto_Deactivate macro defined for it, those macros will be run after the procedure specified by the OnWindow property.

Example

This example causes the WindowActivate procedure to be run whenever window one is activated.

VBA Copy code Copy code
ThisWorkbook.Windows(1).OnWindow = "WindowActivate"

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Panes Property (Excel)

 Copy code hover
[image]

Window.Panes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Panes collection that represents all the panes in the specified window. Read-only.

Syntax

expression .Panes

expression A variable that represents a Window object.

Remarks

This property is available for a window only if the window's Split property can be set to True.

Example

This example displays the number of panes in the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
MsgBox "There are " & ActiveWindow.Panes.Count & _
 " panes in the active window"

This example activates the pane in the upper-left corner of the active window in Book1.xls.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.Panes(1).Activate

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Parent Property (Excel)

 Copy code hover
[image]

Window.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.RangeSelection Property (Excel)

 Copy code hover
[image]

Window.RangeSelection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the selected cells on the worksheet in the specified window even if a graphic object is active or selected on the worksheet. Read-only.

Syntax

expression .RangeSelection

expression A variable that represents a Window object.

Remarks

When a graphic object is selected on a worksheet, the Selection property returns the graphic object instead of a Range object; the RangeSelection property returns the range of cells that was selected before the graphic object was selected.

This property and the Selection property return identical values when a range (not a graphic object) is selected on the worksheet.

If the active sheet in the specified window isn't a worksheet, this property fails.

Example

This example displays the address of the selected cells on the worksheet in the active window.

VBA Copy code Copy code
MsgBox ActiveWindow.RangeSelection.Address

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ScrollColumn Property (Excel)

 Copy code hover
[image]

Window.ScrollColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the leftmost column in the pane or window. Read/write Long.

Syntax

expression .ScrollColumn

expression A variable that represents a Window object.

Remarks

If the window is split, the ScrollColumn property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollColumn property of the Window object excludes the frozen areas.

Example

This example moves column three so that it's the leftmost column in the window.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWindow.ScrollColumn = 3

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ScrollRow Property (Excel)

 Copy code hover
[image]

Window.ScrollRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the row that appears at the top of the pane or window. Read/write Long.

Syntax

expression .ScrollRow

expression A variable that represents a Window object.

Remarks

If the window is split, the ScrollRow property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollRow property of the Window object excludes the frozen areas.

Example

This example moves row ten to the top of the window.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWindow.ScrollRow = 10

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SelectedSheets Property (Excel)

 Copy code hover
[image]

Window.SelectedSheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the selected sheets in the specified window. Read-only.

Syntax

expression .SelectedSheets

expression A variable that represents a Window object.

Example

This example displays a message if Sheet1 is selected in Book1.xls.

VBA Copy code Copy code
For Each sh In Workbooks("BOOK1.XLS").Windows(1).SelectedSheets
 If sh.Name = "Sheet1" Then
 MsgBox "Sheet1 is selected"
 Exit For
 End If
Next

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Selection Property (Excel)

 Copy code hover
[image]

Window.Selection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the specified window, for a Windows object.

Syntax

expression .Selection

expression A variable that represents a Window object.

Remarks

The returned object type depends on the current selection (for example, if a cell is selected, this property returns a Range object). The Selection property returns Nothing if nothing is selected.

Using this property with no object qualifier is equivalent to using Application.Selection.

Example

This example clears the selection on Sheet1 (assuming that the selection is a range of cells).

VBA Copy code Copy code
Worksheets("Sheet1").Activate
Selection.Clear

This example displays the Visual Basic object type of the selection.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
MsgBox "The selection object type is " & TypeName(Selection)

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SheetViews Property (Excel)

 Copy code hover
[image]

Window.SheetViews Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SheetViews object for the specified window. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .SheetViews

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Split Property (Excel)

 Copy code hover
[image]

Window.Split Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the window is split. Read/write Boolean.

Syntax

expression .Split

expression A variable that represents a Window object.

Remarks

It's possible for FreezePanes to be True and Split to be False, or vice versa.

This property applies only to worksheets and macro sheets.

Example

This example splits the active window in Book1.xls at cell B2, without freezing panes. This causes the Split property to return True.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
With ActiveWindow
 .SplitColumn = 2
 .SplitRow = 2
End With

This example illustrates two ways of removing the split added by the preceding example.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.Split = False 'method one
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.SplitColumn = 0 'method two
ActiveWindow.SplitRow = 0

This example removes the window split. Before you can remove the split, you must set FreezePanes to False to remove frozen panes.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
With ActiveWindow
 .FreezePanes = False
 .Split = False
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SplitColumn Property (Excel)

 Copy code hover
[image]

Window.SplitColumn Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the column number where the window is split into panes (the number of columns to the left of the split line). Read/write Long.

Syntax

expression .SplitColumn

expression A variable that represents a Window object.

Example

This example splits the window and leaves 1.5 columns to the left of the split line.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.SplitColumn = 1.5

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SplitHorizontal Property (Excel)

 Copy code hover
[image]

Window.SplitHorizontal Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of the horizontal window split, in points. Read/write Double.

Syntax

expression .SplitHorizontal

expression A variable that represents a Window object.

Example

This example sets the horizontal split for the active window to 216 points (3 inches).

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.SplitHorizontal = 216

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SplitRow Property (Excel)

 Copy code hover
[image]

Window.SplitRow Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the row number where the window is split into panes (the number of rows above the split). Read/write Long.

Syntax

expression .SplitRow

expression A variable that represents a Window object.

Example

This example splits the active window so that there are 10 rows above the split line.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.SplitRow = 10

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SplitVertical Property (Excel)

 Copy code hover
[image]

Window.SplitVertical Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of the vertical window split, in points. Read/write Double.

Syntax

expression .SplitVertical

expression A variable that represents a Window object.

Example

This example sets the vertical split for the active window to 216 points (3 inches).

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.SplitVertical = 216

See also

Concepts

Window Object

Other resources

Window Object Members


Window.TabRatio Property (Excel)

 Copy code hover
[image]

Window.TabRatio Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the ratio of the width of the workbook's tab area to the width of the window's horizontal scroll bar (as a number between 0 (zero) and 1; the default value is 0.6). Read/write Double.

Syntax

expression .TabRatio

expression A variable that represents a Window object.

Remarks

This property has no effect when DisplayWorkbookTabs is set to False (its value is retained, but it has no effect on the display).

Example

This example makes the workbook tabs half the width of the horizontal scroll bar.

VBA Copy code Copy code
ActiveWindow.TabRatio = 0.5

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Top Property (Excel)

 Copy code hover
[image]

Window.Top Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar).

Syntax

expression .Top

expression A variable that represents a Window object.

Remarks

You cannot set this property for a maximized window. Use the WindowState property to return or set the state of the window.

Example

This example arranges windows one and two horizontally; in other words, each window occupies half the available vertical space and all the available horizontal space in the application window's client area. For this example to work, there must be only two worksheet windows open.

VBA Copy code Copy code
Windows.Arrange xlArrangeTiled
ah = Windows(1).Height ' available height
aw = Windows(1).Width + Windows(2).Width ' available width
With Windows(1)
 .Width = aw
 .Height = ah / 2
 .Left = 0
End With
With Windows(2)
 .Width = aw
 .Height = ah / 2
 .Top = ah / 2
 .Left = 0
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Type Property (Excel)

 Copy code hover
[image]

Window.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a XlWindowType value that represents the window type.

Syntax

expression .Type

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.UsableHeight Property (Excel)

 Copy code hover
[image]

Window.UsableHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the maximum height of the space that a window can occupy in the application window area, in points. Read-only Double.

Syntax

expression .UsableHeight

expression A variable that represents a Window object.

Example

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.UsableWidth Property (Excel)

 Copy code hover
[image]

Window.UsableWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the maximum width of the space that a window can occupy in the application window area, in points. Read-only Double.

Syntax

expression .UsableWidth

expression A variable that represents a Window object.

Example

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.View Property (Excel)

 Copy code hover
[image]

Window.View Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the view showing in the window. Read/write XlWindowView.

Syntax

expression .View

expression A variable that represents a Window object.

Remarks

XlWindowView can be one of these XlWindowView constants.

xlNormalView

xlPageBreakPreview

xlPageLayoutView

Example

This example switches the view in the active window to page break preview.

VBA Copy code Copy code
ActiveWindow.View = xlPageBreakPreview

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Visible Property (Excel)

 Copy code hover
[image]

Window.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that determines whether the object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.VisibleRange Property (Excel)

 Copy code hover
[image]

Window.VisibleRange Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range. Read-only.

Syntax

expression .VisibleRange

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Width Property (Excel)

 Copy code hover
[image]

Window.Width Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Double value that represents the width, in points, of the window.

Syntax

expression .Width

expression A variable that represents a Window object.

Remarks

Use the UsableWidth property to determine the maximum size for the window. You cannot set this property if the window is maximized or minimized. Use the WindowState property to determine the window state.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.WindowNumber Property (Excel)

 Copy code hover
[image]

Window.WindowNumber Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the window number. For example, a window named "Book1.xls:2" has 2 as its window number. Most windows have the window number 1. Read-only Long.

Syntax

expression .WindowNumber

expression A variable that represents a Window object.

Remarks

The window number isn't the same as the window index (the return value of the Index property), which is the position of the window within the Windows collection.

Example

This example creates a new window of the active window and then displays the window number of the new window.

VBA Copy code Copy code
ActiveWindow.NewWindow
MsgBox ActiveWindow.WindowNumber

See also

Concepts

Window Object

Other resources

Window Object Members


Window.WindowState Property (Excel)

 Copy code hover
[image]

Window.WindowState Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the window. Read/write XlWindowState.

Syntax

expression .WindowState

expression A variable that represents a Window object.

Example

This example maximizes the application window in Microsoft Excel.

VBA Copy code Copy code
Application.WindowState = xlMaximized

This example expands the active window to the maximum size available (assuming that the window isn't already maximized).

VBA Copy code Copy code
With ActiveWindow
 .WindowState = xlNormal
 .Top = 1
 .Left = 1
 .Height = Application.UsableHeight
 .Width = Application.UsableWidth
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Zoom Property (Excel)

 Copy code hover
[image]

Window.Zoom Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that represents the display size of the window, as a percentage (100 equals normal size, 200 equals double size, and so on).

Syntax

expression .Zoom

expression A variable that represents a Window object.

Remarks

You can also set this property to True to make the window size fit the current selection.

This function affects only the sheet that's currently active in the window. To use this property on other sheets, you must first activate them.

See also

Concepts

Window Object

Other resources

Window Object Members


Window Methods (Excel)

 Copy code hover
[image]

Window Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Brings the window to the front of the z-order.
ActivateNext | Activates the specified window and then sends it to the back of the window z-order.
ActivatePrevious | Activates the specified window and then activates the window at the back of the window z-order.
Close | Closes the object.
LargeScroll | Scrolls the contents of the window by pages.
NewWindow | Creates a new window or a copy of the specified window.
PointsToScreenPixelsX | Converts a horizontal measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PointsToScreenPixelsY | Converts a vertical measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
RangeFromPoint | Returns the Shape or Range object that is positioned at the specified pair of screen coordinates. If there isn't a shape located at the specified coordinates, this method returns Nothing.
ScrollIntoView | Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).
ScrollWorkbookTabs | Scrolls through the workbook tabs at the bottom of the window. Doesn't affect the active sheet in the workbook.
SmallScroll | Scrolls the contents of the window by rows or columns.


Window.Activate Method (Excel)

 Copy code hover
[image]

Window.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Brings the window to the front of the z-order.

Syntax

expression .Activate

expression A variable that represents a Window object.

Return Value

Variant

Remarks

This won't run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActivateNext Method (Excel)

 Copy code hover
[image]

Window.ActivateNext Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the specified window and then sends it to the back of the window z-order.

Syntax

expression .ActivateNext

expression A variable that represents a Window object.

Return Value

Variant

Example

This example sends the active window to the back of the z-order.

VBA Copy code Copy code
ActiveWindow.ActivateNext

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActivatePrevious Method (Excel)

 Copy code hover
[image]

Window.ActivatePrevious Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the specified window and then activates the window at the back of the window z-order.

Syntax

expression .ActivatePrevious

expression A variable that represents a Window object.

Return Value

Variant

Example

This example activates the window at the back of the z-order.

VBA Copy code Copy code
ActiveWindow.ActivatePrevious

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Close Method (Excel)

 Copy code hover
[image]

Window.Close Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes the object.

Syntax

expression .Close(SaveChanges, Filename, RouteWorkbook)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | If there are no changes to the workbook, this argument is ignored. If there are changes to the workbook and the workbook appears in other open windows, this argument is ignored. If there are changes to the workbook but the workbook doesn't appear in any other open windows, this argument specifies whether changes should be saved. If set to True, changes are saved to the workbook. If there is not yet a file name associated with the workbook, then Filename is used. If Filename is omitted, the user is asked to supply a file name.
Filename | Optional | Variant | Save changes under this file name.
RouteWorkbook | Optional | Variant | If the workbook doesn't need to be routed to the next recipient (if it has no routing slip or has already been routed), this argument is ignored. Otherwise, Microsoft Excel routes the workbook according to the value of this parameter. If set to True, the workbook is sent to the next recipient. If set to False, the workbook is not sent. If omitted, the user is asked whether the workbook should be sent.

Return Value

True if the method successfully closed the object; otherwise, False.

Remarks

Closing a workbook from Visual Basic doesn't run any Auto_Close macros in the workbook. Use the RunAutoMacros method to run the auto close macros.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.LargeScroll Method (Excel)

 Copy code hover
[image]

Window.LargeScroll Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls the contents of the window by pages.

Syntax

expression .LargeScroll(Down, Up, ToRight, ToLeft)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of pages to scroll the contents down.
Up | Optional | Variant | The number of pages to scroll the contents up.
ToRight | Optional | Variant | The number of pages to scroll the contents to the right.
ToLeft | Optional | Variant | The number of pages to scroll the contents to the left.

Return Value

Variant

Remarks

If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three pages.

If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three pages.

Any of the arguments can be a negative number.

Example

This example scrolls the contents of the active window of Sheet1 down three pages.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWindow.LargeScroll down:=3

See also

Concepts

Window Object

Other resources

Window Object Members


Window.NewWindow Method (Excel)

 Copy code hover
[image]

Window.NewWindow Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new window or a copy of the specified window.

Syntax

expression .NewWindow

expression A variable that represents a Window object.

Return Value

Window

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PointsToScreenPixelsX Method (Excel)

 Copy code hover
[image]

Window.PointsToScreenPixelsX Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a horizontal measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.

Syntax

expression .PointsToScreenPixelsX(Points)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Long | The number of points horizontally along the top of the document window, starting from the left.

Return Value

Long

Example

This example determines the height and width (in pixels) of the selected cells in the active window and returns the values in the lWinWidth and lWinHeight variables.

VBA Copy code Copy code
With ActiveWindow
 lWinWidth = _
 .PointsToScreenPixelsX(.Selection.Width)
 lWinHeight = _
 .PointsToScreenPixelsY(.Selection.Height)
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PointsToScreenPixelsY Method (Excel)

 Copy code hover
[image]

Window.PointsToScreenPixelsY Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a vertical measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.

Syntax

expression .PointsToScreenPixelsY(Points)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Long | The number of points vertically along the left edge of the document window, starting from the top.

Return Value

Long

Example

This example determines the height and width (in pixels) of the selected cells in the active window and returns the values in the lWinWidth and lWinHeight variables.

VBA Copy code Copy code
With ActiveWindow
 lWinWidth = _
 .PointsToScreenPixelsX(.Selection.Width)
 lWinHeight = _
 .PointsToScreenPixelsY(.Selection.Height)
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PrintOut Method (Excel)

 Copy code hover
[image]

Window.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PrintPreview Method (Excel)

 Copy code hover
[image]

Window.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Return Value

Variant

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Window Object

Other resources

Window Object Members


Window.RangeFromPoint Method (Excel)

 Copy code hover
[image]

Window.RangeFromPoint Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Shape or Range object that is positioned at the specified pair of screen coordinates. If there isn't a shape located at the specified coordinates, this method returns Nothing.

Syntax

expression .RangeFromPoint(x, y)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Long | The value (in pixels) that represents the horizontal distance from the left edge of the screen, starting at the top.
y | Required | Long | The value (in pixels) that represents the vertical distance from the top of the screen, starting on the left.

Return Value

Object

Example

This example returns the alternative text for the shape immediately below the mouse pointer if the shape is a chart, line, or picture.

VBA Copy code Copy code
Private Function AltText(ByVal intMouseX As Integer, _
 ByVal intMouseY as Integer) As String
 Set objShape = ActiveWindow.RangeFromPoint _
 (x:=intMouseX, y:=intMouseY)
 If Not objShape Is Nothing Then
 With objShape
 Select Case .Type
 Case msoChart, msoLine, msoPicture:
 AltText = .AlternativeText
 Case Else:
 AltText = ""
 End Select
 End With
 Else
 AltText = ""
 End If
End Function

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ScrollIntoView Method (Excel)

 Copy code hover
[image]

Window.ScrollIntoView Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).

Syntax

expression .ScrollIntoView(Left, Top, Width, Height, Start)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Long | The horizontal position of the rectangle (in points) from the left edge of the document window or pane.
Top | Required | Long | The vertical position of the rectangle (in points) from the top of the document window or pane.
Width | Required | Long | The width of the rectangle, in points.
Height | Required | Long | The height of the rectangle, in points.
Start | Optional | Variant | True to have the upper-left corner of the rectangle appear in the upper-left corner of the document window or pane. False to have the lower-right corner of the rectangle appear in the lower-right corner of the document window or pane. The default value is True.

Remarks

The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.

Example

This example defines a 100-by-200-pixel rectangle in the active document window, positioned 20 pixels from the top of the window and 50 pixels from the left edge of the window.The example then scrolls the document up and to the left so that the upper-left corner of the rectangle is aligned with the upper-left corner of the window.

VBA Copy code Copy code
ActiveWindow.ScrollIntoView _
 Left:=50, Top:=20, _
 Width:=100, Height:=200

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ScrollWorkbookTabs Method (Excel)

 Copy code hover
[image]

Window.ScrollWorkbookTabs Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls through the workbook tabs at the bottom of the window. Doesn't affect the active sheet in the workbook.

Syntax

expression .ScrollWorkbookTabs(Sheets, Position)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Sheets | Optional | Variant | The number of sheets to scroll by. Use a positive number to scroll forward, a negative number to scroll backward, or 0 (zero) to not scroll at all. You must specify Sheets if you don't specify Position.
Position | Optional | Variant | Use xlFirst to scroll to the first sheet, or use xlLast to scroll to the last sheet. You must specify Position if you don't specify Sheets.

Return Value

Variant

Example

This example scrolls through the workbook tabs to the last sheet in the workbook.

VBA Copy code Copy code
ActiveWindow.ScrollWorkbookTabs position:=xlLast

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SmallScroll Method (Excel)

 Copy code hover
[image]

Window.SmallScroll Method (Excel)
See also Send feedback

Published: July 16, 2012

Scrolls the contents of the window by rows or columns.

Syntax

expression .SmallScroll(Down, Up, ToRight, ToLeft)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of rows to scroll the contents down.
Up | Optional | Variant | The number of rows to scroll the contents up.
ToRight | Optional | Variant | The number of columns to scroll the contents to the right.
ToLeft | Optional | Variant | The number of columns to scroll the contents to the left.

Return Value

Variant

Remarks

If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three rows.

If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three columns.

Any of these arguments can be a negative number.

Example

This example scrolls the contents of the active window of Sheet1 down three rows.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveWindow.SmallScroll down:=3

See also

Concepts

Window Object

Other resources

Window Object Members


Windows Object (Excel)

 Copy code hover
[image]

Windows Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Window objects in Microsoft Excel.

Remarks

The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Workbook object contains only the windows in the specified workbook.

Example

Use the Windows property to return the Windows collection. The following example cascades all the windows that are currently displayed in Microsoft Excel.

VBA Copy code Copy code
Windows.Arrange arrangeStyle:=xlCascade

Use the NewWindow method to create a new window and add it to the collection. The following example creates a new window for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.NewWindow

Use Windows(index), where index is the window name or index number, to return a single Window object. The following example maximizes the active window.

Note that the active window is always Windows(1).

VBA Copy code Copy code
Windows(1).WindowState = xlMaximized

See also

Concepts

Excel Object Model Reference

Other resources

Windows Object Members


Windows Members (Excel)

 Copy code hover
[image]

Windows Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Window objects in Microsoft Excel.

Methods

Name | Description
Arrange | Arranges the windows on the screen.
BreakSideBySide | Ends side-by-side mode if two windows are in side-by-side mode. Returns a Boolean value that represents whether the method was successful.
CompareSideBySideWith | Opens two windows in side-by-side mode. Returns a Boolean value.
ResetPositionsSideBySide | Resets the position of two worksheet windows that are being compared side by side.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
SyncScrollingSideBySide | True enables scrolling the contents of windows at the same time when documents are being compared side by side. False disables scrolling the windows at the same time.


Windows Properties (Excel)

 Copy code hover
[image]

Windows Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
SyncScrollingSideBySide | True enables scrolling the contents of windows at the same time when documents are being compared side by side. False disables scrolling the windows at the same time.


Windows.Application Property (Excel)

 Copy code hover
[image]

Windows.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Windows object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.Count Property (Excel)

 Copy code hover
[image]

Windows.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Windows object.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.Creator Property (Excel)

 Copy code hover
[image]

Windows.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Windows object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.Item Property (Excel)

 Copy code hover
[image]

Windows.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example maximizes the active window.

VBA Copy code Copy code
Windows.Item(1).WindowState = xlMaximized

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.Parent Property (Excel)

 Copy code hover
[image]

Windows.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Windows object.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.SyncScrollingSideBySide Property (Excel)

 Copy code hover
[image]

Windows.SyncScrollingSideBySide Property (Excel)
See also Send feedback

Published: July 16, 2012

True enables scrolling the contents of windows at the same time when documents are being compared side by side. False disables scrolling the windows at the same time.

Syntax

expression .SyncScrollingSideBySide

expression A variable that represents a Windows object.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows Methods (Excel)

 Copy code hover
[image]

Windows Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Arrange | Arranges the windows on the screen.
BreakSideBySide | Ends side-by-side mode if two windows are in side-by-side mode. Returns a Boolean value that represents whether the method was successful.
CompareSideBySideWith | Opens two windows in side-by-side mode. Returns a Boolean value.
ResetPositionsSideBySide | Resets the position of two worksheet windows that are being compared side by side.


Windows.Arrange Method (Excel)

 Copy code hover
[image]

Windows.Arrange Method (Excel)
See also Send feedback

Arranges the windows on the screen.

Syntax

expression .Arrange(ArrangeStyle, ActiveWorkbook, SyncHorizontal, SyncVertical)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
ArrangeStyle | Optional | XlArrangeStyle | One of the constants of XlArrangeStyle specifying how the windows are arranged.
ActiveWorkbook | Optional | Variant | True to arrange only the visible windows of the active workbook. False to arrange all windows. The default value is False.
SyncHorizontal | Optional | Variant | Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling horizontally. False to not synchronize the windows. The default value is False.
SyncVertical | Optional | Variant | Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling vertically. False to not synchronize the windows. The default value is False.

Return Value

Variant

Remarks

XlArrangeStyle can be one of these XlArrangeStyle constants.

xlArrangeStyleCascade. Windows are cascaded.

xlArrangeStyleTiled default. Windows are tiled

xlArrangeStyleHorizontal. Windows are arranged horizontally.

xlArrangeStyleVertical. Windows are arranged vertically.

Example

This example tiles all the windows in the application.

VBA Copy code Copy code
Application.Windows.Arrange ArrangeStyle:=xlArrangeStyleTiled

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.BreakSideBySide Method (Excel)

 Copy code hover
[image]

Windows.BreakSideBySide Method (Excel)
See also Send feedback

Published: July 16, 2012

Ends side-by-side mode if two windows are in side-by-side mode. Returns a Boolean value that represents whether the method was successful.

Syntax

expression .BreakSideBySide

expression A variable that represents a Windows object.

Return Value

Boolean

Example

The following example ends side-by-side mode.

VBA Copy code Copy code
Sub CloseSideBySide()

 ActiveWorkbook.Windows.BreakSideBySide

End Sub

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.CompareSideBySideWith Method (Excel)

 Copy code hover
[image]

Windows.CompareSideBySideWith Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens two windows in side-by-side mode. Returns a Boolean value.

Syntax

expression .CompareSideBySideWith(WindowName)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
WindowName | Required | Variant | The name of the window.

Return Value

Boolean.

Remarks

You cannot use the CompareSideBySideWith method with the Application object or the ActiveWorkbook property.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Windows.ResetPositionsSideBySide Method (Excel)

 Copy code hover
[image]

Windows.ResetPositionsSideBySide Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets the position of two worksheet windows that are being compared side by side.

Syntax

expression .ResetPositionsSideBySide

expression A variable that represents a Windows object.

Remarks

Use the ResetPositionsSideBySide method to reset the position of two worksheets that are being compared side by side. For example, if a user minimizes or maximizes one of the two worksheet windows being compared, the ResetPositionsSideBySide method resets the display so that the two windows are displayed side by side again.

See also

Concepts

Windows Object

Other resources

Windows Object Members


Workbook Object (Excel)

 Copy code hover
[image]

Workbook Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a Microsoft Excel workbook.

Remarks

The Workbook object is a member of the Workbooks collection. The Workbooks collection contains all the Workbook objects currently open in Microsoft Excel.

ThisWorkbook Property

The ThisWorkbook property returns the workbook where the Visual Basic code is running. In most cases, this is the same as the active workbook. However, if the Visual Basic code is part of an add-in, the ThisWorkbook property won't return the active workbook. In this case, the active workbook is the workbook calling the add-in, whereas the ThisWorkbook property returns the add-in workbook.

If you'll be creating an add-in from your Visual Basic code, you should use the ThisWorkbook property to qualify any statement that must be run on the workbook you compile into the add-in.

Example

Use Workbooks(index), where index is the workbook name or index number, to return a single Workbook object. The following example activates workbook one.

VBA Copy code Copy code
Workbooks(1).Activate

The index number denotes the order in which the workbooks were opened or created. Workbooks(1) is the first workbook created, and Workbooks(Workbooks.Count) is the last one created. Activating a workbook doesn't change its index number. All workbooks are included in the index count, even if they're hidden.

The Name property returns the workbook name. You cannot set the name by using this property; if you need to change the name, use the SaveAs method to save the workbook under a different name. The following example activates Sheet1 in the workbook named Cogs.xls (the workbook must already be open in Microsoft Excel).

VBA Copy code Copy code
Workbooks("Cogs.xls").Worksheets("Sheet1").Activate

The ActiveWorkbook property returns the workbook that's currently active. The following example sets the name of the author for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Author = "Jean Selva"

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example emails a worksheet tab from the active workbook using a specified email address and subject. To run this code, the active worksheet must contain the email address in cell A1, the subject in cell B1, and the name of the worksheet to send in cell C1.

VBA Copy code Copy code
Sub SendTab()
   'Declare and initialize your variables, and turn off screen updating.
   Dim wks As Worksheet
   Application.ScreenUpdating = False
   Set wks = ActiveSheet

   'Copy the target worksheet, specified in cell C1, to the clipboard.
   Worksheets(Range("C1").Value).Copy

   'Send the content in the clipboard to the email account specified in cell A1,
   'using the subject line specified in cell B1.
   ActiveWorkbook.SendMail wks.Range("A1").Value, wks.Range("B1").Value

   'Do not save changes and turn screen updating back on.
   ActiveWorkbook.Close savechanges:=False
   Application.ScreenUpdating = True
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Excel Object Model Reference

Other resources

Workbook Object Members


Workbook Members (Excel)

 Copy code hover
[image]

Workbook Members (Excel)
Send feedback

Represents a Microsoft Excel workbook.

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
AddinInstall | Occurs when the workbook is installed as an add-in
AddinUninstall | Occurs when the workbook is uninstalled as an add-in.
AfterSave | Occurs after the workbook is saved.
AfterXmlExport | Occurs after Microsoft Excel saves or exports XML data from the specified workbook.
AfterXmlImport | Occurs after an existing XML data connection is refreshed or after new XML data is imported into the specified Microsoft Excel workbook.
BeforeClose | Occurs before the workbook closes. If the workbook has been changed, this event occurs before the user is asked to save changes.
BeforePrint | Occurs before the workbook (or anything in it) is printed.
BeforeSave | Occurs before the workbook is saved.
BeforeXmlExport | Occurs before Microsoft Excel saves or exports XML data from the specified workbook.
BeforeXmlImport | Occurs before an existing XML data connection is refreshed or before new XML data is imported into a Microsoft Excel workbook.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
ModelChange | Occurs after the Excel data model is changed.
NewChart | Occurs when a new chart is created in the workbook.
NewSheet | Occurs when a new sheet is created in the workbook.
Open | Occurs when the workbook is opened.
PivotTableCloseConnection | Occurs after a PivotTable report closes the connection to its data source.
PivotTableOpenConnection | Occurs after a PivotTable report opens the connection to its data source.
RowsetComplete | The event is raised when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.
SheetActivate | Occurs when any sheet is activated.
SheetBeforeDelete |
SheetBeforeDoubleClick | Occurs when any worksheet is double-clicked, before the default double-click action.
SheetBeforeRightClick | Occurs when any worksheet is right-clicked, before the default right-click action.
SheetCalculate | Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.
SheetChange | Occurs when cells in any worksheet are changed by the user or by an external link.
SheetDeactivate | Occurs when any sheet is deactivated.
SheetFollowHyperlink | Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.
SheetLensGalleryRenderComplete | Occurs when a callout gallery's icons (dynamic & static) have completed rendering for a worksheet.
SheetPivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
SheetPivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
SheetPivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
SheetPivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
SheetPivotTableChangeSync | Occurs after changes to a PivotTable.
SheetPivotTableUpdate | Occurs after the sheet of the PivotTable report has been updated.
SheetSelectionChange | Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).
SheetTableUpdate | Occurs after the sheet table has been updated.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
WindowActivate | Occurs when any workbook window is activated.
WindowDeactivate | Occurs when any workbook window is deactivated.
WindowResize | Occurs when any workbook window is resized.

Methods

Name | Description
AcceptAllChanges | Accepts all changes in the specified shared workbook.
Activate | Activates the first window associated with the workbook.
AddToFavorites | Adds a shortcut to the workbook or hyperlink to the Favorites folder.
ApplyTheme | Applies the specified theme to the current workbook.
BreakLink | Converts formulas linked to other Microsoft Excel sources or OLE sources to values.
CanCheckIn | True if Microsoft Excel can check in a specified workbook to a server. Read/write Boolean.
ChangeFileAccess | Changes the access permissions for the workbook. This may require an updated version to be loaded from the disk.
ChangeLink | Changes a link from one document to another.
CheckIn | Returns a workbook from a local computer to a server, and sets the local workbook to read-only so that it cannot be edited locally. Calling this method will also close the workbook.
CheckInWithVersion | Saves a workbook to a server from a local computer, and sets the local workbook to read-only so that it cannot be edited locally.
Close | Closes the object.
DeleteNumberFormat | Deletes a custom number format from the workbook.
EnableConnections | The EnableConnections method allows developers to programmatically enable data connections within the workbook for the user.
EndReview | Terminates a review of a file that has been sent for review using the SendForReview method.
ExclusiveAccess | Assigns the current user exclusive access to the workbook that's open as a shared list.
ExportAsFixedFormat | The ExportAsFixedFormat method is used to publish a workbook to either the PDF or XPS format.
FollowHyperlink | Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.
ForwardMailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
GetWorkflowTasks | Returns the collection of WorkflowTask objects for the specified workbook.
GetWorkflowTemplates | Returns the collection of WorkflowTemplate objects for the specified workbook.
HighlightChangesOptions | Controls how changes are shown in a shared workbook.
LinkInfo | Returns the link date and update status.
LinkSources | Returns an array of links in the workbook. The names in the array are the names of the linked documents, editions, or DDE or OLE servers. Returns Empty if there are no links.
LockServerFile | Locks the workbook on the server to prevent modification.
MergeWorkbook | Merges changes from one workbook into an open workbook.
NewWindow | Creates a new window or a copy of the specified window.
OpenLinks | Opens the supporting documents for a link or links.
PivotCaches | Returns a PivotCaches collection that represents all the PivotTable caches in the specified workbook. Read-only.
Post | Posts the specified workbook to a public folder. This method works only with a Microsoft Exchange client connected to a Microsoft Exchange server.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a workbook so that it cannot be modified.
ProtectSharing | Saves the workbook and protects it for sharing.
PurgeChangeHistoryNow | Removes entries from the change log for the specified workbook.
RefreshAll | Refreshes all external data ranges and PivotTable reports in the specified workbook.
RejectAllChanges | Rejects all changes in the specified shared workbook.
ReloadAs | Reloads a workbook based on an HTML document, using the specified document encoding.
RemoveDocumentInformation | Removes all information of the specified type from the workbook.
RemoveUser | Disconnects the specified user from the shared workbook.
Reply | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ReplyAll | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ReplyWithChanges | Sends an e-mail message to the author of a workbook that has been sent out for review, notifying them that a reviewer has completed review of the workbook.
ResetColors | Resets the color palette to the default colors.
RunAutoMacros | Runs the Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro attached to the workbook. This method is included for backward compatibility. For new Visual Basic code, you should use the Open, Close, Activate and Deactivate events instead of these macros.
Save | Saves changes to the specified workbook.
SaveAs | Saves changes to the workbook in a different file.
SaveAsXMLData | Exports the data that has been mapped to the specified XML schema map to an XML data file.
SaveCopyAs | Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.
SendFaxOverInternet | Sends a worksheet as a fax to the specfied recipients.
SendForReview | Sends a workbook in an e-mail message for review to the specified recipients.
SendMail | Sends the workbook by using the installed mail system.
SendMailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
SetLinkOnData | Sets the name of a procedure that runs whenever a DDE link is updated.
SetPasswordEncryptionOptions | Sets the options for encrypting workbooks using passwords.
ToggleFormsDesign | The ToggleFormsDesign method is used to toggle Excel into Design Mode when using forms controls.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.
UnprotectSharing | Turns off protection for sharing and saves the workbook.
UpdateFromFile | Updates a read-only workbook from the saved disk version of the workbook if the disk version is more recent than the copy of the workbook that is loaded in memory. If the disk copy hasn't changed since the workbook was loaded, the in-memory copy of the workbook isn't reloaded.
UpdateLink | Updates a Microsoft Excel, DDE, or OLE link (or links).
WebPagePreview | Displays a preview of the specified workbook as it would look if saved as a Web page.
XmlImport | Imports an XML data file into the current workbook.
XmlImportXml | Imports an XML data stream that has been previously loaded into memory. Excel uses the first qualifying map found or if the destination range is specified, Excel will automatically list the data.

Properties

Name | Description
AccuracyVersion | Specifies whether certain worksheet functions use the latest accuracy algorithms to calculate their results. Read/write
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveSlicer | Returns an object that represents the active slicer in the active workbook or in the specified workbook. Returns Nothing if no slicer is active. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoUpdateFrequency | Returns or sets the number of minutes between automatic updates to the shared workbook. Read/write Long.
AutoUpdateSaveChanges | True if current changes to the shared workbook are posted to other users whenever the workbook is automatically updated. False if changes aren't posted (this workbook is still synchronized with changes made by other users). The default value is True. Read/write Boolean.
BuiltinDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified workbook. Read-only.
CalculationVersion | Returns the information about the version of Excel that the workbook was last fully recalculated by. Read-only Long.
CaseSensitive | True if the workbook distinguishes between upper and lower case when comparing content. Read-only Boolean
ChangeHistoryDuration | Returns or sets the number of days shown in the shared workbook's change history. Read/write Long.
ChartDataPointTrack | True will cause all charts in the current document to track the actual data point to which it's attached. False will revert back to tracking the index of the data point. Boolean Read/Write
Charts | Returns a Sheets collection that represents all the chart sheets in the specified workbook.
CheckCompatibility | Controls whether or not the compatibility checker is run automatically when the workbook is saved. Read/write Boolean.
CodeName | Returns the code name for the object. Read-only String.
Colors | Returns or sets colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Variant.
CommandBars | Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.
ConflictResolution | Returns or sets the way conflicts are to be resolved whenever a shared workbook is updated. Read/write XlSaveConflictResolution.
Connections | The Connections property establishes a connection between the workbook and an ODBC or an OLEDB data source and refreshes the data without prompting the user. Read-only.
ConnectionsDisabled | Disables the external connections or links in the workbook. Read-only
Container | Returns the object that represents the container application for the specified OLE object. Read-only Object.
ContentTypeProperties | Returns a MetaProperties collection that describes the metadata stored in the workbook. Read-only.
CreateBackup | True if a backup file is created when this file is saved. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomDocumentProperties | Returns or sets a DocumentProperties collection that represents all the custom document properties for the specified workbook.
CustomViews | Returns a CustomViews collection that represents all the custom views for the workbook.
CustomXMLParts | Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.
Date1904 | True if the workbook uses the 1904 date system. Read/write Boolean.
DefaultPivotTableStyle | Specifies the table style from the TableStyles collection that is used as the default style for PivotTables. Read/write.
DefaultSlicerStyle | Specifies the style from the TableStyles object that is used as the default style for slicers. Read/write.
DefaultTableStyle | Specifies the table style from the TableStyles collection that is used as the default TableStyle. Read/write Variant.
DefaultTimelineStyle | The name of the default slicer style of the workbook. Variant. Read/Write
DisplayDrawingObjects | Returns or sets how shapes are displayed. Read/write Long.
DisplayInkComments | A Boolean value that determines whether ink comments are displayed in the workbook. Read/write Boolean.
DocumentInspectors | Returns a DocumentInspectors collection that represents the Document Inspector modules for the specified workbook. Read-only.
DocumentLibraryVersions | Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared workbook that has versioning enabled and that is stored in a document library on a server.
DoNotPromptForConvert | Returns or sets if the user should be prompted to convert the workbook if the workbook contains features that are not supported by versions of Excel earlier than Excel 2007. Read/write Boolean.
EnableAutoRecover | Saves changed files, of all formats, on a timed interval. Read/write Boolean.
EncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Office Excel 2007 uses when encrypting documents. Read/write.
EnvelopeVisible | True if the e-mail composition header and the envelope toolbar are both visible. Read/write Boolean.
Excel4IntlMacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.
Excel4MacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.
Excel8CompatibilityMode | The Excel8CompatibilityMode property provides developers with a way to check if the workbook is in compatibility mode. Read-only Boolean.
FileFormat | Returns the file format and/or type of the workbook. Read-only XlFileFormat.
Final | Returns or sets a Boolean that indicates whether a workbook is final. Read/write Boolean.
ForceFullCalculation | Returns or sets the specified workbook to forced calculation mode. Read/write.
FullName | Returns the name of the object, including its path on disk, as a string. Read-only String.
FullNameURLEncoded | Returns a String indicating the name of the object, including its path on disk, as a string. Read-only.
HasPassword | True if the workbook has a protection password. Read-only Boolean.
HasVBProject | Returns a Boolean that represents whether a workbook has an attached Microsoft Visual Basic for Applications project. Read-only Boolean.
HighlightChangesOnScreen | True if changes to the shared workbook are highlighted on-screen. Read/write Boolean.
IconSets | This property is used to filter data in a workbook based on a cell icon from the IconSet collection. Read-only.
InactiveListBorderVisible | A Boolean value that specifies whether list borders are visible when a list is not active. Returns True if the border is visible. Read/write Boolean.
IsAddin | True if the workbook is running as an add-in. Read/write Boolean.
IsInplace | True if the specified workbook is being edited in place. False if the workbook has been opened in Microsoft Excel for editing. Read-only Boolean.
KeepChangeHistory | True if change tracking is enabled for the shared workbook. Read/write Boolean.
ListChangesOnNewSheet | True if changes to the shared workbook are shown on a separate worksheet. Read/write Boolean.
Mailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Model | Returns the top level Model object which is the one Data Model for the workbook. Read-only
MultiUserEditing | True if the workbook is open as a shared list. Read-only Boolean.
Name | Returns a String value that represents the name of the object.
Names | Returns a Names collection that represents all the names in the specified workbook (including all worksheet-specific names). Read-only Names object.
Parent | Returns the parent object for the specified object. Read-only.
Password | Returns or sets the password that must be supplied to open the specified workbook. Read/write String.
PasswordEncryptionAlgorithm | Returns a String indicating the algorithm Microsoft Excel uses to encrypt passwords for the specified workbook. Read-only.
PasswordEncryptionFileProperties | True if Microsoft Excel encrypts file properties for the specified password-protected workbook. Read-only Boolean.
PasswordEncryptionKeyLength | Returns a Long indicating the key length of the algorithm Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.
PasswordEncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.
Path | Returns a String that represents the complete path to the workbook/file that this workbook object respresents.
Permission | Returns a Permission object that represents the permission settings in the specified workbook.
PersonalViewListSettings | True if filter and sort settings for lists are included in the user's personal view of the shared workbook. Read/write Boolean.
PersonalViewPrintSettings | True if print settings are included in the user's personal view of the shared workbook. Read-write Boolean.
PivotTables | Returns an object that represents a collection of all the PivotTable reports on a worksheet. Read-only.
PrecisionAsDisplayed | True if calculations in this workbook will be done using only the precision of the numbers as they're displayed. Read/write Boolean.
ProtectStructure | True if the order of the sheets in the workbook is protected. Read-only Boolean.
ProtectWindows | True if the windows of the workbook are protected. Read-only Boolean.
PublishObjects | Returns the PublishObjects collection. Read-only.
ReadOnly | Returns True if the object has been opened as read-only. Read-only Boolean.
ReadOnlyRecommended | True if the workbook was saved as read-only recommended. Read-only Boolean.
RemovePersonalInformation | True if personal information can be removed from the specified workbook. The default value is False. Read/write Boolean.
Research | Returns a Research object that represents the research service for a workbook. Read-only.
RevisionNumber | Returns the number of times the workbook has been saved while open as a shared list. If the workbook is open in exclusive mode, this property returns 0 (zero). Read-only Long.
Saved | True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
SaveLinkValues | True if Microsoft Excel saves external link values with the workbook. Read/write Boolean.
ServerPolicy | Returns a ServerPolicy object that represents a policy specified for a workbook stored on a server running SharePoint Server 2007 or later. Read-only.
ServerViewableItems | Allows a developer to interact with the list of published objects in the workbook that are shown on the server. Read-only.
SharedWorkspace | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Sheets | Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
ShowConflictHistory | True if the Conflict History worksheet is visible in the workbook that's open as a shared list. Read/write Boolean.
ShowPivotChartActiveFields | This property controls the visibility of the PivotChart Filter Pane. Read/write Boolean.
ShowPivotTableFieldList | True (default) if the PivotTable field list can be shown. Read/write Boolean.
Signatures | Returns the digital signatures for a workbook. Read-only.
SlicerCaches | Returns the SlicerCaches object associated with the workbook. Read-only.
SmartDocument | Returns a SmartDocument object that represents the settings for a smart document solution. Read-only.
Styles | Returns a Styles collection that represents all the styles in the specified workbook. Read-only.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
TableStyles | Returns a TableStyles collection object for the current workbook that refers to the styles used in the current workbook. Read-only.
TemplateRemoveExtData | True if external data references are removed when the workbook is saved as a template. Read/write Boolean.
Theme | Returns the theme applied to the current workbook. Read-only.
UpdateLinks | Returns or sets an XlUpdateLink constant indicating a workbook's setting for updating embedded OLE links. Read/write.
UpdateRemoteReferences | True if Microsoft Excel updates remote references in the workbook. Read/write Boolean.
UserStatus | Returns a 1-based, two-dimensional array that provides information about each user who has the workbook open as a shared list. Read-only Variant.
UseWholeCellCriteria | True if the workbook uses search patterns that match the entire content of a cell. Read-only Boolean.
UseWildcards | True if the workbook enables wildcards for character string comparisons and searching. Read-only Boolean
VBASigned | True if the Visual Basic for Applications project for the specified workbook has been digitally signed. Read-only Boolean.
VBProject | Returns a VBProject object that represents the Visual Basic project in the specified workbook. Read-only.
WebOptions | Returns the WebOptions collection, which contains workbook-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page. Read-only.
Windows | Returns a Windows collection that represents all the windows in the specified workbook. Read-only Windows object.
Worksheets | Returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.
WritePassword | Returns or sets a String for the write password of a workbook. Read/write.
WriteReserved | True if the workbook is write-reserved. Read-only Boolean.
WriteReservedBy | Returns the name of the user who currently has write permission for the workbook. Read-only String.
XmlMaps | Returns an XmlMaps collection that represents the schema maps that have been added to the specified workbook. Read-only.
XmlNamespaces | Returns an XmlNamespaces collection that represents the XML namespaces contained in the specified workbook. Read-only.


Workbook Properties (Excel)

 Copy code hover
[image]

Workbook Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AccuracyVersion | Specifies whether certain worksheet functions use the latest accuracy algorithms to calculate their results. Read/write
ActiveChart | Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActiveSheet | Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveSlicer | Returns an object that represents the active slicer in the active workbook or in the specified workbook. Returns Nothing if no slicer is active. Read-only.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoUpdateFrequency | Returns or sets the number of minutes between automatic updates to the shared workbook. Read/write Long.
AutoUpdateSaveChanges | True if current changes to the shared workbook are posted to other users whenever the workbook is automatically updated. False if changes aren't posted (this workbook is still synchronized with changes made by other users). The default value is True. Read/write Boolean.
BuiltinDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified workbook. Read-only.
CalculationVersion | Returns the information about the version of Excel that the workbook was last fully recalculated by. Read-only Long.
CaseSensitive | True if the workbook distinguishes between upper and lower case when comparing content. Read-only Boolean
ChangeHistoryDuration | Returns or sets the number of days shown in the shared workbook's change history. Read/write Long.
ChartDataPointTrack | True will cause all charts in the current document to track the actual data point to which it's attached. False will revert back to tracking the index of the data point. Boolean Read/Write
Charts | Returns a Sheets collection that represents all the chart sheets in the specified workbook.
CheckCompatibility | Controls whether or not the compatibility checker is run automatically when the workbook is saved. Read/write Boolean.
CodeName | Returns the code name for the object. Read-only String.
Colors | Returns or sets colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Variant.
CommandBars | Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.
ConflictResolution | Returns or sets the way conflicts are to be resolved whenever a shared workbook is updated. Read/write XlSaveConflictResolution.
Connections | The Connections property establishes a connection between the workbook and an ODBC or an OLEDB data source and refreshes the data without prompting the user. Read-only.
ConnectionsDisabled | Disables the external connections or links in the workbook. Read-only
Container | Returns the object that represents the container application for the specified OLE object. Read-only Object.
ContentTypeProperties | Returns a MetaProperties collection that describes the metadata stored in the workbook. Read-only.
CreateBackup | True if a backup file is created when this file is saved. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomDocumentProperties | Returns or sets a DocumentProperties collection that represents all the custom document properties for the specified workbook.
CustomViews | Returns a CustomViews collection that represents all the custom views for the workbook.
CustomXMLParts | Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.
Date1904 | True if the workbook uses the 1904 date system. Read/write Boolean.
DefaultPivotTableStyle | Specifies the table style from the TableStyles collection that is used as the default style for PivotTables. Read/write.
DefaultSlicerStyle | Specifies the style from the TableStyles object that is used as the default style for slicers. Read/write.
DefaultTableStyle | Specifies the table style from the TableStyles collection that is used as the default TableStyle. Read/write Variant.
DefaultTimelineStyle | The name of the default slicer style of the workbook. Variant. Read/Write
DisplayDrawingObjects | Returns or sets how shapes are displayed. Read/write Long.
DisplayInkComments | A Boolean value that determines whether ink comments are displayed in the workbook. Read/write Boolean.
DocumentInspectors | Returns a DocumentInspectors collection that represents the Document Inspector modules for the specified workbook. Read-only.
DocumentLibraryVersions | Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared workbook that has versioning enabled and that is stored in a document library on a server.
DoNotPromptForConvert | Returns or sets if the user should be prompted to convert the workbook if the workbook contains features that are not supported by versions of Excel earlier than Excel 2007. Read/write Boolean.
EnableAutoRecover | Saves changed files, of all formats, on a timed interval. Read/write Boolean.
EncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Office Excel 2007 uses when encrypting documents. Read/write.
EnvelopeVisible | True if the e-mail composition header and the envelope toolbar are both visible. Read/write Boolean.
Excel4IntlMacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.
Excel4MacroSheets | Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.
Excel8CompatibilityMode | The Excel8CompatibilityMode property provides developers with a way to check if the workbook is in compatibility mode. Read-only Boolean.
FileFormat | Returns the file format and/or type of the workbook. Read-only XlFileFormat.
Final | Returns or sets a Boolean that indicates whether a workbook is final. Read/write Boolean.
ForceFullCalculation | Returns or sets the specified workbook to forced calculation mode. Read/write.
FullName | Returns the name of the object, including its path on disk, as a string. Read-only String.
FullNameURLEncoded | Returns a String indicating the name of the object, including its path on disk, as a string. Read-only.
HasPassword | True if the workbook has a protection password. Read-only Boolean.
HasVBProject | Returns a Boolean that represents whether a workbook has an attached Microsoft Visual Basic for Applications project. Read-only Boolean.
HighlightChangesOnScreen | True if changes to the shared workbook are highlighted on-screen. Read/write Boolean.
IconSets | This property is used to filter data in a workbook based on a cell icon from the IconSet collection. Read-only.
InactiveListBorderVisible | A Boolean value that specifies whether list borders are visible when a list is not active. Returns True if the border is visible. Read/write Boolean.
IsAddin | True if the workbook is running as an add-in. Read/write Boolean.
IsInplace | True if the specified workbook is being edited in place. False if the workbook has been opened in Microsoft Excel for editing. Read-only Boolean.
KeepChangeHistory | True if change tracking is enabled for the shared workbook. Read/write Boolean.
ListChangesOnNewSheet | True if changes to the shared workbook are shown on a separate worksheet. Read/write Boolean.
Mailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
Model | Returns the top level Model object which is the one Data Model for the workbook. Read-only
MultiUserEditing | True if the workbook is open as a shared list. Read-only Boolean.
Name | Returns a String value that represents the name of the object.
Names | Returns a Names collection that represents all the names in the specified workbook (including all worksheet-specific names). Read-only Names object.
Parent | Returns the parent object for the specified object. Read-only.
Password | Returns or sets the password that must be supplied to open the specified workbook. Read/write String.
PasswordEncryptionAlgorithm | Returns a String indicating the algorithm Microsoft Excel uses to encrypt passwords for the specified workbook. Read-only.
PasswordEncryptionFileProperties | True if Microsoft Excel encrypts file properties for the specified password-protected workbook. Read-only Boolean.
PasswordEncryptionKeyLength | Returns a Long indicating the key length of the algorithm Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.
PasswordEncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.
Path | Returns a String that represents the complete path to the workbook/file that this workbook object respresents.
Permission | Returns a Permission object that represents the permission settings in the specified workbook.
PersonalViewListSettings | True if filter and sort settings for lists are included in the user's personal view of the shared workbook. Read/write Boolean.
PersonalViewPrintSettings | True if print settings are included in the user's personal view of the shared workbook. Read-write Boolean.
PivotTables | Returns an object that represents a collection of all the PivotTable reports on a worksheet. Read-only.
PrecisionAsDisplayed | True if calculations in this workbook will be done using only the precision of the numbers as they're displayed. Read/write Boolean.
ProtectStructure | True if the order of the sheets in the workbook is protected. Read-only Boolean.
ProtectWindows | True if the windows of the workbook are protected. Read-only Boolean.
PublishObjects | Returns the PublishObjects collection. Read-only.
ReadOnly | Returns True if the object has been opened as read-only. Read-only Boolean.
ReadOnlyRecommended | True if the workbook was saved as read-only recommended. Read-only Boolean.
RemovePersonalInformation | True if personal information can be removed from the specified workbook. The default value is False. Read/write Boolean.
Research | Returns a Research object that represents the research service for a workbook. Read-only.
RevisionNumber | Returns the number of times the workbook has been saved while open as a shared list. If the workbook is open in exclusive mode, this property returns 0 (zero). Read-only Long.
Saved | True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
SaveLinkValues | True if Microsoft Excel saves external link values with the workbook. Read/write Boolean.
ServerPolicy | Returns a ServerPolicy object that represents a policy specified for a workbook stored on a server running SharePoint Server 2007 or later. Read-only.
ServerViewableItems | Allows a developer to interact with the list of published objects in the workbook that are shown on the server. Read-only.
SharedWorkspace | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Sheets | Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
ShowConflictHistory | True if the Conflict History worksheet is visible in the workbook that's open as a shared list. Read/write Boolean.
ShowPivotChartActiveFields | This property controls the visibility of the PivotChart Filter Pane. Read/write Boolean.
ShowPivotTableFieldList | True (default) if the PivotTable field list can be shown. Read/write Boolean.
Signatures | Returns the digital signatures for a workbook. Read-only.
SlicerCaches | Returns the SlicerCaches object associated with the workbook. Read-only.
SmartDocument | Returns a SmartDocument object that represents the settings for a smart document solution. Read-only.
Styles | Returns a Styles collection that represents all the styles in the specified workbook. Read-only.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
TableStyles | Returns a TableStyles collection object for the current workbook that refers to the styles used in the current workbook. Read-only.
TemplateRemoveExtData | True if external data references are removed when the workbook is saved as a template. Read/write Boolean.
Theme | Returns the theme applied to the current workbook. Read-only.
UpdateLinks | Returns or sets an XlUpdateLink constant indicating a workbook's setting for updating embedded OLE links. Read/write.
UpdateRemoteReferences | True if Microsoft Excel updates remote references in the workbook. Read/write Boolean.
UserStatus | Returns a 1-based, two-dimensional array that provides information about each user who has the workbook open as a shared list. Read-only Variant.
UseWholeCellCriteria | True if the workbook uses search patterns that match the entire content of a cell. Read-only Boolean.
UseWildcards | True if the workbook enables wildcards for character string comparisons and searching. Read-only Boolean
VBASigned | True if the Visual Basic for Applications project for the specified workbook has been digitally signed. Read-only Boolean.
VBProject | Returns a VBProject object that represents the Visual Basic project in the specified workbook. Read-only.
WebOptions | Returns the WebOptions collection, which contains workbook-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page. Read-only.
Windows | Returns a Windows collection that represents all the windows in the specified workbook. Read-only Windows object.
Worksheets | Returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.
WritePassword | Returns or sets a String for the write password of a workbook. Read/write.
WriteReserved | True if the workbook is write-reserved. Read-only Boolean.
WriteReservedBy | Returns the name of the user who currently has write permission for the workbook. Read-only String.
XmlMaps | Returns an XmlMaps collection that represents the schema maps that have been added to the specified workbook. Read-only.
XmlNamespaces | Returns an XmlNamespaces collection that represents the XML namespaces contained in the specified workbook. Read-only.


Workbook.AccuracyVersion Property (Excel)

 Copy code hover
[image]

Workbook.AccuracyVersion Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether certain worksheet functions use the latest accuracy algorithms to calculate their results. Read/write

Version Information

Version Added: Excel 2010

Syntax

expression .AccuracyVersion

expression A variable that represents a Workbook object.

Return Value

Integer

Remarks

By default, some of the worksheet functions from Excel 2007 and earlier versions of Excel use new algorithms that increase their accuracy. However, in some cases, the new algorithms decrease the performance of these functions relative to their performance in Excel 2007 and earlier versions of Excel. To specify that these worksheet functions use the older algorithms to increase their performance, set the AccuracyVersion property to 1. The following table describes the possible settings for the AccuracyVersion property.

Setting | Description
0 | Use the latest, most accurate algorithms (default)
1 | Use Excel 2007 or earlier version algorithms
2 | Use Excel 2010 algorithms
Note Note

Setting the AccuracyVersion property to a value other than 0, 1, or 2 will result in undefined behavior.

The following table summarizes which functions are affected by setting the AccuracyVersion property to 1. The functions that are listed in the "Functions not affected" column will always use the latest accuracy algorithms or were not changed in Excel 2010. For function names that include a period (.) in their names, to determine the name of the corresponding function implemented in VBA as a method of the WorksheetFunction object, substitute the underscore character ( _ ) for the period. For example, the VBA method that corresponds to the BETA.DIST function is the Beta_Dist method.

Example

The following example sets the affected worksheet functions to use the older algorithms to calculate their results.

VBA Copy code Copy code
ActiveWorkbook.AccuracyVersion = 1

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ActiveChart Property (Excel)

 Copy code hover
[image]

Workbook.ActiveChart Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.

Syntax

expression .ActiveChart

expression A variable that represents a Workbook object.

Remarks

If you don't specify an object qualifier, this property returns the active chart in the active workbook.

Example

This example turns on the legend for the active chart.

VBA Copy code Copy code
ActiveChart.HasLegend = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ActiveSheet Property (Excel)

 Copy code hover
[image]

Workbook.ActiveSheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.

Syntax

expression .ActiveSheet

expression A variable that represents a Workbook object.

Remarks

If you don't specify an object qualifier, this property returns the active sheet in the active workbook.

If a workbook appears in more than one window, the ActiveSheet property may be different in different windows.

Example

This example displays the name of the active sheet.

VBA Copy code Copy code
MsgBox "The name of the active sheet is " & ActiveSheet.Name

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ActiveSlicer Property (Excel)

 Copy code hover
[image]

Workbook.ActiveSlicer Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents the active slicer in the active workbook or in the specified workbook. Returns Nothing if no slicer is active. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .ActiveSlicer

expression A variable that represents a Workbook object.

Return Value

Slicer

Remarks

If you do not specify a Workbook object, this property returns the active slicer in the active workbook.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Application Property (Excel)

 Copy code hover
[image]

Workbook.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Workbook object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AutoUpdateFrequency Property (Excel)

 Copy code hover
[image]

Workbook.AutoUpdateFrequency Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of minutes between automatic updates to the shared workbook. Read/write Long.

Syntax

expression .AutoUpdateFrequency

expression A variable that represents a Workbook object.

Remarks

The AutoUpdateFrequency property must be set to a value from 5 to 1440 for this property to take effect.

Example

This example causes the shared workbook to be automatically updated every five minutes.

VBA Copy code Copy code
ActiveWorkbook.AutoUpdateFrequency = 5
Note Note

Workbook sharing must be enabled or you may see the following error.
Method 'AutoUpdateFrequency' of object '_Workbook' failed

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AutoUpdateSaveChanges Property (Excel)

 Copy code hover
[image]

Workbook.AutoUpdateSaveChanges Property (Excel)
See also Send feedback

Published: July 16, 2012

True if current changes to the shared workbook are posted to other users whenever the workbook is automatically updated. False if changes aren't posted (this workbook is still synchronized with changes made by other users). The default value is True. Read/write Boolean.

Syntax

expression .AutoUpdateSaveChanges

expression A variable that represents a Workbook object.

Remarks

The AutoUpdateFrequency property must be set to a value from 5 to 1440 for this property to take effect.

Example

This example causes changes to the shared workbook to be posted to other users whenever the workbook is automatically updated.

VBA Copy code Copy code
ActiveWorkbook.AutoUpdateSaveChanges = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.BuiltinDocumentProperties Property (Excel)

 Copy code hover
[image]

Workbook.BuiltinDocumentProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DocumentProperties collection that represents all the built-in document properties for the specified workbook. Read-only.

Syntax

expression .BuiltinDocumentProperties

expression A variable that represents a Workbook object.

Remarks

This property returns the entire collection of built-in document properties. Use the Item method to return a single member of the collection (a DocumentProperty object) by specifying either the name of the property or the collection index (as a number).

You can refer to document properties either by index value or by name. The following list shows the available built-in document property names:

Title Subject Author Keywords Comments Template Last Author Revision Number Application Name Last Print Date

Creation Date Last Save Time Total Editing Time Number of Pages Number of Words Number of Characters Security Category Format Manager

Company Number of Bytes Number of Lines Number of Paragraphs Number of Slides Number of Notes Number of Hidden Slides Number of Multimedia Clips Hyperlink Base Number of Characters (with spaces)

Container applications aren't required to define values for every built-in document property. If Microsoft Excel doesn't define a value for one of the built-in document properties, reading the Value property for that document property causes an error.

Because the Item method is the default method for the DocumentProperties collection, the following statements are identical:

Copy code Copy code
BuiltinDocumentProperties.Item(1)
BuiltinDocumentProperties(1)

Use the CustomDocumentProperties property to return the collection of custom document properties.

Example

This example displays the names of the built-in document properties as a list on worksheet one.

VBA Copy code Copy code
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
    Cells(rw, 1).Value = p.Name
    rw = rw + 1
Next

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CalculationVersion Property (Excel)

 Copy code hover
[image]

Workbook.CalculationVersion Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the information about the version of Excel that the workbook was last fully recalculated by. Read-only Long.

Syntax

expression .CalculationVersion

expression A variable that represents a Workbook object.

Remarks

If the workbook was saved in an earlier version of Excel and if the workbook hasn't been fully recalculated, then this property returns 0.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CaseSensitive Property (Excel)

 Copy code hover
[image]

Workbook.CaseSensitive Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook distinguishes between upper and lower case when comparing content. Read-only Boolean

Version information

Version Added: Excel 2013

Syntax

expression .CaseSensitive

expression A variable that represents a Workbook object.

Property value

BOOL

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ChangeHistoryDuration Property (Excel)

 Copy code hover
[image]

Workbook.ChangeHistoryDuration Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of days shown in the shared workbook's change history. Read/write Long.

Syntax

expression .ChangeHistoryDuration

expression A variable that represents a Workbook object.

Remarks

Any changes in the change history older than the setting for this property are removed when the workbook is closed.

Example

This example sets the number of days shown in the change history for the active workbook if change tracking is enabled. Any changes in the change history older than the setting for this property are removed when the workbook is closed.

VBA Copy code Copy code
With ActiveWorkbook
 If .KeepChangeHistory Then
 .ChangeHistoryDuration = 7
 End If
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ChartDataPointTrack Property (Excel)

 Copy code hover
[image]

Workbook.ChartDataPointTrack Property (Excel)
See also Send feedback

Published: July 16, 2012

True will cause all charts in the current document to track the actual data point to which it's attached. False will revert back to tracking the index of the data point. Boolean Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .ChartDataPointTrack

expression A variable that represents a Workbook object.

Property value

BOOL

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Charts Property (Excel)

 Copy code hover
[image]

Workbook.Charts Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the chart sheets in the specified workbook.

Syntax

expression .Charts

expression A variable that represents a Workbook object.

Example

This example deletes every chart sheet in the active workbook.

Note Note

For the following sample code to work you must have a chart sheet in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Charts.Delete

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CheckCompatibility Property (Excel)

 Copy code hover
[image]

Workbook.CheckCompatibility Property (Excel)
See also Send feedback

Published: July 16, 2012

Controls whether or not the compatibility checker is run automatically when the workbook is saved. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .CheckCompatibility

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CodeName Property (Excel)

 Copy code hover
[image]

Workbook.CodeName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the code name for the object. Read-only String.

Syntax

expression .CodeName

expression An expression that returns a Workbook object.

Remarks

The value that you see in the cell to the right of (Name) in the Properties window is the code name of the selected object. At design time, you can change the code name of an object by changing this value. You cannot programmatically change this property at run time.

The code name for an object can be used in place of an expression that returns the object. For example, if the code name for worksheet one is "Sheet1", the following expressions are identical:

VBA Copy code Copy code
Worksheets(1).Range("a1")
Sheet1.Range("a1")

It's possible for the sheet name to be different from the code name. When you create a sheet, the sheet name and code name are the same, but changing the sheet name doesn't change the code name, and changing the code name (using the Properties window in the Visual Basic Editor) doesn't change the sheet name.

Example

This example displays the code name for worksheet one.

VBA Copy code Copy code
MsgBox Worksheets(1).CodeName

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Colors Property (Excel)

 Copy code hover
[image]

Workbook.Colors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Variant.

Syntax

expression .Colors(Index)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The color number (from 1 to 56). If this argument isn't specified, this method returns an array that contains all 56 of the colors in the palette.

Example

This example sets the color palette for the active workbook to be the same as the palette for Book2.xls.

VBA Copy code Copy code
ActiveWorkbook.Colors = Workbooks("BOOK2.XLS").Colors

This example sets color five in the color palette for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Colors(5) = RGB(255, 0, 0)

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CommandBars Property (Excel)

 Copy code hover
[image]

Workbook.CommandBars Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.

Syntax

expression .CommandBars

expression An expression that returns a Workbook object.

Remarks

Used with the Application object, this property returns the set of built-in and custom command bars available to the application.

When a workbook is embedded in another application and activated by the user by double-clicking the workbook, using this property with a Workbook object returns the set of Microsoft Excel command bars available within the other application. At all other times, using this property with a Workbook object returns Nothing.

There is no programmatic way to return the set of command bars attached to a workbook.

Example

This example deletes all custom command bars that aren't visible.

VBA Copy code Copy code
For Each bar In Application.CommandBars
    If Not bar.BuiltIn And Not bar.Visible Then bar.Delete
Next

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ConflictResolution Property (Excel)

 Copy code hover
[image]

Workbook.ConflictResolution Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the way conflicts are to be resolved whenever a shared workbook is updated. Read/write XlSaveConflictResolution.

Syntax

expression .ConflictResolution

expression A variable that represents a Workbook object.

Remarks

XlSaveConflictResolution can be one of these XlSaveConflictResolution constants.

xlLocalSessionChanges. The local user's changes are always accepted.

xlOtherSessionChanges. The local user's changes are always rejected.

xlUserResolution. A dialog box asks the user to resolve the conflict.

Example

This example causes the local user's changes to be accepted whenever there's a conflict in the shared workbook.

VBA Copy code Copy code
ActiveWorkbook.ConflictResolution = xlLocalSessionChanges

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Connections Property (Excel)

 Copy code hover
[image]

Workbook.Connections Property (Excel)
See also Send feedback

Published: July 16, 2012

The Connections property establishes a connection between the workbook and an ODBC or an OLEDB data source and refreshes the data without prompting the user. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Connections

expression A variable that represents a Workbook object.

Example

The following exmaple rereshed the OBDC and OLEDB connections of the active workbook.

Copy code Copy code
ActiveWorkbook.Connections(1).ODBCConnection.Refresh
ActiveWorkbook.Connections(1).OLEDBConnection.Refresh

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ConnectionsDisabled Property (Excel)

 Copy code hover
[image]

Workbook.ConnectionsDisabled Property (Excel)
See also Send feedback

Published: July 16, 2012

Disables the external connections or links in the workbook. Read-only

Version Information

Version Added: Excel 2007

Syntax

expression .ConnectionsDisabled

expression A variable that represents a Workbook object.

Return Value

Boolean

Example

Disables the external link when the workbook is opened.

VBA Copy code Copy code
Private Sub Workbook_Open()
 ThisWorkbook.ConnectionsDisabled
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Container Property (Excel)

 Copy code hover
[image]

Workbook.Container Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the object that represents the container application for the specified OLE object. Read-only Object.

Syntax

expression .Container

expression A variable that represents a Workbook object.

Remarks

This property provides a way to access the object model of the container application if an Excel workbook is opened within a host application such as Microsoft Internet Explorer.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ContentTypeProperties Property (Excel)

 Copy code hover
[image]

Workbook.ContentTypeProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a MetaProperties collection that describes the metadata stored in the workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ContentTypeProperties

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CreateBackup Property (Excel)

 Copy code hover
[image]

Workbook.CreateBackup Property (Excel)
See also Send feedback

Published: July 16, 2012

True if a backup file is created when this file is saved. Read-only Boolean.

Syntax

expression .CreateBackup

expression A variable that represents a Workbook object.

Example

This example displays a message if a backup file is created when the active workbook is saved.

VBA Copy code Copy code
If ActiveWorkbook.CreateBackup = True Then
 MsgBox "Remember, there is a backup copy of this workbook"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Creator Property (Excel)

 Copy code hover
[image]

Workbook.Creator Property (Excel)
See also Send feedback

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Workbook object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CustomDocumentProperties Property (Excel)

 Copy code hover
[image]

Workbook.CustomDocumentProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a DocumentProperties collection that represents all the custom document properties for the specified workbook.

Syntax

expression .CustomDocumentProperties

expression A variable that represents a Workbook object.

Remarks

This property returns the entire collection of custom document properties. Use the Item method to return a single member of the collection (a DocumentProperty object) by specifying either the name of the property or the collection index (as a number).

Because the Item method is the default method for the DocumentProperties collection, the following statements are identical:

CustomDocumentProperties.Item("Complete")

CustomDocumentProperties("Complete")

Use the BuiltinDocumentProperties property to return the collection of built-in document properties.

Properties of type msoPropertyTypeString cannot exceed 255 characters in length.

Example

This example displays the names and values of the custom document properties as a list on worksheet one.

VBA Copy code Copy code
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.CustomDocumentProperties
    Cells(rw, 1).Value = p.Name
    Cells(rw, 2).Value = p.Value
    rw = rw + 1
Next

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CustomViews Property (Excel)

 Copy code hover
[image]

Workbook.CustomViews Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CustomViews collection that represents all the custom views for the workbook.

Syntax

expression .CustomViews

expression A variable that represents a Workbook object.

Example

This example creates a new custom view named "Summary" in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.CustomViews.Add "Summary", True, True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CustomXMLParts Property (Excel)

 Copy code hover
[image]

Workbook.CustomXMLParts Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .CustomXMLParts

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Date1904 Property (Excel)

 Copy code hover
[image]

Workbook.Date1904 Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook uses the 1904 date system. Read/write Boolean.

Syntax

expression .Date1904

expression A variable that represents a Workbook object.

Example

This example causes Microsoft Excel to use the 1904 date system for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Date1904 = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DefaultPivotTableStyle Property (Excel)

 Copy code hover
[image]

Workbook.DefaultPivotTableStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the table style from the TableStyles collection that is used as the default style for PivotTables. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .DefaultPivotTableStyle

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DefaultSlicerStyle Property (Excel)

 Copy code hover
[image]

Workbook.DefaultSlicerStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the style from the TableStyles object that is used as the default style for slicers. Read/write.

Version Information

Version Added: Excel 2010

Syntax

expression .DefaultSlicerStyle

expression A variable that represents a Workbook object.

Return Value

Variant

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DefaultTableStyle Property (Excel)

 Copy code hover
[image]

Workbook.DefaultTableStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies the table style from the TableStyles collection that is used as the default TableStyle. Read/write Variant.

Version Information

Version Added: Excel 2007

Syntax

expression .DefaultTableStyle

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DefaultTimelineStyle Property (Excel)

 Copy code hover
[image]

Workbook.DefaultTimelineStyle Property (Excel)
See also Send feedback

Published: July 16, 2012

The name of the default slicer style of the workbook. Variant. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .DefaultTimelineStyle

expression A variable that represents a Workbook Object (Excel) object.

Property value

VARIANT

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DisplayDrawingObjects Property (Excel)

 Copy code hover
[image]

Workbook.DisplayDrawingObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets how shapes are displayed. Read/write Long.

Syntax

expression .DisplayDrawingObjects

expression A variable that represents a Workbook object.

Remarks

Constant | Description
xlDisplayShapes | Show all shapes.
xlPlaceholders | Show only placeholders.
xlHide | Hide all shapes.

Example

This example hides all the shapes in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.DisplayDrawingObjects = xlHide

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DisplayInkComments Property (Excel)

 Copy code hover
[image]

Workbook.DisplayInkComments Property (Excel)
See also Send feedback

Published: July 16, 2012

A Boolean value that determines whether ink comments are displayed in the workbook. Read/write Boolean.

Syntax

expression .DisplayInkComments

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DocumentInspectors Property (Excel)

 Copy code hover
[image]

Workbook.DocumentInspectors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DocumentInspectors collection that represents the Document Inspector modules for the specified workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .DocumentInspectors

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DocumentLibraryVersions Property (Excel)

 Copy code hover
[image]

Workbook.DocumentLibraryVersions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared workbook that has versioning enabled and that is stored in a document library on a server.

Syntax

expression .DocumentLibraryVersions

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DoNotPromptForConvert Property (Excel)

 Copy code hover
[image]

Workbook.DoNotPromptForConvert Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if the user should be prompted to convert the workbook if the workbook contains features that are not supported by versions of Excel earlier than Excel 2007. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DoNotPromptForConvert

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.EnableAutoRecover Property (Excel)

 Copy code hover
[image]

Workbook.EnableAutoRecover Property (Excel)
See also Send feedback

Published: July 16, 2012

Saves changed files, of all formats, on a timed interval. Read/write Boolean.

Syntax

expression .EnableAutoRecover

expression A variable that represents a Workbook object.

Remarks

If Microsoft Excel fails, the system fails, or if the system is improperly shut down (not allowing Excel to save the changed files), the backed up files are opened and the user has an opportunity to save changes that otherwise would have been lost. When the user restarts Excel, a document recovery window opens, giving the user an option to recover the files they were working on. Setting this property to True (default) enables this feature.

Example

The following example checks the setting of the AutoRecover feature and if not enabled, Excel enables it and then notifies the user.

VBA Copy code Copy code
Sub UseAutoRecover()

 ' Check to see if the feature is enabled, if not, enable it.
 If ActiveWorkbook.EnableAutoRecover = False Then
 ActiveWorkbook.EnableAutoRecover = True
 MsgBox "The AutoRecover feature has been enabled."
 Else
 MsgBox "The AutoRecover feature is already enabled."
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.EncryptionProvider Property (Excel)

 Copy code hover
[image]

Workbook.EncryptionProvider Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String specifying the name of the algorithm encryption provider that Microsoft Office Excel 2007 uses when encrypting documents. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .EncryptionProvider

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.EnvelopeVisible Property (Excel)

 Copy code hover
[image]

Workbook.EnvelopeVisible Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the e-mail composition header and the envelope toolbar are both visible. Read/write Boolean.

Syntax

expression .EnvelopeVisible

expression A variable that represents a Workbook object.

Example

This example checks to see whether the e-mail composition header and the envelope toolbar are visible in the first workbook. If they are visible, the example then sets the variable strSubject to the text of the e-mail subject line.

VBA Copy code Copy code
If Workbooks(1).EnvelopeVisible = True Then
 strSubject = "Please read: Review immediately"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Excel4IntlMacroSheets Property (Excel)

 Copy code hover
[image]

Workbook.Excel4IntlMacroSheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. Read-only.

Syntax

expression .Excel4IntlMacroSheets

expression A variable that represents a Workbook object.

Example

This example displays the number of Microsoft Excel 4.0 international macro sheets in the active workbook.

VBA Copy code Copy code
MsgBox "There are " & _
 ActiveWorkbook.Excel4IntlMacroSheets.Count & _
 " Microsoft Excel 4.0 international macro sheets" & _
 " in this workbook."

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Excel4MacroSheets Property (Excel)

 Copy code hover
[image]

Workbook.Excel4MacroSheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. Read-only.

Syntax

expression .Excel4MacroSheets

expression A variable that represents a Workbook object.

Remarks

Using this property with the Application object or without an object qualifier is equivalent to using ActiveWorkbook.Excel4MacroSheets.

Example

This example displays the number of Microsoft Excel 4.0 macro sheets in the active workbook.

VBA Copy code Copy code
MsgBox "There are " & ActiveWorkbook.Excel4MacroSheets.Count & _
 " Microsoft Excel 4.0 macro sheets in this workbook."

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Excel8CompatibilityMode Property (Excel)

 Copy code hover
[image]

Workbook.Excel8CompatibilityMode Property (Excel)
See also Send feedback

Published: July 16, 2012

The Excel8CompatibilityMode property provides developers with a way to check if the workbook is in compatibility mode. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Excel8CompatibilityMode

expression A variable that represents a Workbook object.

Remarks

In compatibility mode, certain functionality is disabled or functions differently. For example, in Excel 2007 or later there are more rows and columns available as compared to the earlier versions of Excel. Also structured referencing is available in Excel 2007 or later.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.FileFormat Property (Excel)

 Copy code hover
[image]

Workbook.FileFormat Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the file format and/or type of the workbook. Read-only XlFileFormat.

Syntax

expression .FileFormat

expression A variable that represents a Workbook object.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example saves the active workbook in Normal file format if its current file format is Excel 97/95.

VBA Copy code Copy code
If ActiveWorkbook.FileFormat = xlExcel9795 Then
 ActiveWorkbook.SaveAs fileFormat:=xlExcel12
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Final Property (Excel)

 Copy code hover
[image]

Workbook.Final Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that indicates whether a workbook is final. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .Final

expression A variable that represents a Workbook object.

Remarks

Setting the value to True marks the workbook as final, notifies recipients (if any) that the workbook is final, and sets the workbook to read-only.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ForceFullCalculation Property (Excel)

 Copy code hover
[image]

Workbook.ForceFullCalculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the specified workbook to forced calculation mode. Read/write.

Version Information

Version Added: Excel 2007

Syntax

expression .ForceFullCalculation

expression An expression that returns a Workbook object.

Return Value

Boolean

Remarks

If the workbook is in the forced calculation mode, dependencies are ignored and all worksheets are marked to calculate fully every time a calculation is triggered. This setting remains in effect until Excel is restarted.

Setting the ForceFullCalculation property to True will increase the calculation times for data tables in proportion to the size of the data table. Given an NxM data table, the calculation time will increase by about base time x (NxM), so that a 3x4 data table may take about 12 times as long to calculate if this property is set to True.

Example

The following example sets the active workbook to forced calculation mode.

VBA Copy code Copy code
ActiveWorkbook.ForceFullCalculation = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.FullName Property (Excel)

 Copy code hover
[image]

Workbook.FullName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the object, including its path on disk, as a string. Read-only String.

Syntax

expression .FullName

expression A variable that represents a Workbook object.

Example

This example displays the path and file name of the active workbook (assuming that the workbook has been saved).

VBA Copy code Copy code
MsgBox ActiveWorkbook.FullName

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.FullNameURLEncoded Property (Excel)

 Copy code hover
[image]

Workbook.FullNameURLEncoded Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String indicating the name of the object, including its path on disk, as a string. Read-only.

Syntax

expression .FullNameURLEncoded

expression A variable that represents a Workbook object.

Example

In this example, Microsoft Excel displays the path and file name of the active workbook to the user.

VBA Copy code Copy code
Sub UseCanonical()

 ' Display the full path to user.
 MsgBox ActiveWorkbook.FullNameURLEncoded

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.HasPassword Property (Excel)

 Copy code hover
[image]

Workbook.HasPassword Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook has a protection password. Read-only Boolean.

Syntax

expression .HasPassword

expression A variable that represents a Workbook object.

Remarks

You can assign a protection password to a workbook by using the SaveAs method.

Example

This example displays a message if the active workbook has a protection password.

VBA Copy code Copy code
If ActiveWorkbook.HasPassword = True Then
 MsgBox "Remember to obtain the workbook password" & Chr(13) & _
 " from the Network Administrator."
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.HasVBProject Property (Excel)

 Copy code hover
[image]

Workbook.HasVBProject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether a workbook has an attached Microsoft Visual Basic for Applications project. Read-only Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .HasVBProject

expression A variable that represents a Workbook object.

Remarks

This property is most useful in programmatically determining whether a workbook needs to be saved into a macro-enabled file format. If saved in another format, macros and code projects contained within the document may be lost.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.HighlightChangesOnScreen Property (Excel)

 Copy code hover
[image]

Workbook.HighlightChangesOnScreen Property (Excel)
See also Send feedback

Published: July 16, 2012

True if changes to the shared workbook are highlighted on-screen. Read/write Boolean.

Syntax

expression .HighlightChangesOnScreen

expression A variable that represents a Workbook object.

Example

This example highlights changes to the shared workbook.

VBA Copy code Copy code
ThisWorkbook.HighlightChangesOnScreen

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.IconSets Property (Excel)

 Copy code hover
[image]

Workbook.IconSets Property (Excel)
See also Send feedback

Published: July 16, 2012

This property is used to filter data in a workbook based on a cell icon from the IconSet collection. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .IconSets

expression A variable that represents a Workbook object.

Example

In the following example, data is filtered by a cell icon.

Copy code Copy code
Selection.AutoFilter Field:=1, Criteria1:=ActiveWorkbook.IconSets(xl3Arrows).Item(1), Operator:=xlFilterIcon

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.InactiveListBorderVisible Property (Excel)

 Copy code hover
[image]

Workbook.InactiveListBorderVisible Property (Excel)
See also Send feedback

Published: July 16, 2012

A Boolean value that specifies whether list borders are visible when a list is not active. Returns True if the border is visible. Read/write Boolean.

Syntax

expression .InactiveListBorderVisible

expression A variable that represents a Workbook object.

Remarks

Setting this property will affect all the lists that are on the worksheet.

Example

The following example hides the borders of inactive lists in the workbook.

VBA Copy code Copy code
Sub HideListBorders()

 ActiveWorkbook.InactiveListBorderVisible = False

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.IsAddin Property (Excel)

 Copy code hover
[image]

Workbook.IsAddin Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook is running as an add-in. Read/write Boolean.

Syntax

expression .IsAddin

expression A variable that represents a Workbook object.

Remarks

When you set this property to True, the workbook has the following characteristics:

  • You won't be prompted to save the workbook if changes are made while the workbook is open.

  • The workbook window won't be visible.

  • Any macros in the workbook won't be visible in the Macro dialog box (displayed by pointing to Macro on the Tools menu and clicking Macros).

  • Macros in the workbook can still be run from the Macro dialog box even though they're not visible. In addition, macro names don't need to be qualified with the workbook name.

  • Holding down the SHIFT key when you open the workbook has no effect.

Example

This example runs a section of code if the workbook is an add-in.

VBA Copy code Copy code
If ThisWorkbook.IsAddin Then
 ' this code runs when the workbook is an add-in
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.IsInplace Property (Excel)

 Copy code hover
[image]

Workbook.IsInplace Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified workbook is being edited in place. False if the workbook has been opened in Microsoft Excel for editing. Read-only Boolean.

Syntax

expression .IsInplace

expression A variable that represents a Workbook object.

Example

This example indicates whether the workbook was opened for editing in place or in Microsoft Excel.

VBA Copy code Copy code
Private Sub Workbook_Open()
 If ThisWorkbook.IsInPlace = True Then
 MsgBox "Editing in place"
 Else
 MsgBox "Editing in Microsoft Excel"
 End If
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.KeepChangeHistory Property (Excel)

 Copy code hover
[image]

Workbook.KeepChangeHistory Property (Excel)
See also Send feedback

Published: July 16, 2012

True if change tracking is enabled for the shared workbook. Read/write Boolean.

Syntax

expression .KeepChangeHistory

expression A variable that represents a Workbook object.

Example

This example sets the number of days shown in the change history for the active workbook if change tracking is enabled.

VBA Copy code Copy code
With ActiveWorkbook
 If .KeepChangeHistory Then
 .ChangeHistoryDuration = 7
 End If
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ListChangesOnNewSheet Property (Excel)

 Copy code hover
[image]

Workbook.ListChangesOnNewSheet Property (Excel)
See also Send feedback

Published: July 16, 2012

True if changes to the shared workbook are shown on a separate worksheet. Read/write Boolean.

Syntax

expression .ListChangesOnNewSheet

expression A variable that represents a Workbook object.

Example

This example shows changes to the shared workbook on a separate worksheet.

VBA Copy code Copy code
With ActiveWorkbook
 .HighlightChangesOptions _
 When:=xlSinceMyLastSave, _
 Who:="Everyone"
 .ListChangesOnNewSheet = True
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Mailer Property (Excel)

 Copy code hover
[image]

Workbook.Mailer Property (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .Mailer

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Model Property (Excel)

 Copy code hover
[image]

Workbook.Model Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the top level Model object which is the one Data Model for the workbook. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Model

expression A variable that represents a Workbook object.

Property value

MODEL

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.MultiUserEditing Property (Excel)

 Copy code hover
[image]

Workbook.MultiUserEditing Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook is open as a shared list. Read-only Boolean.

Syntax

expression .MultiUserEditing

expression A variable that represents a Workbook object.

Remarks

To save a workbook as a shared list, use the SaveAs method. To switch the workbook from shared mode to exclusive mode, use the ExclusiveAccess method.

Example

This example determines whether the active workbook is open in exclusive mode. If it is, the example saves the workbook as a shared list.

VBA Copy code Copy code
If Not ActiveWorkbook.MultiUserEditing Then
 ActiveWorkbook.SaveAs fileName:=ActiveWorkbook.FullName, _
 accessMode:=xlShared
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Name Property (Excel)

 Copy code hover
[image]

Workbook.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Syntax

expression .Name

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Names Property (Excel)

 Copy code hover
[image]

Workbook.Names Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Names collection that represents all the names in the specified workbook (including all worksheet-specific names). Read-only Names object.

Syntax

expression .Names

expression A variable that represents a Workbook object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveWorkbook.Names.

Example

This example defines the name "myName" for cell A1 on Sheet1.

VBA Copy code Copy code
ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
 "=Sheet1!R1C1"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Parent Property (Excel)

 Copy code hover
[image]

Workbook.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Password Property (Excel)

 Copy code hover
[image]

Workbook.Password Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the password that must be supplied to open the specified workbook. Read/write String.

Syntax

expression .Password

expression A variable that represents a Workbook object.

Remarks

Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.

Example

In this example, Microsoft Excel opens a workbook named Password.xls, sets a password for it, and then closes the workbook. This example assumes a file named "Password.xls" exists on the C:\ drive.

VBA Copy code Copy code
Sub UsePassword()

 Dim wkbOne As Workbook

 Set wkbOne = Application.Workbooks.Open("C:\Password.xls")

 wkbOne.Password = InputBox ("Enter Password")
 wkbOne.Close

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PasswordEncryptionAlgorithm Property (Excel)

 Copy code hover
[image]

Workbook.PasswordEncryptionAlgorithm Property (Excel)
See also Send feedback

Returns a String indicating the algorithm Microsoft Excel uses to encrypt passwords for the specified workbook. Read-only.

Syntax

expression .PasswordEncryptionAlgorithm

expression A variable that represents a Workbook object.

Remarks

Use the SetPasswordEncryptionOptions method to specify whether Excel encrypts file properties for password-protected workbooks.

Example

This example sets the password encryption options for the active workbook.

VBA Copy code Copy code
Sub SetPasswordOptions()

 ActiveWorkbook.SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PasswordEncryptionFileProperties Property (Excel)

 Copy code hover
[image]

Workbook.PasswordEncryptionFileProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel encrypts file properties for the specified password-protected workbook. Read-only Boolean.

Syntax

expression .PasswordEncryptionFileProperties

expression A variable that represents a Workbook object.

Remarks

Use the SetPasswordEncryptionOptions method to specify whether Excel encrypts file properties for the specified password-protected workbook.

Example

This example sets the password encryption options if the file properties are not encrypted for password-protected workbooks.

VBA Copy code Copy code
Sub SetPasswordOptions()

 With ActiveWorkbook
 If .PasswordEncryptionFileProperties = False Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PasswordEncryptionKeyLength Property (Excel)

 Copy code hover
[image]

Workbook.PasswordEncryptionKeyLength Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long indicating the key length of the algorithm Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.

Syntax

expression .PasswordEncryptionKeyLength

expression A variable that represents a Workbook object.

Remarks

Use the SetPasswordEncryptionOptions method to specify whether Excel encrypts file properties for the specified password-protected workbook.

Example

This example sets the password encryption options for the specified workbook, if the password encryption key length is less than 56.

VBA Copy code Copy code
Sub SetPasswordOptions()

 With ActiveWorkbook
 If .PasswordEncryptionKeyLength < 56 Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PasswordEncryptionProvider Property (Excel)

 Copy code hover
[image]

Workbook.PasswordEncryptionProvider Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String specifying the name of the algorithm encryption provider that Microsoft Excel uses when encrypting passwords for the specified workbook. Read-only.

Syntax

expression .PasswordEncryptionProvider

expression A variable that represents a Workbook object.

Example

This example sets the password encryption options for the specified workbook, if the file properties are not encrypted for password-protected workbooks.

VBA Copy code Copy code
Sub SetPasswordOptions()

 With ActiveWorkbook
 If .PasswordEncryptionProvider <> "Microsoft RSA SChannel Cryptographic Provider" Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Path Property (Excel)

 Copy code hover
[image]

Workbook.Path Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the complete path to the workbook/file that this workbook object respresents.

Syntax

expression .Path

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Permission Property (Excel)

 Copy code hover
[image]

Workbook.Permission Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Permission object that represents the permission settings in the specified workbook.

Syntax

expression .Permission

expression A variable that represents a Workbook object.

Example

The following example returns the permission settings for the active workbook.

VBA Copy code Copy code
Dim objPermission As Permission

Set objPermission = ActiveWorkbook.Permission

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PersonalViewListSettings Property (Excel)

 Copy code hover
[image]

Workbook.PersonalViewListSettings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if filter and sort settings for lists are included in the user's personal view of the shared workbook. Read/write Boolean.

Syntax

expression .PersonalViewListSettings

expression A variable that represents a Workbook object.

Example

This example removes print settings and filter and sort settings from the user's personal view of workbook two.

VBA Copy code Copy code
With Workbooks(2)
 .PersonalViewListSettings = False
 .PersonalViewPrintSettings = False
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PersonalViewPrintSettings Property (Excel)

 Copy code hover
[image]

Workbook.PersonalViewPrintSettings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if print settings are included in the user's personal view of the shared workbook. Read-write Boolean.

Syntax

expression .PersonalViewPrintSettings

expression A variable that represents a Workbook object.

Example

This example removes print settings and filter and sort settings from the user's personal view of workbook two.

VBA Copy code Copy code
With Workbooks(2)
 .PersonalViewListSettings = False
 .PersonalViewPrintSettings = False
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PivotTables Property (Excel)

 Copy code hover
[image]

Workbook.PivotTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents a collection of all the PivotTable reports on a worksheet. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .PivotTables

expression A variable that represents a Workbook Object (Excel) object.

Returns

PivotTables Object (Excel)

Property value

OBJECT

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PrecisionAsDisplayed Property (Excel)

 Copy code hover
[image]

Workbook.PrecisionAsDisplayed Property (Excel)
See also Send feedback

Published: July 16, 2012

True if calculations in this workbook will be done using only the precision of the numbers as they're displayed. Read/write Boolean.

Syntax

expression .PrecisionAsDisplayed

expression A variable that represents a Workbook object.

Example

This example causes calculations in the active workbook to use only the precision of the numbers as they're displayed.

VBA Copy code Copy code
ActiveWorkbook.PrecisionAsDisplayed = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ProtectStructure Property (Excel)

 Copy code hover
[image]

Workbook.ProtectStructure Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the order of the sheets in the workbook is protected. Read-only Boolean.

Syntax

expression .ProtectStructure

expression A variable that represents a Workbook object.

Example

This example displays a message if the order of the sheets in the active workbook is protected.

VBA Copy code Copy code
If ActiveWorkbook.ProtectStructure = True Then
 MsgBox "Remember, you cannot delete, add, or change " & _
 Chr(13) & _
 "the location of any sheets in this workbook."
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ProtectWindows Property (Excel)

 Copy code hover
[image]

Workbook.ProtectWindows Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the windows of the workbook are protected. Read-only Boolean.

Syntax

expression .ProtectWindows

expression A variable that represents a Workbook object.

Example

This example displays a message if the windows in the active workbook are protected.

VBA Copy code Copy code
If ActiveWorkbook.ProtectWindows = True Then
 MsgBox "Remember, you cannot rearrange any" & _
 " window in this workbook."
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PublishObjects Property (Excel)

 Copy code hover
[image]

Workbook.PublishObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the PublishObjects collection. Read-only.

Syntax

expression .PublishObjects

expression A variable that represents a Workbook object.

Example

This example publishes all static PublishObject objects in the active workbook to the Web page.

VBA Copy code Copy code
Set objPObjs = ActiveWorkbook.PublishObjects
For Each objPO in objPObjs
 If objPO.HtmlType = xlHTMLStatic Then
 objPO.Publish
 End If
Next objPO

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ReadOnly Property (Excel)

 Copy code hover
[image]

Workbook.ReadOnly Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the object has been opened as read-only. Read-only Boolean.

Syntax

expression .ReadOnly

expression A variable that represents a Workbook object.

Example

If the active workbook is read-only, this example saves it as Newfile.xls.

VBA Copy code Copy code
If ActiveWorkbook.ReadOnly Then
 ActiveWorkbook.SaveAs fileName:="NEWFILE.XLS"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ReadOnlyRecommended Property (Excel)

 Copy code hover
[image]

Workbook.ReadOnlyRecommended Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook was saved as read-only recommended. Read-only Boolean.

Syntax

expression .ReadOnlyRecommended

expression A variable that represents a Workbook object.

Remarks

When you open a workbook that was saved as read-only recommended, Microsoft Excel displays a message recommending that you open the workbook as read-only.

Use the SaveAs method to change this property.

Example

This example displays a message if the active workbook is saved as read-only recommended.

VBA Copy code Copy code
If ActiveWorkbook.ReadOnlyRecommended = True Then
 MsgBox "This workbook is saved as read-only recommended"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RemovePersonalInformation Property (Excel)

 Copy code hover
[image]

Workbook.RemovePersonalInformation Property (Excel)
See also Send feedback

Published: July 16, 2012

True if personal information can be removed from the specified workbook. The default value is False. Read/write Boolean.

Syntax

expression .RemovePersonalInformation

expression A variable that represents a Workbook object.

Example

In this example, Microsoft Excel determines if personal information can be removed from the specified workbook and notifies the user.

VBA Copy code Copy code
Sub UsePersonalInformation()

 Dim wkbOne As Workbook

 Set wkbOne = Application.ActiveWorkbook

 ' Determine settings and notify user.
 If wkbOne.RemovePersonalInformation = True Then
 MsgBox "Personal information can be removed."
 Else
 MsgBox "Personal information cannot be removed."
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Research Property (Excel)

 Copy code hover
[image]

Workbook.Research Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Research object that represents the research service for a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Research

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RevisionNumber Property (Excel)

 Copy code hover
[image]

Workbook.RevisionNumber Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of times the workbook has been saved while open as a shared list. If the workbook is open in exclusive mode, this property returns 0 (zero). Read-only Long.

Syntax

expression .RevisionNumber

expression A variable that represents a Workbook object.

Remarks

The RevisionNumber property is updated only when the local copy of the workbook is saved, not when remote copies are saved.

Example

This example uses the revision number to determine whether the active workbook is open in exclusive mode. If it is, the example saves the workbook as a shared list.

VBA Copy code Copy code
If ActiveWorkbook.RevisionNumber = 0 Then
 ActiveWorkbook.SaveAs _
 filename:=ActiveWorkbook.FullName, _
 accessMode:=xlShared, _
 conflictResolution:= _
 xlOtherSessionChanges
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Saved Property (Excel)

 Copy code hover
[image]

Workbook.Saved Property (Excel)
See also Send feedback

Published: July 16, 2012

True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.

Syntax

expression .Saved

expression A variable that represents a Workbook object.

Remarks

If a workbook has never been saved, its Path property returns an empty string ("").

You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it.

Example

This example displays a message if the active workbook contains unsaved changes.

VBA Copy code Copy code
If Not ActiveWorkbook.Saved Then
 MsgBox "This workbook contains unsaved changes."
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SaveLinkValues Property (Excel)

 Copy code hover
[image]

Workbook.SaveLinkValues Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel saves external link values with the workbook. Read/write Boolean.

Syntax

expression .SaveLinkValues

expression A variable that represents a Workbook object.

Example

This example causes Microsoft Excel to save external link values with the active workbook.

VBA Copy code Copy code
ActiveWorkbook.SaveLinkValues = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ServerPolicy Property (Excel)

 Copy code hover
[image]

Workbook.ServerPolicy Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ServerPolicy object that represents a policy specified for a workbook stored on a server running SharePoint Server 2007 or later. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerPolicy

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ServerViewableItems Property (Excel)

 Copy code hover
[image]

Workbook.ServerViewableItems Property (Excel)
See also Send feedback

Published: July 16, 2012

Allows a developer to interact with the list of published objects in the workbook that are shown on the server. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .ServerViewableItems

expression A variable that represents a Workbook object.

Remarks

This property returns a collection of the items that could be published to Excel Services. It can include Tables, PivotTables, Named Ranges, and Charts. It can also contain Sheets as long as it is not a mixture of Sheets and the before mentioned list.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SharedWorkspace Property (Excel)

 Copy code hover
[image]

Workbook.SharedWorkspace Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Sheets Property (Excel)

 Copy code hover
[image]

Workbook.Sheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.

Syntax

expression .Sheets

expression An expression that returns a Workbook object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveWorkbook.Sheets.

Example

This example creates a new worksheet and then places a list of the active workbook's sheet names in the first column.

VBA Copy code Copy code
Set newSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
 newSheet.Cells(i, 1).Value = Sheets(i).Name
Next i

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ShowConflictHistory Property (Excel)

 Copy code hover
[image]

Workbook.ShowConflictHistory Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Conflict History worksheet is visible in the workbook that's open as a shared list. Read/write Boolean.

Syntax

expression .ShowConflictHistory

expression A variable that represents a Workbook object.

Remarks

If the specified workbook isn't open as a shared list, this property fails. To determine whether a workbook is open as a shared list, use the MultiUserEditing property.

Example

This example determines whether the active workbook is open as a shared list. If it is, the example displays the Conflict History worksheet.

VBA Copy code Copy code
If ActiveWorkbook.MultiUserEditing Then
 ActiveWorkbook.ShowConflictHistory = True
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ShowPivotChartActiveFields Property (Excel)

 Copy code hover
[image]

Workbook.ShowPivotChartActiveFields Property (Excel)
See also Send feedback

Published: July 16, 2012

This property controls the visibility of the PivotChart Filter Pane. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .ShowPivotChartActiveFields

expression A variable that represents a Workbook object.

Remarks

This property controls the visibility of the PivotChart Filter Pane (toggles it on/off). In order for it to be visible, a PivotChart object must be selected.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ShowPivotTableFieldList Property (Excel)

 Copy code hover
[image]

Workbook.ShowPivotTableFieldList Property (Excel)
See also Send feedback

Published: July 16, 2012

True (default) if the PivotTable field list can be shown. Read/write Boolean.

Syntax

expression .ShowPivotTableFieldList

expression A variable that represents a Workbook object.

Example

In this example, Microsoft Excel determines if the PivotTable field list can be shown and notifies the user.

VBA Copy code Copy code
Sub UseShowPivotTableFieldList()

 Dim wkbOne As Workbook

 Set wkbOne = Application.ActiveWorkbook

 'Determine PivotTable field list setting.
 If wkbOne.ShowPivotTableFieldList = True Then
 MsgBox "The PivotTable field list can be viewed."
 Else
 MsgBox "The PivotTable field list cannot be viewed."
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Signatures Property (Excel)

 Copy code hover
[image]

Workbook.Signatures Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the digital signatures for a workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Signatures

expression A variable that represents a Workbook object.

Remarks

To digitally sign Excel workbooks and verify other signatures in them, you will need the Microsoft CryptoAPI and a unique digital signature certificate. The CryptoAPI is installed with Microsoft Internet Explorer 4.01 or later. You can obtain a digital signature certificate from a certification authority.

Example

Copy code Copy code
Sub AddSignature()
 ActiveWorkbook.Signatures.AddSignatureLine
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SlicerCaches Property (Excel)

 Copy code hover
[image]

Workbook.SlicerCaches Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the SlicerCaches object associated with the workbook. Read-only.

Version Information

Version Added: Excel 2010

Syntax

expression .SlicerCaches

expression A variable that represents a Workbook object.

Return Value

SlicerCaches

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SmartDocument Property (Excel)

 Copy code hover
[image]

Workbook.SmartDocument Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a SmartDocument object that represents the settings for a smart document solution. Read-only.

Syntax

expression .SmartDocument

expression A variable that represents a Workbook object.

Remarks

For more information on smart documents, please see the Smart Document Software Development Kit on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Styles Property (Excel)

 Copy code hover
[image]

Workbook.Styles Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Styles collection that represents all the styles in the specified workbook. Read-only.

Syntax

expression .Styles

expression A variable that represents a Workbook object.

Example

This example deletes the user-defined style "Stock Quote Style" from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Styles("Stock Quote Style").Delete

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Sync Property (Excel)

 Copy code hover
[image]

Workbook.Sync Property (Excel)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.TableStyles Property (Excel)

 Copy code hover
[image]

Workbook.TableStyles Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TableStyles collection object for the current workbook that refers to the styles used in the current workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .TableStyles

expression A variable that represents a Workbook object.

Remarks

You can manipulate the table styles returned by the property.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.TemplateRemoveExtData Property (Excel)

 Copy code hover
[image]

Workbook.TemplateRemoveExtData Property (Excel)
See also Send feedback

Published: July 16, 2012

True if external data references are removed when the workbook is saved as a template. Read/write Boolean.

Syntax

expression .TemplateRemoveExtData

expression A variable that represents a Workbook object.

Example

This example saves the workbook as a template that contains no external data.

VBA Copy code Copy code
With ThisWorkbook
 .TemplateRemoveExtData = True
 .SaveAs "current", xlTemplate
 .TemplateRemoveExtData = False
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Theme Property (Excel)

 Copy code hover
[image]

Workbook.Theme Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the theme applied to the current workbook. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Theme

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UpdateLinks Property (Excel)

 Copy code hover
[image]

Workbook.UpdateLinks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlUpdateLink constant indicating a workbook's setting for updating embedded OLE links. Read/write.

Syntax

expression .UpdateLinks

expression A variable that represents a Workbook object.

Remarks

XlUpdateLinks can be one of these XlUpdateLinks constants.

xlUpdateLinksAlways Embedded OLE links are always updated for the specified workbook.

xlUpdateLinksNever Embedded OLE links are never updated for the specified workbook.

xlUpdateLinksUserSetting Embedded OLE links are updated according to the user's settings for the specified workbook.

Example

In this example, Microsoft Excel determines the setting for updating links and notifies the user.

VBA Copy code Copy code
Sub UseUpdateLinks()

 Dim wkbOne As Workbook

 Set wkbOne = Application.Workbooks(1)

 Select Case wkbOne.UpdateLinks
 Case xlUpdateLinksAlways
 MsgBox "Links will always be updated " & _
 "for the specified workbook."
 Case xlUpdateLinksNever
 MsgBox "Links will never be updated " & _
 "for the specified workbook."
 Case xlUpdateLinksUserSetting
 MsgBox "Links will update according " & _
 "to user settting for the specified workbook."
 End Select

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UpdateRemoteReferences Property (Excel)

 Copy code hover
[image]

Workbook.UpdateRemoteReferences Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel updates remote references in the workbook. Read/write Boolean.

Syntax

expression .UpdateRemoteReferences

expression A variable that represents a Workbook object.

Remarks

When a new workbook is created, the default value for the UpdateRemoteReferences property is True and dynamic data exchange (DDE) links and OLE links update automatically. If the value is False, DDE links and OLE links do not update automatically or during recalculation.

Example

This example causes remote references to update automatically in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.UpdateRemoteReferences = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UserStatus Property (Excel)

 Copy code hover
[image]

Workbook.UserStatus Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 1-based, two-dimensional array that provides information about each user who has the workbook open as a shared list. Read-only Variant.

Syntax

expression .UserStatus

expression A variable that represents a Workbook object.

Remarks

The first element of the second dimension is the name of the user, the second element is the date and time when the user last opened the workbook, and the third element is a number indicating the type of list (1 indicates exclusive, and 2 indicates shared).

The UserStatus property doesn't return information about users who have the specified workbook open as read-only.

Example

This example creates a new workbook and inserts into it information about all users who have the active workbook open as a shared list.

VBA Copy code Copy code
users = ActiveWorkbook.UserStatus
With Workbooks.Add.Sheets(1)
 For row = 1 To UBound(users, 1)
 .Cells(row, 1) = users(row, 1)
 .Cells(row, 2) = users(row, 2)
 Select Case users(row, 3)
 Case 1
 .Cells(row, 3).Value = "Exclusive"
 Case 2
 .Cells(row, 3).Value = "Shared"
 End Select
 Next
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UseWholeCellCriteria Property (Excel)

 Copy code hover
[image]

Workbook.UseWholeCellCriteria Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook uses search patterns that match the entire content of a cell. Read-only Boolean.

Version information

Version Added: Excel 2013

Syntax

expression .UseWholeCellCriteria

expression A variable that represents a Workbook object.

Property value

BOOL

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UseWildcards Property (Excel)

 Copy code hover
[image]

Workbook.UseWildcards Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook enables wildcards for character string comparisons and searching. Read-only Boolean

Version information

Version Added: Excel 2013

Syntax

expression .UseWildcards

expression A variable that represents a Workbook object.

Property value

BOOL

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.VBASigned Property (Excel)

 Copy code hover
[image]

Workbook.VBASigned Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the Visual Basic for Applications project for the specified workbook has been digitally signed. Read-only Boolean.

Syntax

expression .VBASigned

expression A variable that represents a Workbook object.

Example

This example loads a workbook named "mybook.xls" and then tests to see whether its Visual Basic for Applications project has a digital signature. If there's no digital signature, the example displays a warning message.

VBA Copy code Copy code
Workbooks.Open FileName:="c:\My Documents\mybook.xls", _
 ReadOnly:=False
If Workbook.VBASigned = False Then
 MsgBox "Warning! The project " _ &
 "has not been digitally signed." _ &
 , vbCritical, "Digital Signature Warning"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.VBProject Property (Excel)

 Copy code hover
[image]

Workbook.VBProject Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VBProject object that represents the Visual Basic project in the specified workbook. Read-only.

Syntax

expression .VBProject

expression A variable that represents a Workbook object.

Example

This example changes the name of the Visual Basic project in the workbook.

VBA Copy code Copy code
ThisWorkbook.VBProject.Name = "TestProject"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WebOptions Property (Excel)

 Copy code hover
[image]

Workbook.WebOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the WebOptions collection, which contains workbook-level attributes used by Microsoft Excel when you save a document as a Web page or open a Web page. Read-only.

Syntax

expression .WebOptions

expression A variable that represents a Workbook object.

Example

This example specifies that cascading style sheets and Western document encoding be used when items in the first workbook are saved to a Web page.

VBA Copy code Copy code
Set objWO = Workbooks(1).WebOptions
objWO.RelyOnCSS = True
objWO.Encoding = msoEncodingWestern

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Windows Property (Excel)

 Copy code hover
[image]

Workbook.Windows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Windows collection that represents all the windows in the specified workbook. Read-only Windows object.

Syntax

expression .Windows

expression A variable that represents a Workbook object.

Remarks

Using this property without an object qualifier is equivalent to using Application.Windows.

This property returns a collection of both visible and hidden windows.

Example

This example names window one in the active workbook "Consolidated Balance Sheet." This name is then used as the index to the Windows collection.

VBA Copy code Copy code
ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet"
ActiveWorkbook.Windows("Consolidated Balance Sheet") _
 .ActiveSheet.Calculate

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Worksheets Property (Excel)

 Copy code hover
[image]

Workbook.Worksheets Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.

Syntax

expression .Worksheets

expression A variable that represents a Workbook object.

Remarks

Using this property without an object qualifier returns all the worksheets in the active workbook.

This property doesn't return macro sheets; use the Excel4MacroSheets property or the Excel4IntlMacroSheets property to return those sheets.

Example

This example displays the value in cell A1 on Sheet1 in the active workbook.

VBA Copy code Copy code
MsgBox Worksheets("Sheet1").Range("A1").Value

This example displays the name of each worksheet in the active workbook.

VBA Copy code Copy code
For Each ws In Worksheets
 MsgBox ws.Name
Next ws

This example adds a new worksheet to the active workbook and then sets the name of the worksheet.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
newSheet.Name = "current Budget"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WritePassword Property (Excel)

 Copy code hover
[image]

Workbook.WritePassword Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String for the write password of a workbook. Read/write.

Syntax

expression .WritePassword

expression A variable that represents a Workbook object.

Example

In this example, if the active workbook is not protected against saving changes, Microsoft Excel sets the password to a string as the write password for the active workbook.

VBA Copy code Copy code
Sub UseWritePassword()

 Dim strPassword As String

 strPassword = InputBox ("Enter the password")

 ' Set password to a string if allowed.
 If ActiveWorkbook.WriteReserved = False Then
 ActiveWorkbook.WritePassword = strPassword
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WriteReserved Property (Excel)

 Copy code hover
[image]

Workbook.WriteReserved Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the workbook is write-reserved. Read-only Boolean.

Syntax

expression .WriteReserved

expression A variable that represents a Workbook object.

Remarks

Use the SaveAs method to set this property.

Example

If the active workbook is write-reserved, this example displays a message that contains the name of the user who saved the workbook as write-reserved.

VBA Copy code Copy code
With ActiveWorkbook
 If .WriteReserved = True Then
 MsgBox "Please contact " & .WriteReservedBy & Chr(13) & _
 " if you need to insert data in this workbook."
 End If
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WriteReservedBy Property (Excel)

 Copy code hover
[image]

Workbook.WriteReservedBy Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the name of the user who currently has write permission for the workbook. Read-only String.

Syntax

expression .WriteReservedBy

expression A variable that represents a Workbook object.

Example

If the active workbook is write-reserved, this example displays a message that contains the name of the user who saved the workbook as write-reserved.

VBA Copy code Copy code
With ActiveWorkbook
 If .WriteReserved = True Then
 MsgBox "Please contact " & .WriteReservedBy & Chr(13) & _
 " if you need to insert data in this workbook."
 End If
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.XmlMaps Property (Excel)

 Copy code hover
[image]

Workbook.XmlMaps Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlMaps collection that represents the schema maps that have been added to the specified workbook. Read-only.

Syntax

expression .XmlMaps

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.XmlNamespaces Property (Excel)

 Copy code hover
[image]

Workbook.XmlNamespaces Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlNamespaces collection that represents the XML namespaces contained in the specified workbook. Read-only.

Syntax

expression .XmlNamespaces

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook Methods (Excel)

 Copy code hover
[image]

Workbook Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AcceptAllChanges | Accepts all changes in the specified shared workbook.
Activate | Activates the first window associated with the workbook.
AddToFavorites | Adds a shortcut to the workbook or hyperlink to the Favorites folder.
ApplyTheme | Applies the specified theme to the current workbook.
BreakLink | Converts formulas linked to other Microsoft Excel sources or OLE sources to values.
CanCheckIn | True if Microsoft Excel can check in a specified workbook to a server. Read/write Boolean.
ChangeFileAccess | Changes the access permissions for the workbook. This may require an updated version to be loaded from the disk.
ChangeLink | Changes a link from one document to another.
CheckIn | Returns a workbook from a local computer to a server, and sets the local workbook to read-only so that it cannot be edited locally. Calling this method will also close the workbook.
CheckInWithVersion | Saves a workbook to a server from a local computer, and sets the local workbook to read-only so that it cannot be edited locally.
Close | Closes the object.
DeleteNumberFormat | Deletes a custom number format from the workbook.
EnableConnections | The EnableConnections method allows developers to programmatically enable data connections within the workbook for the user.
EndReview | Terminates a review of a file that has been sent for review using the SendForReview method.
ExclusiveAccess | Assigns the current user exclusive access to the workbook that's open as a shared list.
ExportAsFixedFormat | The ExportAsFixedFormat method is used to publish a workbook to either the PDF or XPS format.
FollowHyperlink | Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.
ForwardMailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
GetWorkflowTasks | Returns the collection of WorkflowTask objects for the specified workbook.
GetWorkflowTemplates | Returns the collection of WorkflowTemplate objects for the specified workbook.
HighlightChangesOptions | Controls how changes are shown in a shared workbook.
LinkInfo | Returns the link date and update status.
LinkSources | Returns an array of links in the workbook. The names in the array are the names of the linked documents, editions, or DDE or OLE servers. Returns Empty if there are no links.
LockServerFile | Locks the workbook on the server to prevent modification.
MergeWorkbook | Merges changes from one workbook into an open workbook.
NewWindow | Creates a new window or a copy of the specified window.
OpenLinks | Opens the supporting documents for a link or links.
PivotCaches | Returns a PivotCaches collection that represents all the PivotTable caches in the specified workbook. Read-only.
Post | Posts the specified workbook to a public folder. This method works only with a Microsoft Exchange client connected to a Microsoft Exchange server.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a workbook so that it cannot be modified.
ProtectSharing | Saves the workbook and protects it for sharing.
PurgeChangeHistoryNow | Removes entries from the change log for the specified workbook.
RefreshAll | Refreshes all external data ranges and PivotTable reports in the specified workbook.
RejectAllChanges | Rejects all changes in the specified shared workbook.
ReloadAs | Reloads a workbook based on an HTML document, using the specified document encoding.
RemoveDocumentInformation | Removes all information of the specified type from the workbook.
RemoveUser | Disconnects the specified user from the shared workbook.
Reply | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ReplyAll | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
ReplyWithChanges | Sends an e-mail message to the author of a workbook that has been sent out for review, notifying them that a reviewer has completed review of the workbook.
ResetColors | Resets the color palette to the default colors.
RunAutoMacros | Runs the Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro attached to the workbook. This method is included for backward compatibility. For new Visual Basic code, you should use the Open, Close, Activate and Deactivate events instead of these macros.
Save | Saves changes to the specified workbook.
SaveAs | Saves changes to the workbook in a different file.
SaveAsXMLData | Exports the data that has been mapped to the specified XML schema map to an XML data file.
SaveCopyAs | Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.
SendFaxOverInternet | Sends a worksheet as a fax to the specfied recipients.
SendForReview | Sends a workbook in an e-mail message for review to the specified recipients.
SendMail | Sends the workbook by using the installed mail system.
SendMailer | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.
SetLinkOnData | Sets the name of a procedure that runs whenever a DDE link is updated.
SetPasswordEncryptionOptions | Sets the options for encrypting workbooks using passwords.
ToggleFormsDesign | The ToggleFormsDesign method is used to toggle Excel into Design Mode when using forms controls.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.
UnprotectSharing | Turns off protection for sharing and saves the workbook.
UpdateFromFile | Updates a read-only workbook from the saved disk version of the workbook if the disk version is more recent than the copy of the workbook that is loaded in memory. If the disk copy hasn't changed since the workbook was loaded, the in-memory copy of the workbook isn't reloaded.
UpdateLink | Updates a Microsoft Excel, DDE, or OLE link (or links).
WebPagePreview | Displays a preview of the specified workbook as it would look if saved as a Web page.
XmlImport | Imports an XML data file into the current workbook.
XmlImportXml | Imports an XML data stream that has been previously loaded into memory. Excel uses the first qualifying map found or if the destination range is specified, Excel will automatically list the data.


Workbook.AcceptAllChanges Method (Excel)

 Copy code hover
[image]

Workbook.AcceptAllChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Accepts all changes in the specified shared workbook.

Syntax

expression .AcceptAllChanges(When, Who, Where)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
When | Optional | Variant | Specifies when all the changes are accepted.
Who | Optional | Variant | Specifies by whom all the changes are accepted.
Where | Optional | Variant | Specifies where all the changes are accepted.

Example

This example accepts all changes in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.AcceptAllChanges

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Activate Method (Excel)

 Copy code hover
[image]

Workbook.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Activates the first window associated with the workbook.

Syntax

expression .Activate

expression A variable that represents a Workbook object.

Remarks

This method won't run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).

Example

This example activates Book4.xls. If Book4.xls has multiple windows, the example activates the first window, Book4.xls:1.

VBA Copy code Copy code
Workbooks("BOOK4.XLS").Activate

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AddToFavorites Method (Excel)

 Copy code hover
[image]

Workbook.AddToFavorites Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds a shortcut to the workbook or hyperlink to the Favorites folder.

Syntax

expression .AddToFavorites

expression A variable that represents a Workbook object.

Example

This example adds a shortcut to the active workbook to the Favorites folder.

VBA Copy code Copy code
ActiveWorkbook.AddToFavorites

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ApplyTheme Method (Excel)

 Copy code hover
[image]

Workbook.ApplyTheme Method (Excel)
See also Send feedback

Published: July 16, 2012

Applies the specified theme to the current workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .ApplyTheme(Filename)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Name of the theme.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.BreakLink Method (Excel)

 Copy code hover
[image]

Workbook.BreakLink Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts formulas linked to other Microsoft Excel sources or OLE sources to values.

Syntax

expression .BreakLink(Name, Type)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the link.
Type | Required | XlLinkType | The type of link.

Example

In this example, Microsoft Excel converts the first link (an Excel link type) in the active workbook.

Note Note

This example assumes at least one formula exists in the active workbook that links to another Excel source.

VBA Copy code Copy code
Sub UseBreakLink()

 Dim astrLinks As Variant

 ' Define variable as an Excel link type.
 astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)

 ' Break the first link in the active workbook.
 ActiveWorkbook.BreakLink _
 Name:=astrLinks(1), _
 Type:=xlLinkTypeExcelLinks

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CanCheckIn Method (Excel)

 Copy code hover
[image]

Workbook.CanCheckIn Method (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel can check in a specified workbook to a server. Read/write Boolean.

Syntax

expression .CanCheckIn

expression A variable that represents a Workbook object.

Return Value

Boolean

Example

This example checks the server to see if the specified workbook can be checked in. If it can be, it saves and closes the workbook and checks it back into the server.

VBA Copy code Copy code
Sub CheckInOut(strWkbCheckIn As String)

 ' Determine if workbook can be checked in.
 If Workbooks(strWkbCheckIn).CanCheckIn = True Then
 Workbooks(strWkbCheckIn).CheckIn
 MsgBox strWkbCheckIn & " has been checked in."
 Else
 MsgBox "This file cannot be checked in " & _
 "at this time. Please try again later."
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ChangeFileAccess Method (Excel)

 Copy code hover
[image]

Workbook.ChangeFileAccess Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes the access permissions for the workbook. This may require an updated version to be loaded from the disk.

Syntax

expression .ChangeFileAccess(Mode, WritePassword, Notify)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Mode | Required | XlFileAccess | Specifies the new access mode.
WritePassword | Optional | Variant | Specifies the write-reserved password if the file is write reserved and Mode is xlReadWrite. Ignored if there's no password for the file or if Mode is xlReadOnly.
Notify | Optional | Variant | True (or omitted) to notify the user if the file cannot be immediately accessed.

Remarks

If you have a file open in read-only mode, you don't have exclusive access to the file. If you change a file from read-only to read/write, Microsoft Excel must load a new copy of the file to ensure that no changes were made while you had the file open as read-only.

Example

This example sets the active workbook to read-only.

VBA Copy code Copy code
ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ChangeLink Method (Excel)

 Copy code hover
[image]

Workbook.ChangeLink Method (Excel)
See also Send feedback

Published: July 16, 2012

Changes a link from one document to another.

Syntax

expression .ChangeLink(Name, NewName, Type)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the Microsoft Excel or DDE/OLE link to be changed, as it was returned from the LinkSources method.
NewName | Required | String | The new name of the link.
Type | Optional | XlLinkType | The link type.

Example

This example changes a Microsoft Excel link.

Note Note

This example assumes at least one formula exists in the active workbook that links to another Excel source.

VBA Copy code Copy code
ActiveWorkbook.ChangeLink "c:\excel\book1.xls", _
 "c:\excel\book2.xls", xlExcelLinks

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CheckIn Method (Excel)

 Copy code hover
[image]

Workbook.CheckIn Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a workbook from a local computer to a server, and sets the local workbook to read-only so that it cannot be edited locally. Calling this method will also close the workbook.

Syntax

expression .CheckIn(SaveChanges, Comments, MakePublic)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | True saves changes and checks in the document. False returns the document to a checked-in status without saving revision.
Comments | Optional | Variant | Allows the user to enter check-in comments for the revision of the workbook being checked in (applies only if SaveChanges equals True).
MakePublic | Optional | Variant | True allows the user to publish the workbook after it has been checked in. This submits the workbook for the approval process, which can eventually result in a version of the workbook being published to users with read-only rights to the workbook (applies only if SaveChanges equals True).

Example

This example checks the server to see if the specified workbook can be checked in. If it can, the code saves and closes the workbook and checks it back in to the server.

VBA Copy code Copy code
Sub CheckInOut(strWkbCheckIn As String)

 ' Determine if workbook can be checked in.
 If Workbooks(strWkbCheckIn).CanCheckIn = True Then
 Workbooks(strWkbCheckIn).CheckIn
 MsgBox strWkbCheckIn & " has been checked in."
 Else
 MsgBox "This file cannot be checked in " & _
 "at this time. Please try again later."
 End If

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.CheckInWithVersion Method (Excel)

 Copy code hover
[image]

Workbook.CheckInWithVersion Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves a workbook to a server from a local computer, and sets the local workbook to read-only so that it cannot be edited locally.

Version Information

Version Added: Excel 2007

Syntax

expression .CheckInWithVersion(SaveChanges, Comments, MakePublic, VersionType)

expression A variable that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | True to save the workbook to the server location. The default is True.
Comments | Optional | Variant | Comments for the revision of the workbook being checked in (applies only if SaveChanges is set to True).
MakePublic | Optional | Variant | True to allow the user to publish the workbook after it is checked in.
VersionType | Optional | Variant | Specifies versioning information for the workbook.

Return Value

Nothing

Remarks

Setting the MakePublic parameter to True submits the workbook for the approval process, which can eventually result in a version of the workbook being published to users with read-only rights to the workbook (applies only if SaveChanges is set to True).

To take advantage of the collaboration features built into Microsoft Excel, documents must be stored on a Microsoft SharePoint Server.

Example

The following example uses the CanCheckIn method to determine whether the workbook has been stored on a Microsoft SharePoint Server. If the workbook has been stored on a server, the example calls the CheckInWithVersion method to check in the workbook along with the specified comments and version number, save changes to the server location, and submit the workbook for the approval process.

This example is for a workbook-level customization.

VBA Copy code Copy code
Private Sub WorkbookCheckIn()
 If ActiveWorkbook.CanCheckIn Then
 ActiveWorkbook.CheckInWithVersion _
 True, _
 "My updates.", _
 True, _
 XlCheckInVersionType.xlCheckInMinorVersion
 Else
 MessageBox.Show ("This workbook cannot be checked in")
 End If
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Close Method (Excel)

 Copy code hover
[image]

Workbook.Close Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes the object.

Syntax

expression .Close(SaveChanges, Filename, RouteWorkbook)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | If there are no changes to the workbook, this argument is ignored. If there are changes to the workbook and the workbook appears in other open windows, this argument is ignored. If there are changes to the workbook but the workbook doesn't appear in any other open windows, this argument specifies whether changes should be saved. If set to True, changes are saved to the workbook. If there is not yet a file name associated with the workbook, then FileName is used. If Filename is omitted, the user is asked to supply a file name.
Filename | Optional | Variant | Save changes under this file name.
RouteWorkbook | Optional | Variant | If the workbook doesn't need to be routed to the next recipient (if it has no routing slip or has already been routed), this argument is ignored. Otherwise, Microsoft Excel routes the workbook according to the value of this parameter. If set to True, the workbook is sent to the next recipient. If set to False, the workbook is not sent. If omitted, the user is asked whether the workbook should be sent.

Remarks

Closing a workbook from Visual Basic doesn't run any Auto_Close macros in the workbook. Use the RunAutoMacros method to run the auto close macros.

Example

This example closes Book1.xls and discards any changes that have been made to it.

VBA Copy code Copy code
Workbooks("BOOK1.XLS").Close SaveChanges:=False

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.DeleteNumberFormat Method (Excel)

 Copy code hover
[image]

Workbook.DeleteNumberFormat Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes a custom number format from the workbook.

Syntax

expression .DeleteNumberFormat(NumberFormat)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
NumberFormat | Required | String | Names the number format to be deleted.

Example

This example deletes the number format "000-00-0000" from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.DeleteNumberFormat("000-00-0000")

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.EnableConnections Method (Excel)

 Copy code hover
[image]

Workbook.EnableConnections Method (Excel)
See also Send feedback

Published: July 16, 2012

The EnableConnections method allows developers to programmatically enable data connections within the workbook for the user.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableConnections

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.EndReview Method (Excel)

 Copy code hover
[image]

Workbook.EndReview Method (Excel)
See also Send feedback

Published: July 16, 2012

Terminates a review of a file that has been sent for review using the SendForReview method.

Syntax

expression .EndReview

expression A variable that represents a Workbook object.

Example

This example terminates the review of the active workbook. When executed, this procedure displays a message asking if you want to end the review. This example assumes the active workbook has been sent for review.

VBA Copy code Copy code
Sub EndWorkbookRev()

 ActiveWorkbook.EndReview

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ExclusiveAccess Method (Excel)

 Copy code hover
[image]

Workbook.ExclusiveAccess Method (Excel)
See also Send feedback

Published: July 16, 2012

Assigns the current user exclusive access to the workbook that's open as a shared list.

Syntax

expression .ExclusiveAccess

expression A variable that represents a Workbook object.

Return Value

Boolean

Remarks

The ExclusiveAccess method saves any changes you've made to the workbook and requires other users who have the workbook open to save their changes to a different file.

If the specified workbook isn't open as a shared list, this method fails. To determine whether a workbook is open as a shared list, use the MultiUserEditing property.

Example

This example determines whether the active workbook is open as a shared list. If it is, the example gives the current user exclusive access.

VBA Copy code Copy code
If ActiveWorkbook.MultiUserEditing Then
 ActiveWorkbook.ExclusiveAccess
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ExportAsFixedFormat Method (Excel)

 Copy code hover
[image]

Workbook.ExportAsFixedFormat Method (Excel)
See also Send feedback

The ExportAsFixedFormat method is used to publish a workbook to either the PDF or XPS format.

Version Information

Version Added: Excel 2007

Syntax

expression .ExportAsFixedFormat(Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)

expression A variable that represents a Workbook, Sheet, Chart, or Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFixedFormatType | Can be either xlTypePDF or xlTypeXPS.
Filename | Optional | Variant | A string that indicates the name of the file to be saved. You can include a full path or Excel saves the file in the current folder.
Quality | Optional | Variant | Can be set to either xlQualityStandard or xlQualityMinimum.
IncludeDocProperties | Optional | Variant | Set to True to indicate that document properties should be included or set to False to indicate that they are omitted.
IgnorePrintAreas | Optional | Variant | If set to True, ignores any print areas set when publishing. If set to False, will use the print areas set when publishing.
From | Optional | Variant | The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To | Optional | Variant | The number of the last page to publish. If this argument is omitted, publishing ends with the last page
OpenAfterPublish | Optional | Variant | If set to True displays file in viewer after it is published. If set to False the file is published but not displayed.
FixedFormatExtClassPtr | Optional | Variant | Pointer to the FixedFormatExt class.

Example

The following example creates the PDF at standard quality in the current file's directory and displays file in viewer after it is published.

Note Note

An error will occur if the PDF add-in is not currently installed.
Copy code Copy code
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF FileName:="sales.pdf" Quality:=xlQualityStandard DisplayFileAfterPublish:=True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.FollowHyperlink Method (Excel)

 Copy code hover
[image]

Workbook.FollowHyperlink Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Syntax

expression .FollowHyperlink(Address, SubAddress, NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Address | Required | String | The address of the target document.
SubAddress | Optional | Variant | The location within the target document. The default value is the empty string.
NewWindow | Optional | Variant | True to display the target application in a new window. The default value is False.
AddHistory | Optional | Variant | Not used. Reserved for future use.
ExtraInfo | Optional | Variant | A String or byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name.
Method | Optional | Variant | Specifies the way ExtraInfo is attached. Can be one of the MsoExtraInfoMethod constants.
HeaderInfo | Optional | Variant | A String that specifies header information for the HTTP request. The defaut value is an empty string.

Remarks

MsoExtraInfoMethod type can be one of these MsoExtraInfoMethod constants.

msoMethodGet. ExtraInfo is a String that's appended to the address.

msoMethodPost. ExtraInfo is posted as a String or byte array.

Example

This example loads the document at example.microsoft.com in a new browser window and adds it to the History folder.

VBA Copy code Copy code
ActiveWorkbook.FollowHyperlink Address:="http://example.microsoft.com"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ForwardMailer Method (Excel)

 Copy code hover
[image]

Workbook.ForwardMailer Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .ForwardMailer

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.GetWorkflowTasks Method (Excel)

 Copy code hover
[image]

Workbook.GetWorkflowTasks Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the collection of WorkflowTask objects for the specified workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .GetWorkflowTasks

expression A variable that represents a Workbook object.

Return Value

WorkFlowTasks

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.GetWorkflowTemplates Method (Excel)

 Copy code hover
[image]

Workbook.GetWorkflowTemplates Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the collection of WorkflowTemplate objects for the specified workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .GetWorkflowTemplates

expression A variable that represents a Workbook object.

Return Value

WorkflowTemplates

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.HighlightChangesOptions Method (Excel)

 Copy code hover
[image]

Workbook.HighlightChangesOptions Method (Excel)
See also Send feedback

Published: July 16, 2012

Controls how changes are shown in a shared workbook.

Syntax

expression .HighlightChangesOptions(When, Who, Where)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
When | Optional | Variant | The changes that are shown. Can be one of the following XlHighlightChangesTime constants: xlSinceMyLastSave, xlAllChanges, or xlNotYetReviewed.
Who | Optional | Variant | The user or users whose changes are shown. Can be "Everyone," "Everyone but Me," or the name of one of the users of the shared workbook.
Where | Optional | Variant | An A1-style range reference that specifies the area to check for changes.

Example

This example shows changes to the shared workbook on a separate worksheet.

VBA Copy code Copy code
With ActiveWorkbook
 .HighlightChangesOptions _
 When:=xlSinceMyLastSave, _
 Who:="Everyone"
 .ListChangesOnNewSheet = True
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.LinkInfo Method (Excel)

 Copy code hover
[image]

Workbook.LinkInfo Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the link date and update status.

Syntax

expression .LinkInfo(Name, LinkInfo, Type, EditionRef)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the link.
LinkInfo | Required | XlLinkInfo | The type of information to be returned.
Type | Optional | Variant | One of the constants of XlLinkInfoType specifying the type of link to return.
EditionRef | Optional | Variant | If the link is an edition, this argument specifies the edition reference as a string in R1C1 style. This argument is required if there's more than one publisher or subscriber with the same name in the workbook.

Return Value

Variant

Example

This example displays a message box if the link is updated automatically.

VBA Copy code Copy code
If ActiveWorkbook.LinkInfo( _
 "Word.Document|Document1!'!DDE_LINK1", xlUpdateState, _
 xlOLELinks) = 1 Then
 MsgBox "Link updates automatically"
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.LinkSources Method (Excel)

 Copy code hover
[image]

Workbook.LinkSources Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an array of links in the workbook. The names in the array are the names of the linked documents, editions, or DDE or OLE servers. Returns Empty if there are no links.

Syntax

expression .LinkSources(Type)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | Variant | One of the constants of XlLink which specifies the type of link to return.

Return Value

Variant

Remarks

The format of the array is a one-dimensional array for all types but publisher and subscriber. The returned strings contain the name of the link source, in the appropriate notation for the link type. For example, DDE links use the "Server|Document!Item" syntax.

For publisher and subscriber links, the returned array is two-dimensional. The first column of the array contains the names of the edition, and the second column contains the references of the editions as text.

Example

This example displays a list of OLE and DDE links in the active workbook. The example should be run on a workbook that contains one or more linked Word objects.

VBA Copy code Copy code
aLinks = ActiveWorkbook.LinkSources(xlOLELinks)
If Not IsEmpty(aLinks) Then
 For i = 1 To UBound(aLinks)
 MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
 Next i
End If

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.LockServerFile Method (Excel)

 Copy code hover
[image]

Workbook.LockServerFile Method (Excel)
See also Send feedback

Published: July 16, 2012

Locks the workbook on the server to prevent modification.

Version Information

Version Added: Excel 2007

Syntax

expression .LockServerFile

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.MergeWorkbook Method (Excel)

 Copy code hover
[image]

Workbook.MergeWorkbook Method (Excel)
See also Send feedback

Published: July 16, 2012

Merges changes from one workbook into an open workbook.

Syntax

expression .MergeWorkbook(Filename)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | Variant | The file name of the workbook that contains the changes to be merged into the open workbook.

Example

This example merges changes from Book1.xls into the active workbook.

VBA Copy code Copy code
ActiveWorkbook.MergeWorkbook "Book1.xls"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.NewWindow Method (Excel)

 Copy code hover
[image]

Workbook.NewWindow Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new window or a copy of the specified window.

Syntax

expression .NewWindow

expression A variable that represents a Workbook object.

Return Value

Window

Example

This example creates a new window for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.NewWindow

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.OpenLinks Method (Excel)

 Copy code hover
[image]

Workbook.OpenLinks Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens the supporting documents for a link or links.

Syntax

expression .OpenLinks(Name, ReadOnly, Type)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the Microsoft Excel or DDE/OLE link, as returned from the LinkSources method.
ReadOnly | Optional | Variant | True to open documents as read-only. The default value is False.
Type | Optional | Variant | One of the constants of XlLink that specifies the link type.

Example

This example opens OLE link one in the active workbook.

VBA Copy code Copy code
linkArray = ActiveWorkbook.LinkSources(xlOLELinks)
ActiveWorkbook.OpenLinks linkArray(1)

This example opens all supporting Microsoft Excel documents for the active workbook.

VBA Copy code Copy code
Sub OpenAllLinks()
 Dim arLinks As Variant
 Dim intIndex As Integer
 arLinks = ActiveWorkbook.LinkSources(xlExcelLinks)

 If Not IsEmpty(arLinks) Then
 For intIndex = LBound(arLinks) To UBound(arLinks)
 ActiveWorkbook.OpenLinks arLinks(intIndex)
 Next intIndex
 Else
 MsgBox "The active workbook contains no external links."
 End If
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PivotCaches Method (Excel)

 Copy code hover
[image]

Workbook.PivotCaches Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a PivotCaches collection that represents all the PivotTable caches in the specified workbook. Read-only.

Syntax

expression .PivotCaches

expression A variable that represents a Workbook object.

Return Value

PivotCaches

Example

This example causes the PivotTable cache to update automatically each time the workbook is opened.

VBA Copy code Copy code
ActiveWorkbook.PivotCaches(1).RefreshOnFileOpen = True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Post Method (Excel)

 Copy code hover
[image]

Workbook.Post Method (Excel)
See also Send feedback

Published: July 16, 2012

Posts the specified workbook to a public folder. This method works only with a Microsoft Exchange client connected to a Microsoft Exchange server.

Syntax

expression .Post(DestName)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
DestName | Optional | Variant | This argument is ignored. The Post method prompts the user to specify the destination for the workbook.

Example

This example posts the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Post

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PrintOut Method (Excel)

 Copy code hover
[image]

Workbook.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.
IgnorePrintAreas | Optional | Variant | True to ignore print areas and print the entire object.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PrintPreview Method (Excel)

 Copy code hover
[image]

Workbook.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Protect Method (Excel)

 Copy code hover
[image]

Workbook.Protect Method (Excel)
See also Send feedback

Published: July 16, 2012

Protects a workbook so that it cannot be modified.

Syntax

expression .Protect(Password, Structure, Windows)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that specifies a case-sensitive password for the worksheet or workbook. If this argument is omitted, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook. If you forget the password, you cannot unprotect the worksheet or workbook. Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.
Structure | Optional | Variant | True to protect the structure of the workbook (the relative position of the sheets). The default value is False.
Windows | Optional | Variant | True to protect the workbook windows. If this argument is omitted, the windows aren't protected.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ProtectSharing Method (Excel)

 Copy code hover
[image]

Workbook.ProtectSharing Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves the workbook and protects it for sharing.

Syntax

expression .ProtectSharing(Filename, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, SharingPassword, FileFormat)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Optional | Variant | A string indicating the name of the saved file. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.
Password | Optional | Variant | A case-sensitive string indicating the protection password to be given to the file. Should be no longer than 15 characters.
WriteResPassword | Optional | Variant | A string indicating the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened read-only.
ReadOnlyRecommended | Optional | Variant | True to display a message when the file is opened, recommending that the file be opened read-only.
CreateBackup | Optional | Variant | True to create a backup file.
SharingPassword | Optional | Variant | A string indicating the password to be used to protect the file for sharing.
FileFormat | Optional | Variant | A string indicating the file format.

Remarks

Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.

Example

This example saves workbook one and protects it for sharing.

VBA Copy code Copy code

Sub ProtectWorkbook()

    Dim wbAWB As Workbook
    Dim strPwd As String
    Dim strSharePwd As String

    Set wbAWB = Application.ActiveWorkbook

    strPwd = InputBox("Enter password for the file")
    strSharePwd = InputBox("Enter password for sharing")

    wbAWB.ProtectSharing Password:=strPwd, _
        SharingPassword:=strSharePwd

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PurgeChangeHistoryNow Method (Excel)

 Copy code hover
[image]

Workbook.PurgeChangeHistoryNow Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes entries from the change log for the specified workbook.

Syntax

expression .PurgeChangeHistoryNow(Days, SharingPassword)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Days | Required | Long | The number of days that changes in the change log are to be retained.
SharingPassword | Optional | Variant | The password that unprotects the workbook for sharing. If the workbook is protected for sharing with a password and this argument is omitted, the user is prompted for the password.

Example

This example removes all changes that are more than one day old from the change log for the active workbook.

VBA Copy code Copy code
ActiveWorkbook.PurgeChangeHistoryNow Days:=1

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RefreshAll Method (Excel)

 Copy code hover
[image]

Workbook.RefreshAll Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes all external data ranges and PivotTable reports in the specified workbook.

Syntax

expression .RefreshAll

expression A variable that represents a Workbook object.

Remarks

Objects that have the BackgroundQuery property set to True are refreshed in the background.

Example

This example refreshes all external data ranges and PivotTable reports in the third workbook.

VBA Copy code Copy code
Workbooks(3).RefreshAll

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RejectAllChanges Method (Excel)

 Copy code hover
[image]

Workbook.RejectAllChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Rejects all changes in the specified shared workbook.

Syntax

expression .RejectAllChanges(When, Who, Where)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
When | Optional | Variant | Specifies when all the changes are rejected.
Who | Optional | Variant | Specifies by whom all the changes are rejected.
Where | Optional | Variant | Specifies where all the changes are rejected.

Example

This example rejects all changes in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.RejectAllChanges

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ReloadAs Method (Excel)

 Copy code hover
[image]

Workbook.ReloadAs Method (Excel)
See also Send feedback

Published: July 16, 2012

Reloads a workbook based on an HTML document, using the specified document encoding.

Syntax

expression .ReloadAs(Encoding)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Encoding | Required | MsoEncoding | The encoding that is to be applied to the workbook.

Remarks

Only msoEncoding constants that are applicable to HTML work with the ReloadAs method.

Example

This example reloads the first workbook, using Western document encoding.

VBA Copy code Copy code
Workbooks(1).ReloadAs Encoding:=msoEncodingWestern

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RemoveDocumentInformation Method (Excel)

 Copy code hover
[image]

Workbook.RemoveDocumentInformation Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all information of the specified type from the workbook.

Version Information

Version Added: Excel 2007

Syntax

expression .RemoveDocumentInformation(RemoveDocInfoType)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
RemoveDocInfoType | Required | XlRemoveDocInfoType | Type of information to be removed.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RemoveUser Method (Excel)

 Copy code hover
[image]

Workbook.RemoveUser Method (Excel)
See also Send feedback

Published: July 16, 2012

Disconnects the specified user from the shared workbook.

Syntax

expression .RemoveUser(Index)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The user index.

Example

This example disconnects user two from the shared workbook.

VBA Copy code Copy code
Workbooks(2).RemoveUser 2

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Reply Method (Excel)

 Copy code hover
[image]

Workbook.Reply Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .Reply

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ReplyAll Method (Excel)

 Copy code hover
[image]

Workbook.ReplyAll Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .ReplyAll

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ReplyWithChanges Method (Excel)

 Copy code hover
[image]

Workbook.ReplyWithChanges Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends an e-mail message to the author of a workbook that has been sent out for review, notifying them that a reviewer has completed review of the workbook.

Syntax

expression .ReplyWithChanges(ShowMessage)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
ShowMessage | Optional | Variant | False does not display the message. True displays the message.

Remarks

Use the SendForReview method to start a collaborative review of a workbook. If the ReplyWithChanges method is executed on a workbook that is not part of a collaborative review cycle, the user will receive an error.

Example

This example automatically sends a notification to the author of a review workbook that a reviewer has completed a review, without first displaying the e-mail message to the reviewer. This example assumes that the active workbook is part of a collaborative review cycle.

VBA Copy code Copy code
Sub ReplyMsg()

 ActiveWorkbook.ReplyWithChanges ShowMessage:=False

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ResetColors Method (Excel)

 Copy code hover
[image]

Workbook.ResetColors Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets the color palette to the default colors.

Syntax

expression .ResetColors

expression A variable that represents a Workbook object.

Example

This example resets the color palette in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.ResetColors

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RunAutoMacros Method (Excel)

 Copy code hover
[image]

Workbook.RunAutoMacros Method (Excel)
See also Send feedback

Published: July 16, 2012

Runs the Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro attached to the workbook. This method is included for backward compatibility. For new Visual Basic code, you should use the Open, Close, Activate and Deactivate events instead of these macros.

Syntax

expression .RunAutoMacros(Which)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Which | Required | XlRunAutoMacro | Specifies the automatic macro to run.

Remarks

XlRunAutoMacro can be one of these XlRunAutoMacro constants.

xlAutoActivate. Auto_Activate macros

xlAutoClose. Auto_Close macros

xlAutoDeactivate. Auto_Deactivate macros

xlAutoOpen. Auto_Open macros

Example

This example opens the workbook Analysis.xls and then runs its Auto_Open macro.

VBA Copy code Copy code
Workbooks.Open "ANALYSIS.XLS"
ActiveWorkbook.RunAutoMacros xlAutoOpen

This example runs the Auto_Close macro for the active workbook and then closes the workbook.

VBA Copy code Copy code
With ActiveWorkbook
 .RunAutoMacros xlAutoClose
 .Close
End With

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Save Method (Excel)

 Copy code hover
[image]

Workbook.Save Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves changes to the specified workbook.

Syntax

expression .Save

expression A variable that represents a Workbook object.

Remarks

To open a workbook file, use the Open method.

To mark a workbook as saved without writing it to a disk, set its Saved property to True.

The first time you save a workbook, use the SaveAs method to specify a name for the file.

Example

This example saves the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Save

This example saves all open workbooks and then closes Microsoft Excel.

VBA Copy code Copy code
For Each w In Application.Workbooks
    w.Save
Next w
Application.Quit

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example uses the BeforeSave event to verify that certain cells contain data before the workbook can be saved. The workbook cannot be saved until there is data in each of the following cells: D5, D7, D9, D11, D13, and D15.

VBA Copy code Copy code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
   'If the six specified cells do not contain data, then display a message box with an error
   'and cancel the attempt to save.
   If WorksheetFunction.CountA(Worksheets("Sheet1").Range("D5,D7,D9,D11,D13, D15")) < 6 Then
      MsgBox "Workbook will not be saved unless" & vbCrLf & _
      "All required fields have been filled in!"
      Cancel = True
   End If
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SaveAs Method (Excel)

 Copy code hover
[image]

Workbook.SaveAs Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves changes to the workbook in a different file.

Syntax

expression .SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)

expression A variable that represents a Workbook object.

Parameters

Name

Required/Optional

Data Type

Description

Filename

Optional

Variant

A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.

FileFormat

Optional

Variant

The file format to use when you save the file. For a list of valid choices, see the XlFileFormat enumeration. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.

Password

Optional

Variant

A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.

WriteResPassword

Optional

Variant

A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.

ReadOnlyRecommended

Optional

Variant

True to display a message when the file is opened, recommending that the file be opened as read-only.

CreateBackup

Optional

Variant

True to create a backup file.

AccessMode

Optional

XlSaveAsAccessMode

The access mode for the workbook.

ConflictResolution

Optional

XlSaveConflictResolution

An XlSaveConflictResolution value that determines how the method resolves a conflict while saving the workbook. If set to xlUserResolution, the conflict-resolution dialog box is displayed. If set to xlLocalSessionChanges, the local user's changes are automatically accepted. If set to xlOtherSessionChanges, the changes from other sessions are automatically accepted instead of the local user's changes. If this argument is omitted, the conflict-resolution dialog box is displayed.

AddToMru

Optional

Variant

True to add this workbook to the list of recently used files. The default value is False.

TextCodepage

Optional

Variant

Ignored for all languages in Microsoft Excel.

Note Note

When Excel saves a workbook to one of the CSV or text formats, which are specified by using the FileFormat parameter, it uses the code page that corresponds to the language for the system locale in use on the current computer. This system setting is available in the Control Panel, by clicking Region and Language, clicking the Location tab, under Current location.

TextVisualLayout

Optional

Variant

Ignored for all languages in Microsoft Excel.

Note Note

When Excel saves a workbook to one of the CSV or text formats, which are specified by using the FileFormat parameter, it saves these formats in logical layout. If left-to-right (LTR) text is embedded within right-to-left (RTL) text in the file, or vice versa, logical layout saves the contents of the file in the correct reading order for all languages in the file without regard to direction. When an application opens the file, each run of LTR or RTL characters are rendered in the correct direction according to the character value ranges within the code page. (Unless an application that is designed to display the exact memory layout of the file, such as a debugger or editor, is used to open the file.)

Local

Optional

Variant

True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

Remarks

Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down

Example

This example creates a new workbook, prompts the user for a file name, and then saves the workbook.

VBA Copy code Copy code
Set NewBook = Workbooks.Add
Do
    fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.SaveAs Filename:=fName

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SaveAsXMLData Method (Excel)

 Copy code hover
[image]

Workbook.SaveAsXMLData Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports the data that has been mapped to the specified XML schema map to an XML data file.

Syntax

expression .SaveAsXMLData(Filename, Map)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.
Map | Required | XmlMap | The schema map to apply to the data.

Remarks

This method will result in a run-time error if Excel cannot export data with the specified schema map. To check whether Excel can use the specified schema map to export data, use the IsExportable property.

Example

The following example verifies that Excel can use the schema map "Customer" to export data, and then exports the data mapped to the "Customer" schema map to a file named "Customer Data.xml".

VBA Copy code Copy code
Sub ExportAsXMLData()
 Dim objMapToExport As XmlMap

 Set objMapToExport = ActiveWorkbook.XmlMaps("Customer")

 If objMapToExport.IsExportable Then

 ActiveWorkbook.SaveAsXMLData "Customer Data.xml", objMapToExport
 Else
 MsgBox "Cannot use " & objMapToExport.Name & _
 "to export the contents of the worksheet to XML data."
 End If
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SaveCopyAs Method (Excel)

 Copy code hover
[image]

Workbook.SaveCopyAs Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.

Syntax

expression .SaveCopyAs(Filename)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Optional | Variant | Specifies the file name for the copy.

Example

This example saves a copy of the active workbook.

VBA Copy code Copy code
ActiveWorkbook.SaveCopyAs "C:\TEMP\XXXX.XLS"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SendFaxOverInternet Method (Excel)

 Copy code hover
[image]

Workbook.SendFaxOverInternet Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends a worksheet as a fax to the specfied recipients.

Syntax

expression .SendFaxOverInternet(Recipients, Subject, ShowMessage)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Recipients | Optional | Variant | A String that represents the fax numbers and e-mail addresses of the people to whom the fax will be sent. Separate multiple recipients with a semicolon.
Subject | Optional | Variant | A String that represents the subject line for the faxed document.
ShowMessage | Optional | Variant | True displays the fax message before sending it. False sends the fax without displaying the fax message.

Remarks

Using the SendFaxOverInternet method requires that the fax service is enabled on a user's computer.

The format used for specifying fax numbers in the Recipients parameter is either "<recipientsfaxnumber>@<usersfaxprovider>" or "<recipientsname>@<recipientsfaxnumber>". You can access the user's fax provider information using the following registry path: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Services\Fax

Use the value of the FaxAddress key at this registry path to determine the format to use for a recipient.

Example

The following example sends a fax to the fax service provider, which will then fax the message to the recipient.

VBA Copy code Copy code
ActiveWorkbook.SendFaxOverInternet _
 "14255550101@consolidatedmessenger.com", _
 "For your review", True

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SendForReview Method (Excel)

 Copy code hover
[image]

Workbook.SendForReview Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends a workbook in an e-mail message for review to the specified recipients.

Syntax

expression .SendForReview(Recipients, Subject, ShowMessage, IncludeAttachment)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Recipients | Optional | Variant | A string that lists the people to whom to send the message. These can be unresolved names and aliases in an e-mail phone book or full e-mail addresses. Separate multiple recipients with a semicolon (;). If left blank and ShowMessage is False, you will receive an error message, and the message will not be sent.
Subject | Optional | Variant | A string for the subject of the message. If left blank, the subject will be: Please review "filename".
ShowMessage | Optional | Variant | A Boolean value that indicates whether the message should be displayed when the method is executed. The default value is True. If set to False, the message is automatically sent to the recipients without first showing the message to the sender.
IncludeAttachment | Optional | Variant | A Boolean value that indicates whether the message should include an attachment or a link to a server location. The default value is True. If set to False, the document must be stored at a shared location.

Remarks

The SendForReview method starts a collaborative review cycle. Use the EndReview method to end a review cycle.

Example

This example automatically sends the active workbook as an attachment in an e-mail message to the specified recipients.

VBA Copy code Copy code
Sub WebReview()

 ActiveWorkbook.SendForReview _
 Recipients:="someone@example.com; amy jones; lewjudy", _
 Subject:="Please review this document.", _
 ShowMessage:=False, _
 IncludeAttachment:=True

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SendMail Method (Excel)

 Copy code hover
[image]

Workbook.SendMail Method (Excel)
See also Send feedback

Published: July 16, 2012

Sends the workbook by using the installed mail system.

Syntax

expression .SendMail(Recipients, Subject, ReturnReceipt)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Recipients | Required | Variant | Specifies the name of the recipient as text, or as an array of text strings if there are multiple recipients. At least one recipient must be specified, and all recipients are added as To recipients.
Subject | Optional | Variant | Specifies the subject of the message. If this argument is omitted, the document name is used.
ReturnReceipt | Optional | Variant | True to request a return receipt. False to not request a return receipt. The default value is False.

Example

This example sends the active workbook to a single recipient.

VBA Copy code Copy code
ActiveWorkbook.SendMail recipients:="Jean Selva"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SendMailer Method (Excel)

 Copy code hover
[image]

Workbook.SendMailer Method (Excel)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about this keyword, consult the language reference Help included with Microsoft Office Macintosh Edition.

Syntax

expression .SendMailer(FileFormat, Priority)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
FileFormat | Optional | Variant | See help included with Microsoft Office Macintosh Edition.
Priority | Optional | XlPriority | See help included with Microsoft Office Macintosh Edition.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SetLinkOnData Method (Excel)

 Copy code hover
[image]

Workbook.SetLinkOnData Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the name of a procedure that runs whenever a DDE link is updated.

Syntax

expression .SetLinkOnData(Name, Procedure)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the DDE/OLE link, as returned from the LinkSources method.
Procedure | Optional | Variant | The name of the procedure to be run when the link is updated. This can be either a Microsoft Excel 4.0 macro or a Visual Basic procedure. Set this argument to an empty string ("") to indicate that no procedure should run when the link is updated.

Example

This example sets the name of the procedure that runs whenever the DDE link is updated.

VBA Copy code Copy code
ActiveWorkbook.SetLinkOnData _
 "WinWord|'C:\MSGFILE.DOC'!DDE_LINK1", _
 "my_Link_Update_Macro"

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SetPasswordEncryptionOptions Method (Excel)

 Copy code hover
[image]

Workbook.SetPasswordEncryptionOptions Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the options for encrypting workbooks using passwords.

Syntax

expression .SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
PasswordEncryptionProvider | Optional | Variant | A case sensitive string of the encryption provider.
PasswordEncryptionAlgorithm | Optional | Variant | A case sensitive string of the algorithmic short name (i.e. "RC4").
PasswordEncryptionKeyLength | Optional | Variant | The encryption key length which is a multiple of 8 (40 or greater).
PasswordEncryptionFileProperties | Optional | Variant | True (default) to encrypt file properties.

Remarks

The PasswordEncryptionProvider, PasswordEncryptionAlgorithm, and PasswordEncryptionKeyLength arguments are not independent of each other. A selected encryption provider limits the set of algorithms and key length that can be chosen.

For the PasswordEncryptionKeyLength argument there is no inherent limit on the range of the key length. The range is determined by the Cryptographic Service Provider which also determines the cryptographic algorithm.

Example

This example sets the password encryption options for the active workbook.

VBA Copy code Copy code
Sub SetPasswordOptions()

 ActiveWorkbook.SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True

End Sub
Note Note

The code and this method do not do anything for the new Excel file formats (xlsx, xlsb, xlsm, etc...) as the workbook will always use AES 128 bit encryption. If a property is set using this method, it will appear set. When the file is reloaded, the properties will be reset to the AES setting.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ToggleFormsDesign Method (Excel)

 Copy code hover
[image]

Workbook.ToggleFormsDesign Method (Excel)
See also Send feedback

Published: July 16, 2012

The ToggleFormsDesign method is used to toggle Excel into Design Mode when using forms controls.

Version Information

Version Added: Excel 2007

Syntax

expression .ToggleFormsDesign

expression A variable that represents a Workbook object.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Unprotect Method (Excel)

 Copy code hover
[image]

Workbook.Unprotect Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Syntax

expression .Unprotect(Password)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that denotes the case-sensitive password to use to unprotect the sheet or workbook. If the sheet or workbook isn't protected with a password, this argument is ignored. If you omit this argument for a sheet that's protected with a password, you'll be prompted for the password. If you omit this argument for a workbook that's protected with a password, the method fails.

Remarks

If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.

Example

This example removes protection from the active workbook.

VBA Copy code Copy code
ActiveWorkbook.Unprotect

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UnprotectSharing Method (Excel)

 Copy code hover
[image]

Workbook.UnprotectSharing Method (Excel)
See also Send feedback

Published: July 16, 2012

Turns off protection for sharing and saves the workbook.

Syntax

expression .UnprotectSharing(SharingPassword)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
SharingPassword | Optional | Variant | The workbook password.

Example

This example turns off protection for sharing and saves the active workbook.

VBA Copy code Copy code
ActiveWorkbook.UnprotectSharing

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UpdateFromFile Method (Excel)

 Copy code hover
[image]

Workbook.UpdateFromFile Method (Excel)
See also Send feedback

Published: July 16, 2012

Updates a read-only workbook from the saved disk version of the workbook if the disk version is more recent than the copy of the workbook that is loaded in memory. If the disk copy hasn't changed since the workbook was loaded, the in-memory copy of the workbook isn't reloaded.

Syntax

expression .UpdateFromFile

expression A variable that represents a Workbook object.

Remarks

This method is useful when a workbook is opened as read-only by user A and opened as read/write by user B. If user B saves a newer version of the workbook to disk while user A still has the workbook open, user A cannot get the updated copy without closing and reopening the workbook and losing view settings. The UpdateFromFile method updates the in-memory copy of the workbook from the disk file.

Example

This example updates the active workbook from the disk version of the file.

VBA Copy code Copy code
ActiveWorkbook.UpdateFromFile

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.UpdateLink Method (Excel)

 Copy code hover
[image]

Workbook.UpdateLink Method (Excel)
See also Send feedback

Published: July 16, 2012

Updates a Microsoft Excel, DDE, or OLE link (or links).

Syntax

expression .UpdateLink(Name, Type)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Optional | Variant | The name of the Microsoft Excel or DDE/OLE link to be updated, as returned from the LinkSources method.
Type | Optional | Variant | One of the constants of XlLinkType specifying the type of link.

Remarks

When the UpdateLink method is called without any parameters, Excel defaults to updating all worksheet links.

Example

This example updates all links in the active workbook.

VBA Copy code Copy code
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WebPagePreview Method (Excel)

 Copy code hover
[image]

Workbook.WebPagePreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays a preview of the specified workbook as it would look if saved as a Web page.

Syntax

expression .WebPagePreview

expression A variable that represents a Workbook object.

Example

This example displays a preview of the first workbook as a Web page.

VBA Copy code Copy code
Workbooks(1).WebPagePreview

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.XmlImport Method (Excel)

 Copy code hover
[image]

Workbook.XmlImport Method (Excel)
See also Send feedback

Imports an XML data file into the current workbook.

Syntax

expression .XmlImport(Url, ImportMap, Overwrite, Destination)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Url | Required | String | A uniform resource locator (URL) or a uniform naming convention (UNC) path to a XML data file.
ImportMap | Required | XmlMap | The schema map to apply when importing the file. If the data was previously imported, contains a reference to the XmlMap object containing the data.
Overwrite | Optional | Variant | If a value is not specified for the Destination parameter, then this parameter specifies whether or not to overwrite data that has been mapped to the schema map specified in the ImportMap parameter. Set to True to overwrite the data or False to append the new data to the existing data. The default value is True. If a value is specified for the Destination parameter, then this parameter specifies whether or not to overwrite existing data. Set to True to overwrite existing data or False to cancel the import if data would be overwritten. The default value is True.
Destination | Optional | Variant | Specifies the range where the list will be created. You only use the top left corner of the range.

Return Value

XlXmlImportResult

Remarks

XlXmlImportResult can be one of the following XlXmlImportResult constants.

xlXmlImportElementsTruncated. The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess. The XML data file was successfully imported.

xlXmlImportValidationFailed. The data being imported failed schema validation, but was imported anyway.

This method allows you to import data into the workbook from a file path. Excel uses the first qualifying map found, or if the destination range is specified, Excel will automatically list the data.

Don't specify a value for the Destination parameter if you want to import data into an existing mapping.

The following conditions will cause the XMLImport method to generate run-time errors:

  • The specified XML data contains syntax errors.

  • The import process was cancelled because the specified data cannot fit into the worksheet.

  • If no qualifying maps are found and the destination range was not specified.

Use the XmlImportXml method of the Workbook object to import XML data that has been previously loaded into memory.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.XmlImportXml Method (Excel)

 Copy code hover
[image]

Workbook.XmlImportXml Method (Excel)
See also Send feedback

Published: July 16, 2012

Imports an XML data stream that has been previously loaded into memory. Excel uses the first qualifying map found or if the destination range is specified, Excel will automatically list the data.

Syntax

expression .XmlImportXml(Data, ImportMap, Overwrite, Destination)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Data | Required | String | The data to import.
ImportMap | Required | XmlMap | The schema map to apply when importing the file.
Overwrite | Optional | Variant | If a value is not specified for the Destination parameter, then this parameter specifies whether or not to overwrite data that has been mapped to the schema map specified in the ImportMap parameter. Set to True to overwrite the data or False to append the new data to the existing data. The default value is True. If a value is specified for the Destination parameter, then this parameter specifies whether or not to overwrite existing data. Set to True to overwrite existing data or False to cancel the import if data would be overwritten. The default value is True.
Destination | Optional | Variant | Specifies the range where the list will be created. Excel only uses the top left corner of the range.

Return Value

XlXmlImportResult

Remarks

XlXmlImportResult can be one of the following XlXmlImportResult constants.

xlXmlImportElementsTruncated. The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess. The XML data file was successfully imported.

xlXmlImportValidationFailed. The data being imported failed schema validation, but was imported anyway.

Don't specify a value for the Destination parameter if you want to import data into an existing mapping.

The following conditions will cause the XmlImport method to generate run-time errors:

  • The specified XML data contains syntax errors.

  • The import process was cancelled because the specified data cannot fit into the worksheet.

  • If no qualifying maps are found and the destination range was not specified.

Use the XMLImport method of the Workbook object to import an XML data file into the current workbook.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook Events (Excel)

 Copy code hover
[image]

Workbook Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
AddinInstall | Occurs when the workbook is installed as an add-in
AddinUninstall | Occurs when the workbook is uninstalled as an add-in.
AfterSave | Occurs after the workbook is saved.
AfterXmlExport | Occurs after Microsoft Excel saves or exports XML data from the specified workbook.
AfterXmlImport | Occurs after an existing XML data connection is refreshed or after new XML data is imported into the specified Microsoft Excel workbook.
BeforeClose | Occurs before the workbook closes. If the workbook has been changed, this event occurs before the user is asked to save changes.
BeforePrint | Occurs before the workbook (or anything in it) is printed.
BeforeSave | Occurs before the workbook is saved.
BeforeXmlExport | Occurs before Microsoft Excel saves or exports XML data from the specified workbook.
BeforeXmlImport | Occurs before an existing XML data connection is refreshed or before new XML data is imported into a Microsoft Excel workbook.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
ModelChange | Occurs after the Excel data model is changed.
NewChart | Occurs when a new chart is created in the workbook.
NewSheet | Occurs when a new sheet is created in the workbook.
Open | Occurs when the workbook is opened.
PivotTableCloseConnection | Occurs after a PivotTable report closes the connection to its data source.
PivotTableOpenConnection | Occurs after a PivotTable report opens the connection to its data source.
RowsetComplete | The event is raised when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.
SheetActivate | Occurs when any sheet is activated.
SheetBeforeDelete |
SheetBeforeDoubleClick | Occurs when any worksheet is double-clicked, before the default double-click action.
SheetBeforeRightClick | Occurs when any worksheet is right-clicked, before the default right-click action.
SheetCalculate | Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.
SheetChange | Occurs when cells in any worksheet are changed by the user or by an external link.
SheetDeactivate | Occurs when any sheet is deactivated.
SheetFollowHyperlink | Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.
SheetLensGalleryRenderComplete | Occurs when a callout gallery's icons (dynamic & static) have completed rendering for a worksheet.
SheetPivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
SheetPivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
SheetPivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
SheetPivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
SheetPivotTableChangeSync | Occurs after changes to a PivotTable.
SheetPivotTableUpdate | Occurs after the sheet of the PivotTable report has been updated.
SheetSelectionChange | Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).
SheetTableUpdate | Occurs after the sheet table has been updated.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
WindowActivate | Occurs when any workbook window is activated.
WindowDeactivate | Occurs when any workbook window is deactivated.
WindowResize | Occurs when any workbook window is resized.


Workbook.Activate Event (Excel)

 Copy code hover
[image]

Workbook.Activate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.

Syntax

expression .Activate

expression A variable that represents a Workbook object.

Return Value

nothing

Remarks

This event doesn't occur when you create a new window.

When you switch between two windows showing the same workbook, the WindowActivate event occurs, but the Activate event for the workbook doesn't occur.

Example

This example sorts the range A1:A10 when the worksheet is activated.

VBA Copy code Copy code
Private Sub Worksheet_Activate()
 Range("a1:a10").Sort Key1:=Range("a1"), Order1:=xlAscending
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AddinInstall Event (Excel)

 Copy code hover
[image]

Workbook.AddinInstall Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the workbook is installed as an add-in

Syntax

expression .AddinInstall

expression A variable that represents a Workbook object.

Return Value

Nothing

Example

This example adds a control to the standard toolbar when the workbook is installed as an add-in.

VBA Copy code Copy code
Private Sub Workbook_AddinInstall()
 With Application.Commandbars("Standard").Controls.Add
 .Caption = "The AddIn's menu item"
 .OnAction = "'ThisAddin.xls'!Amacro"
 End With End Sub
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AddinUninstall Event (Excel)

 Copy code hover
[image]

Workbook.AddinUninstall Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the workbook is uninstalled as an add-in.

Syntax

expression .AddinUninstall

expression A variable that represents a Workbook object.

Return Value

Nothing

Remarks

The add-in doesn't automatically close when it's uninstalled.

Example

This example minimizes Microsoft Excel when the workbook is uninstalled as an add-in.

VBA Copy code Copy code
Private Sub Workbook_AddinUninstall()
 Application.WindowState = xlMinimized
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AfterSave Event (Excel)

 Copy code hover
[image]

Workbook.AfterSave Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the workbook is saved.

Version Information

Version Added: Excel 2010

Syntax

expression .AfterSave(Success)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Success | Required | Boolean | Returns True if the save operation was successful; otherwise False.

Return Value

Nothing

Example

The following code example displays a message box if the workbook was successfully saved.

VBA Copy code Copy code
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
If Success Then
 MsgBox ("The workbook was successfully saved.")
End If
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.AfterXmlExport Event (Excel)

 Copy code hover
[image]

Workbook.AfterXmlExport Event (Excel)
Send feedback

Published: July 16, 2012

Occurs after Microsoft Excel saves or exports XML data from the specified workbook.

Syntax

expression .AfterXmlExport(Map, Url, Result)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Map | Required | XmlMap | The schema map that was used to save or export data.
Url | Required | String | The location of the XML file that was exported.
Result | Required | XlXmlExportResult | Indicates the results of the save or export operation.

Return Value

Nothing

Remarks

XlXmlExportResult can be one of the following XlXmlExportResult constants:

xlXmlExportSuccess. The XML data file was successfully exported.

xlXmlExportValidationFailed. The contents of the XML data file do not match the specified schema map.


Workbook.AfterXmlImport Event (Excel)

 Copy code hover
[image]

Workbook.AfterXmlImport Event (Excel)
Send feedback

Published: July 16, 2012

Occurs after an existing XML data connection is refreshed or after new XML data is imported into the specified Microsoft Excel workbook.

Syntax

expression .AfterXmlImport(Map, IsRefresh, Result)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Map | Required | XmlMap | The XML map that will be used to import data.
IsRefresh | Required | Boolean | True if the event was triggered by refreshing an existing connection to XML data; False if the event was triggered by importing from a different data source.
Result | Required | XlXmlImportResult | Indicates the results of the refresh or import operation.

Return Value

Nothing

Remarks

XlXmlImportResult can be one of the following XlXmlImportResult constants:

xlXmlImportElementsTruncated. The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess. The XML data file was successfully imported.

xlXmlImportValidationFailed. The contents of the XML data file do not match the specified schema map.


Workbook.BeforeClose Event (Excel)

 Copy code hover
[image]

Workbook.BeforeClose Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before the workbook closes. If the workbook has been changed, this event occurs before the user is asked to save changes.

Syntax

expression .BeforeClose(Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the close operation stops and the workbook is left open.

Return Value

Nothing

Example

This example always saves the workbook if it's been changed.

VBA Copy code Copy code
Private Sub Workbook_BeforeClose(Cancel as Boolean)
 If Me.Saved = False Then Me.Save
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.BeforePrint Event (Excel)

 Copy code hover
[image]

Workbook.BeforePrint Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before the workbook (or anything in it) is printed.

Syntax

expression .BeforePrint(Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the workbook isn't printed when the procedure is finished.

Return Value

Nothing

Example

This example recalculates all worksheets in the active workbook before printing anything.

VBA Copy code Copy code
Private Sub Workbook_BeforePrint(Cancel As Boolean)
 For Each wk in Worksheets
 wk.Calculate
 Next
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.BeforeSave Event (Excel)

 Copy code hover
[image]

Workbook.BeforeSave Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before the workbook is saved.

Syntax

expression .BeforeSave(SaveAsUI, Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
SaveAsUI | Required | Boolean | True if the Save As dialog box will be displayed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the workbook isn't saved when the procedure is finished.

Return Value

Nothing

Example

This example prompts the user for a yes or no response before saving the workbook.

VBA Copy code Copy code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
        Cancel as Boolean)
    a = MsgBox("Do you really want to save the workbook?", vbYesNo)
    If a = vbNo Then Cancel = True
End Sub

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example uses the BeforeSave event to verify that certain cells contain data before the workbook can be saved. The workbook cannot be saved until there is data in each of the following cells: D5, D7, D9, D11, D13, and D15.

VBA Copy code Copy code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
   'If the six specified cells do not contain data, then display a message box with an error
   'and cancel the attempt to save.
   If WorksheetFunction.CountA(Worksheets("Sheet1").Range("D5,D7,D9,D11,D13, D15")) < 6 Then
      MsgBox "Workbook will not be saved unless" & vbCrLf & _
      "All required fields have been filled in!"
      Cancel = True
   End If
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.BeforeXmlExport Event (Excel)

 Copy code hover
[image]

Workbook.BeforeXmlExport Event (Excel)
Send feedback

Published: July 16, 2012

Occurs before Microsoft Excel saves or exports XML data from the specified workbook.

Syntax

expression .BeforeXmlExport(Map, Url, Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Map | Required | XmlMap | The XML map that will be used to save or export data.
Url | Required | String | The location where you want to export the resulting XML file.
Cancel | Required | Boolean | Set to True to cancel the save or export operation

Return Value

Nothing

Remarks

This event will not occur when you are saving to the XML Spreadsheet file format.


Workbook.BeforeXmlImport Event (Excel)

 Copy code hover
[image]

Workbook.BeforeXmlImport Event (Excel)
Send feedback

Published: July 16, 2012

Occurs before an existing XML data connection is refreshed or before new XML data is imported into a Microsoft Excel workbook.

Syntax

expression .BeforeXmlImport(Map, Url, IsRefresh, Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Map | Required | XmlMap | The XML map that will be used to import data.
Url | Required | String | The location of the XML file to be imported.
IsRefresh | Required | Boolean | True if the event was triggered by refreshing an existing connection to XML data; False if the event was triggered by importing from a different data source.
Cancel | Required | Boolean | Set to True to cancel the import or refresh operation.

Return Value

Nothing


Workbook.Deactivate Event (Excel)

 Copy code hover
[image]

Workbook.Deactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the chart, worksheet, or workbook is deactivated.

Syntax

expression .Deactivate

expression A variable that represents a Workbook object.

Return Value

nothing

Example

This example arranges all open windows when the workbook is deactivated.

VBA Copy code Copy code
Private Sub Workbook_Deactivate()
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.ModelChange Event (Excel)

 Copy code hover
[image]

Workbook.ModelChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the Excel data model is changed.

Version information

Version Added: Excel 2013

Syntax

expression .ModelChange(Changes)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data type | Description
Changes | Required | MODELCHANGES | ModelChanges Object (Excel) object which includes changes made to the Excel data model during the last transaction.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.NewChart Event (Excel)

 Copy code hover
[image]

Workbook.NewChart Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a new chart is created in the workbook.

Version Information

Version Added: Excel 2010

Syntax

expression .NewChart(Ch )

expression A variable that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Ch | Required | Chart | The new chart.

Return Value

Nothing

Remarks

The NewChart event occurs whenever a new chart is inserted or pasted in a worksheet, a chart sheet, or other sheet types. If multiple charts are inserted or pasted, the event will occur for each chart in the order they are inserted or pasted. If a chart object or chart sheet is moved from one location to another, the event will not occur. However, if the chart is moved between a chart object and a chart sheet, the event will occur because a new chart must be created.

The NewChart event will not occur in the following scenarios: copying or pasting a chart sheet, changing a chart type, changing a chart data source, undoing or redoing inserting or pasting a chart, and loading a workbook that contains a chart.

Example

This example displays a message box when a new chart is added to the workbook.

VBA Copy code Copy code
Private Sub Workbook_NewChart(ByVal Ch As Chart)
 MsgBox ("A new chart of the following chart type was added: " & Ch.ChartType)
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.NewSheet Event (Excel)

 Copy code hover
[image]

Workbook.NewSheet Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a new sheet is created in the workbook.

Syntax

expression .NewSheet(Sh)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The new sheet. Can be a Worksheet or Chart object.

Return Value

Nothing

Example

This example moves new sheets to the end of the workbook.

VBA Copy code Copy code
Private Sub Workbook_NewSheet(ByVal Sh as Object)
 Sh.Move After:= Sheets(Sheets.Count)
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Open Event (Excel)

 Copy code hover
[image]

Workbook.Open Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the workbook is opened.

Syntax

expression .Open

expression An expression that returns a Workbook object.

Example

This example maximizes Microsoft Excel whenever the workbook is opened.

VBA Copy code Copy code
Private Sub Workbook_Open()
 Application.WindowState = xlMaximized
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PivotTableCloseConnection Event (Excel)

 Copy code hover
[image]

Workbook.PivotTableCloseConnection Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a PivotTable report closes the connection to its data source.

Syntax

expression .PivotTableCloseConnection(Target)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | PivotTable | The selected PivotTable report.
Target | Required | PIVOTTABLE |

Return Value

Nothing

Example

This example displays a message stating that the PivotTable report's connection to its source has been closed. This example assumes you have declared an object of type Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_PivotTableCloseConnection(ByVal Target As PivotTable)

 MsgBox "The PivotTable connection has been closed."

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.PivotTableOpenConnection Event (Excel)

 Copy code hover
[image]

Workbook.PivotTableOpenConnection Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a PivotTable report opens the connection to its data source.

Syntax

expression .PivotTableOpenConnection(Target)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | PivotTable | The selected PivotTable report.
Target | Required | PIVOTTABLE |

Return Value

Nothing

Example

This example displays a message stating that the PivotTable report's connection to its source has been opened. This example assumes you have declared an object of type Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_PivotTableOpenConnection(ByVal Target As PivotTable)

 MsgBox "The PivotTable connection has been opened."

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.RowsetComplete Event (Excel)

 Copy code hover
[image]

Workbook.RowsetComplete Event (Excel)
See also Send feedback

Published: July 16, 2012

The event is raised when the user either drills through the recordset or invokes the rowset action on an OLAP PivotTable.

Version Information

Version Added: Excel 2007

Syntax

expression .RowsetComplete(Description, Sheet, Success)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Description | Required | String | A brief description of the event.
Sheet | Required | String | Worksheet on which the recordset is created.
Success | Required | Boolean | Contains a Boolean value to indicate success or failure.

Remarks

Because the recordset is created asynchronously, the event allows automation to determine when the action has been completed. Additionally, because the recordset is created on a separate sheet, the event needs to be on the workbook level.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetActivate Event (Excel)

 Copy code hover
[image]

Workbook.SheetActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any sheet is activated.

Syntax

expression .SheetActivate(Sh )

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The activated sheet. Can be a Chart or Worksheet object.

Example

This example displays the name of each activated sheet.

VBA Copy code Copy code
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
 MsgBox Sh.Name
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetBeforeDelete Event (Excel)

 Copy code hover
[image]

Workbook.SheetBeforeDelete Event (Excel)
See also Send feedback

Occurs when any sheet is deleted.

Syntax

expression .SheetBeforeDelete(Sh, )

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The sheet. Can be a Chart or Worksheet object.

Example

This example displays the name of each deactivated sheet.

VBA Copy code Copy code
Private Sub Workbook_SheetBeforeDelete(ByVal Sh As Object)
 MsgBox Sh.Name
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetBeforeDoubleClick Event (Excel)

 Copy code hover
[image]

Workbook.SheetBeforeDoubleClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any worksheet is double-clicked, before the default double-click action.

Syntax

expression .SheetBeforeDoubleClick(Sh, Target, Cancel)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The cell nearest to the mouse pointer when the double-click occurred.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default double-click action isn't performed when the procedure is finished.

Remarks

This event doesn't occur on chart sheets.

Example

This example disables the default double-click action.

VBA Copy code Copy code
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
 ByVal Target As Range, ByVal Cancel As Boolean)
 Cancel = True
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetBeforeRightClick Event (Excel)

 Copy code hover
[image]

Workbook.SheetBeforeRightClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any worksheet is right-clicked, before the default right-click action.

Syntax

expression .SheetBeforeRightClick(Sh, Target, Cancel)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The cell nearest to the mouse pointer when the right-click occurred.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default right-click action isn't performed when the procedure is finished.

Remarks

This event doesn't occur on chart sheets.

Example

This example disables the default right-click action. For another example, see the BeforeRightClick event example.

VBA Copy code Copy code
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _
 ByVal Target As Range, ByVal Cancel As Boolean)
 Cancel = True
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetCalculate Event (Excel)

 Copy code hover
[image]

Workbook.SheetCalculate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.

Syntax

expression .SheetCalculate(Sh, )

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | Can be a Chart or Worksheet object.

Example

This example sorts the range A1:A100 on worksheet one when any sheet in the workbook is calculated.

VBA Copy code Copy code
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
 With Worksheets(1)
 .Range("a1:a100").Sort Key1:=.Range("a1")
 End With
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetChange Event (Excel)

 Copy code hover
[image]

Workbook.SheetChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when cells in any worksheet are changed by the user or by an external link.

Syntax

expression .SheetChange(Sh, Target)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | A Worksheet object that represents the sheet.
Target | Required | Range | The changed range.

Remarks

This event doesn't occur on chart sheets.

Example

This example runs when any worksheet is changed.

VBA Copy code Copy code
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
 ByVal Source As Range)
 ' runs when a sheet is changed
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetDeactivate Event (Excel)

 Copy code hover
[image]

Workbook.SheetDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any sheet is deactivated.

Syntax

expression .SheetDeactivate(Sh, )

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The sheet. Can be a Chart or Worksheet object.

Example

This example displays the name of each deactivated sheet.

VBA Copy code Copy code
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
 MsgBox Sh.Name
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetFollowHyperlink Event (Excel)

 Copy code hover
[image]

Workbook.SheetFollowHyperlink Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when you click any hyperlink in Microsoft Excel. For worksheet-level events, see the Help topic for the FollowHyperlink event.

Syntax

expression .SheetFollowHyperlink(Sh, Target)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The Worksheet object that contains the hyperlink.
Target | Required | Hyperlink | The Hyperlink object that represents the destination of the hyperlink.

Example

This example keeps a list, or history, of all the hyperlinks in the current workbook that have been clicked, plus the names of the worksheets that contain these hyperlinks.

VBA Copy code Copy code
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh as Object, _
 ByVal Target As Hyperlink)
 UserForm1.ListBox1.AddItem Sh.Name & ":" & Target.Address
 UserForm1.Show
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetLensGalleryRenderComplete Event (Excel)

 Copy code hover
[image]

Workbook.SheetLensGalleryRenderComplete Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a callout gallery's icons (dynamic & static) have completed rendering for a worksheet.

Version information

Version Added: Excel 2013

Syntax

expression .SheetLensGalleryRenderComplete(Sh)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data type | Description
Sh | Required | OBJECT | A worksheet object.

Remarks

This event can be used to indicate when re-enable screen updating or display additional dialogs, for example.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableAfterValueChange Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableAfterValueChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableAfterValueChange(Sh, TargetPivotTable, TargetRange)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
TargetPivotTable | Required | PivotTable | The PivotTable that contains the edited or recalculated cells.
TargetRange | Required | Range | The range that contains all the edited or recalcuated cells.

Return Value

Nothing

Remarks

The PivotTableAfterValueChange event does not occur under any conditions other than editing or recalculating cells. For example, it will not occur when the PivotTable is refreshed, sorted, filtered, or drilled down on, even though those operations move cells and potentially retrieve new values from the OLAP data source.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableBeforeAllocateChanges Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableBeforeAllocateChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are applied to a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeAllocateChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to apply.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not applied to the PivotTable and all edits are lost.

Return Value

Nothing

Remarks

The SheetPivotTableBeforeAllocateChanges event occurs immediately before Excel executes an UPDATE CUBE statement to apply all changes to the PivotTable's OLAP data source, and immediately after the user has chosen to apply changes in the user interface.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableBeforeCommitChanges Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableBeforeCommitChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are committed against the OLAP data source for a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeCommitChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to commit.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not committed against the OLAP data source of the PivotTable.

Return Value

Nothing

Remarks

The SheetPivotTableBeforeCommitChanges event occurs immediately before Excel executes a COMMIT TRANSACTION against the PivotTable's OLAP data source, and immediately after the user has chosen to save changes for the whole PivotTable.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableBeforeDiscardChanges Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableBeforeDiscardChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes to a PivotTable are discarded.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableBeforeDiscardChanges(Sh, TargetPivotTable, ValueChangeStart, ValueChangeEnd)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object |
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to discard.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.

Return Value

Nothing

Remarks

Occurs immediately before Excel executes a ROLLBACK TRANSACTION statement against the OLAP data source, if a transaction is still active, and then discards all edited values in the PivotTable, after the user has chosen to discard changes.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableChangeSync Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableChangeSync Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after changes to a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .SheetPivotTableChangeSync(Sh, Target)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the PivotTable.
Target | Required | PivotTable | The PivotTable that was changed.

Return Value

Nothing

Remarks

The PivotTableChangeEvent occurs during most changes to a PivotTable, so that you can write code to respond to user actions, such as clearing, grouping, or refreshing items in the PivotTable.

Example

The following code example displays a message box that shows the name of the PivotTable the user changed.

VBA Copy code Copy code
Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Target, Target As PivotTable)

With Target
 MsgBox "You performed an operation in the following PivotTable: " & .Name & " on " & Sh.Name
End With

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetPivotTableUpdate Event (Excel)

 Copy code hover
[image]

Workbook.SheetPivotTableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the sheet of the PivotTable report has been updated.

Syntax

expression .SheetPivotTableUpdate(Sh, Target)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The selected sheet.
Target | Required | PivotTable | The selected PivotTable report.

Example

This example displays a message stating that the sheet of the PivotTable report has been updated. This example assumes you have declared an object of type Application or Workbook with events in a class module.

VBA Copy code Copy code
Private Sub ConnectionApp_SheetPivotTableUpdate(ByVal shOne As Object, Target As PivotTable)

 MsgBox "The SheetPivotTable connection has been updated."

End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetSelectionChange Event (Excel)

 Copy code hover
[image]

Workbook.SheetSelectionChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the selection changes on any worksheet (doesn't occur if the selection is on a chart sheet).

Syntax

expression .SheetSelectionChange(Sh, Target)

expression An expression that returns a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Sh | Required | Object | The worksheet that contains the new selection.
Target | Required | Range | The new selected range.

Example

This example displays the sheet name and address of the selected range in the status bar.

VBA Copy code Copy code
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
 ByVal Target As Excel.Range)
 Application.StatusBar = Sh.Name & ":" & Target.Address
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.SheetTableUpdate Event (Excel)

 Copy code hover
[image]

Workbook.SheetTableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the sheet table has been updated.

Version information

Version Added: Excel 2013

Syntax

expression .SheetTableUpdate(Sh,Target)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data type | Description
Sh | Required | OBJECT | The selected sheet.
Target | Required | TABLEOBJECT | The selected table.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.Sync Event (Excel)

 Copy code hover
[image]

Workbook.Sync Event (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


Workbook.WindowActivate Event (Excel)

 Copy code hover
[image]

Workbook.WindowActivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is activated.

Syntax

expression .WindowActivate(Wn)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Wn | Required | Window | The activated window.

Example

This example maximizes any workbook window when it's activated.

VBA Copy code Copy code
Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window)
 Wn.WindowState = xlMaximized
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WindowDeactivate Event (Excel)

 Copy code hover
[image]

Workbook.WindowDeactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is deactivated.

Syntax

expression .WindowDeactivate(Wn)

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Wn | Required | Window | The deactivated window.

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


Workbook.WindowResize Event (Excel)

 Copy code hover
[image]

Workbook.WindowResize Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when any workbook window is resized.

Syntax

expression .WindowResize(Wn )

expression A variable that represents a Workbook object.

Parameters

Name | Required/Optional | Data Type | Description
Wn | Required | Window | The resized window.

Example

This example runs when any workbook window is resized.

VBA Copy code Copy code
Private Sub Workbook_WindowResize(ByVal Wn As Excel.Window)
 Application.StatusBar = Wn.Caption & " resized"
End Sub

See also

Concepts

Workbook Object

Other resources

Workbook Object Members


WorkbookConnection Object (Excel)

 Copy code hover
[image]

WorkbookConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

A connection is a set of information needed to obtain data from an external data source other than an Microsoft Office Excel 2007 workbook.

Version Information

Version Added: Excel 2007

Remarks

Connections can be stored within an Excel workbook. When the workbook is opened, Excel creates an in-memory copy of the connection which is refered to as the connection object. A connection object contains information such as the name of the server and the name of the object to be opened on that server. Optionally, the connection object may also include authentication credentials and/or a command that is to be passed to the server and executed (example: a SELECT statement to be executed by SQL Server.)

Note Note

The exact form of the connection depends on the mechanism that is being used to retrieve data - ODBC connections, OLEDB connections, and Web Queries will contain different information.

A connection may also be stored in a separate connection file. Most connections in an Excel workbook include a pointer to an external connection file. Connection files have extensions that clearly label them as connection files (*.ODC, *.IQY, etc.) and may be located on the user's local machine or in other well known or trusted locations such as WSS (Data Connection Library), or other corporate servers. Connection files enable multiple users within the same organization to re-use connections. Network administrators are able to change the way the entire organization connects to a back-end data source by changing a single connection file. A connection file is not always required when connecting to an external data source.

Connection names are strings that uniquely identify connections within the workbook in which they are used. There are other properties of a connection that are not unique. Whenever a formula in Excel takes an argument that is a connection, it will be sufficient to refer to the name of that connection, either directly (as a string) or indirectly (by referring to a cell that contains the connection name as a string.)

See also

Concepts

Excel Object Model Reference

Other resources

WorkbookConnection Object Members


WorkbookConnection Members (Excel)

 Copy code hover
[image]

WorkbookConnection Members (Excel)
Send feedback

Published: July 16, 2012

A connection is a set of information needed to obtain data from an external data source other than an Microsoft Office Excel 2007 workbook.

Methods

Name | Description
Delete | Deletes a workbook connection.
Refresh | Refreshes a workbook connection.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataFeedConnection | Returns a DataFeedConnection object that contains the data and functionality needed to connect to data feeds. Read-only
Description | Returns or sets a brief description for a WorkbookConnection object. Read/write String.
InModel | Specifies whether or not the WorkbookConnection Object (Excel) has been added to the model. Boolean Read-only
ModelConnection | Returns an object that contains information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated Data Model. Read-only
ModelTables | Returns a ModelTables Object (Excel) object associated with the particular connection. Read-only
Name | Returns or sets the name of the workbook connection object. Read/write String.
ODBCConnection | Retuns the ODBC Connection details for the specified WorkbookConnection object. Read-only ODBCConnection.
OLEDBConnection | Retuns the OLEDB Connection details for the specified WorkbookConnection object. Read-only OLEDBConnection.
Parent | Returns the parent object for the specified object. Read-only.
Ranges | Returns the range of object for the specified WorkbookConnection object. Read-only Ranges.
RefreshWithRefreshAll | Determines if the connection should be refreshed when refresh all is executed. Boolean. Read/Write
TextConnection | Returns a TextConnection Object (Excel) object that contains the information on a query to a text file. Read-only
Type | Returns the workbook connection type. Read-only XlConnectionType.
WorksheetDataConnection | Returns an object that contains information for a connection from the PowerPivot Model to data within the workbook such as a range, named range, or table. Read-only


WorkbookConnection Properties (Excel)

 Copy code hover
[image]

WorkbookConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataFeedConnection | Returns a DataFeedConnection object that contains the data and functionality needed to connect to data feeds. Read-only
Description | Returns or sets a brief description for a WorkbookConnection object. Read/write String.
InModel | Specifies whether or not the WorkbookConnection Object (Excel) has been added to the model. Boolean Read-only
ModelConnection | Returns an object that contains information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated Data Model. Read-only
ModelTables | Returns a ModelTables Object (Excel) object associated with the particular connection. Read-only
Name | Returns or sets the name of the workbook connection object. Read/write String.
ODBCConnection | Retuns the ODBC Connection details for the specified WorkbookConnection object. Read-only ODBCConnection.
OLEDBConnection | Retuns the OLEDB Connection details for the specified WorkbookConnection object. Read-only OLEDBConnection.
Parent | Returns the parent object for the specified object. Read-only.
Ranges | Returns the range of object for the specified WorkbookConnection object. Read-only Ranges.
RefreshWithRefreshAll | Determines if the connection should be refreshed when refresh all is executed. Boolean. Read/Write
TextConnection | Returns a TextConnection Object (Excel) object that contains the information on a query to a text file. Read-only
Type | Returns the workbook connection type. Read-only XlConnectionType.
WorksheetDataConnection | Returns an object that contains information for a connection from the PowerPivot Model to data within the workbook such as a range, named range, or table. Read-only


WorkbookConnection.Application Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a WorkbookConnection object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Creator Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a WorkbookConnection object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.DataFeedConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.DataFeedConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a DataFeedConnection object that contains the data and functionality needed to connect to data feeds. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .DataFeedConnection

expression A variable that represents a WorkbookConnection Object (Excel) object.

Property value

DATAFEEDCONNECTION

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Description Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Description Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a brief description for a WorkbookConnection object. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .Description

expression A variable that represents a WorkbookConnection object.

Remarks

In the Connection Properties dialog box, the user may edit the name of the connection and/or the description. Changing the name and description in this dialog box changes those fields only within the Excel connection object.

The maximum size of a description is 255 characters. If the user specifies a description within a connection file that is longer than 255 characters, the description is truncate to fit the 255 character limit.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.InModel Property (Excel)

 Copy code hover
[image]

WorkbookConnection.InModel Property (Excel)
See also Send feedback

Published: July 16, 2012

Specifies whether or not the WorkbookConnection Object (Excel) has been added to the model. Boolean Read-only

Version information

Version Added: Excel 2013

Syntax

expression .InModel

expression A variable that represents a WorkbookConnection Object (Excel) object.

Remarks

Must be false for legacy connections.

Property value

BOOL

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.ModelConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.ModelConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that contains information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated Data Model. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ModelConnection

expression A variable that represents a WorkbookConnection object.

Property value

MODELCONNECTION

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.ModelTables Property (Excel)

 Copy code hover
[image]

WorkbookConnection.ModelTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a ModelTables Object (Excel) object associated with the particular connection. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .ModelTables

expression A variable that represents a WorkbookConnection object.

Property value

MODELTABLES

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Name Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the workbook connection object. Read/write String.

Version Information

Version Added: Excel 2007

Syntax

expression .Name

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.ODBCConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.ODBCConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Retuns the ODBC Connection details for the specified WorkbookConnection object. Read-only ODBCConnection.

Version Information

Version Added: Excel 2007

Syntax

expression .ODBCConnection

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.OLEDBConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.OLEDBConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Retuns the OLEDB Connection details for the specified WorkbookConnection object. Read-only OLEDBConnection.

Version Information

Version Added: Excel 2007

Syntax

expression .OLEDBConnection

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Parent Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Ranges Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Ranges Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the range of object for the specified WorkbookConnection object. Read-only Ranges.

Version Information

Version Added: Excel 2007

Syntax

expression .Ranges

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.RefreshWithRefreshAll Property (Excel)

 Copy code hover
[image]

WorkbookConnection.RefreshWithRefreshAll Property (Excel)
See also Send feedback

Published: July 16, 2012

Determines if the connection should be refreshed when refresh all is executed. Boolean. Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .RefreshWithRefreshAll

expression A variable that represents a WorkbookConnection object.

Remarks

If TRUE is returned then the connection is refreshed. If FALSE is returned then the connection will not be refreshed. The default value is TRUE.

Property value

BOOL

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.TextConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.TextConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a TextConnection Object (Excel) object that contains the information on a query to a text file. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .TextConnection

expression A variable that represents a WorkbookConnection object.

Property value

TEXTCONNECTION

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Type Property (Excel)

 Copy code hover
[image]

WorkbookConnection.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the workbook connection type. Read-only XlConnectionType.

Version Information

Version Added: Excel 2007

Syntax

expression .Type

expression A variable that represents a WorkbookConnection object.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.WorksheetDataConnection Property (Excel)

 Copy code hover
[image]

WorkbookConnection.WorksheetDataConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that contains information for a connection from the PowerPivot Model to data within the workbook such as a range, named range, or table. Read-only

Version information

Version Added: Excel 2013

Syntax

expression .WorksheetDataConnection

expression A variable that represents a WorkbookConnection Object (Excel) object.

Property value

WORKSHEETDATACONNECTION

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection Methods (Excel)

 Copy code hover
[image]

WorkbookConnection Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes a workbook connection.
Refresh | Refreshes a workbook connection.


WorkbookConnection.Delete Method (Excel)

 Copy code hover
[image]

WorkbookConnection.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes a workbook connection.

Version Information

Version Added: Excel 2007

Syntax

expression .Delete

expression A variable that represents a WorkbookConnection object.

Remarks

Use this method to delete an external data connection. This method does not apply to links to other workbooks.

Deleting a connection will not delete or remove any objects that were using that connection. Deleting a connection will not cause any of the connection files to be deleted from the file system. If you edit any of those objects to use another connection, everything will start working again.

Objects that use a deleted connection behave as if the connection could not be established.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


WorkbookConnection.Refresh Method (Excel)

 Copy code hover
[image]

WorkbookConnection.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Refreshes a workbook connection.

Version Information

Version Added: Excel 2007

Syntax

expression .Refresh

expression A variable that represents a WorkbookConnection object.

Remarks

If the DisplayAlerts property is False, dialog boxes are not displayed and the Refresh method fails with the Insufficient Connection Information exception.

A refresh failure for one connection will not have any impact on refresh operations for the other connections.

See also

Concepts

WorkbookConnection Object

Other resources

WorkbookConnection Object Members


Workbooks Object (Excel)

 Copy code hover
[image]

Workbooks Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Workbook objects that are currently open in the Microsoft Excel application.

Remarks

For more information about using a single Workbook object, see the Workbook object.

Example

Use the Workbooks property to return the Workbooks collection. The following example closes all open workbooks.

VBA Copy code Copy code
Workbooks.Close

Use the Add method to create a new, empty workbook and add it to the collection. The following example adds a new, empty workbook to Microsoft Excel.

VBA Copy code Copy code
Workbooks.Add

Use the Open method to open a file. This creates a new workbook for the opened file. The following example opens the file Array.xls as a read-only workbook.

VBA Copy code Copy code
Workbooks.Open FileName:="Array.xls", ReadOnly:=True

See also

Concepts

Excel Object Model Reference

Other resources

Workbooks Object Members


Workbooks Members (Excel)

 Copy code hover
[image]

Workbooks Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Workbook objects that are currently open in the Microsoft Excel application.

Methods

Name | Description
Add | Creates a new workbook. The new workbook becomes the active workbook.
CanCheckOut | True if Microsoft Excel can check out a specified workbook from a server. Read/write Boolean.
CheckOut | Returns a String representing a specified workbook from a server to a local computer for editing.
Close | Closes the object.
Open | Opens a workbook.
OpenDatabase | Returns a Workbook object representing a database.
OpenText | Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.
OpenXML | Opens an XML data file. Returns a Workbook object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Workbooks Properties (Excel)

 Copy code hover
[image]

Workbooks Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


Workbooks.Application Property (Excel)

 Copy code hover
[image]

Workbooks.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Workbooks object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Count Property (Excel)

 Copy code hover
[image]

Workbooks.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Workbooks object.

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Creator Property (Excel)

 Copy code hover
[image]

Workbooks.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Workbooks object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Item Property (Excel)

 Copy code hover
[image]

Workbooks.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Example

This example sets the wb variable to the workbook for Myaddin.xla.

VBA Copy code Copy code
Set wb = Workbooks.Item("myaddin.xla")

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Parent Property (Excel)

 Copy code hover
[image]

Workbooks.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Workbooks object.

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks Methods (Excel)

 Copy code hover
[image]

Workbooks Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new workbook. The new workbook becomes the active workbook.
CanCheckOut | True if Microsoft Excel can check out a specified workbook from a server. Read/write Boolean.
CheckOut | Returns a String representing a specified workbook from a server to a local computer for editing.
Close | Closes the object.
Open | Opens a workbook.
OpenDatabase | Returns a Workbook object representing a database.
OpenText | Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.
OpenXML | Opens an XML data file. Returns a Workbook object.


Workbooks.Add Method (Excel)

 Copy code hover
[image]

Workbooks.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new workbook. The new workbook becomes the active workbook.

Syntax

expression .Add(Template)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Template | Optional | Variant | Determines how the new workbook is created. If this argument is a string specifying the name of an existing Microsoft Excel file, the new workbook is created with the specified file as a template. If this argument is a constant, the new workbook contains a single sheet of the specified type. Can be one of the following XlWBATemplate constants: xlWBATChart, xlWBATExcel4IntlMacroSheet, xlWBATExcel4MacroSheet, or xlWBATWorksheet. If this argument is omitted, Microsoft Excel creates a new workbook with a number of blank sheets (the number of sheets is set by the SheetsInNewWorkbook property).

Return Value

A Workbook object that represents the new workbook.

Remarks

If the Template argument specifies a file, the file name can include a path.

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.CanCheckOut Method (Excel)

 Copy code hover
[image]

Workbooks.CanCheckOut Method (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel can check out a specified workbook from a server. Read/write Boolean.

Syntax

expression .CanCheckOut(Filename)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file to check out.

Return Value

Boolean

Example

This example verifies that a workbook is not checked out by another user and can be checked out. If the workbook can be checked out, it copies the workbook to the local computer for editing.

VBA Copy code Copy code
Sub UseCanCheckOut(docCheckOut As String)

 ' Determine if workbook can be checked out.
 If Workbooks.CanCheckOut(Filename:=docCheckOut) = True Then
 Workbooks.CheckOut (Filename:=docCheckOut)
 Else
 MsgBox "You are unable to check out this document at this time."
 End If

End Sub

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.CheckOut Method (Excel)

 Copy code hover
[image]

Workbooks.CheckOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String representing a specified workbook from a server to a local computer for editing.

Syntax

expression .CheckOut(Filename)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file to check out.

Example

This example verifies that a workbook is not checked out by another user and can be checked out. If the workbook can be checked out, it copies the workbook to the local computer for editing.

VBA Copy code Copy code
Sub UseCheckOut(docCheckOut As String)

 ' Determine if workbook can be checked out.
 If Workbooks.CanCheckOut(docCheckOut) = True Then
 Workbooks.CheckOut docCheckOut
 Else
 MsgBox "Unable to check out this document at this time."
 End If

End Sub

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Close Method (Excel)

 Copy code hover
[image]

Workbooks.Close Method (Excel)
See also Send feedback

Published: July 16, 2012

Closes the object.

Syntax

expression .Close

expression A variable that represents a Workbooks object.

Remarks

Closing a workbook from Visual Basic doesn't run any Auto_Close macros in the workbook. Use the RunAutoMacros method to run the auto close macros.

Example

This example closes all open workbooks. If there are changes in any open workbook, Microsoft Excel displays the appropriate prompts and dialog boxes for saving changes.

VBA Copy code Copy code
Workbooks.Close

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.Open Method (Excel)

 Copy code hover
[image]

Workbooks.Open Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens a workbook.

Syntax

expression .Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Optional | Variant | String. The file name of the workbook to be opened.
UpdateLinks | Optional | Variant | Specifies the way external references (links) in the file, such as the reference to a range in the Budget.xls workbook in the following formula =SUM([Budget.xls]Annual!C10:C25), are updated. If this argument is omitted, the user is prompted to specify how links will be updated. For more information about the values used by this parameter, see the Remarks section. If Microsoft Excel is opening a file in the WKS, WK1, or WK3 format and the UpdateLinks argument is 0, no charts are created; otherwise Microsoft Excel generates charts from the graphs attached to the file.
ReadOnly | Optional | Variant | True to open the workbook in read-only mode.
Format | Optional | Variant | If Microsoft Excel opens a text file, this argument specifies the delimiter character. If this argument is omitted, the current delimiter is used. For more information about the values used by this parameter, see the Remarks section.
Password | Optional | Variant | A string that contains the password required to open a protected workbook. If this argument is omitted and the workbook requires a password, the user is prompted for the password.
WriteResPassword | Optional | Variant | A string that contains the password required to write to a write-reserved workbook. If this argument is omitted and the workbook requires a password, the user will be prompted for the password.
IgnoreReadOnlyRecommended | Optional | Variant | True to have Microsoft Excel not display the read-only recommended message (if the workbook was saved with the Read-Only Recommended option).
Origin | Optional | Variant | If the file is a text file, this argument indicates where it originated, so that code pages and Carriage Return/Line Feed (CR/LF) can be mapped correctly. Can be one of the following XlPlatform constants: xlMacintosh, xlWindows, or xlMSDOS. If this argument is omitted, the current operating system is used.
Delimiter | Optional | Variant | If the file is a text file and the Format argument is 6, this argument is a string that specifies the character to be used as the delimiter. For example, use Chr(9) for tabs, use "," for commas, use ";" for semicolons, or use a custom character. Only the first character of the string is used.
Editable | Optional | Variant | If the file is a Microsoft Excel 4.0 add-in, this argument is True to open the add-in so that it is a visible window. If this argument is False or omitted, the add-in is opened as hidden, and it cannot be unhidden. This option does not apply to add-ins created in Microsoft Excel 5.0 or later. If the file is an Excel template, True to open the specified template for editing. False to open a new workbook based on the specified template. The default value is False.
Notify | Optional | Variant | If the file cannot be opened in read/write mode, this argument is True to add the file to the file notification list. Microsoft Excel will open the file as read-only, poll the file notification list, and then notify the user when the file becomes available. If this argument is False or omitted, no notification is requested, and any attempts to open an unavailable file will fail.
Converter | Optional | Variant | The index of the first file converter to try when opening the file. The specified file converter is tried first; if this converter does not recognize the file, all other converters are tried. The converter index consists of the row numbers of the converters returned by the FileConverters property.
AddToMru | Optional | Variant | True to add this workbook to the list of recently used files. The default value is False.
Local | Optional | Variant | True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically United States English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).
CorruptLoad | Optional | XlCorruptLoad | Can be one of the following constants: xlNormalLoad, xlRepairFile and xlExtractData. The default behavior if no value is specified is xlNormalLoad and does not attempt recovery when initiated through the OM.

Return Value

A Workbook object that represents the opened workbook.

Remarks

By default, macros are enabled when opening files programmatically. Use the AutomationSecurity property to set the macro security mode used when opening files programmatically.

You can specify one of the following values in the UpdateLinks parameter to determine whether external references (links) are updated when the workbook is opened.

Value | Meaning
0 | External references (links) will not be updated when the workbook is opened.
3 | External references (links) will be updated when the workbook is opened.

You can specify one of the following values in the Format parameter to determine the delimiter character for the file.

Value | Delimiter
1 | Tabs
2 | Commas
3 | Spaces
4 | Semicolons
5 | Nothing
6 | Custom character (see the Delimiter argument)

Example

The following code example opens the workbook Analysis.xls and then runs its Auto_Open macro.

VBA Copy code Copy code
Workbooks.Open "ANALYSIS.XLS"
ActiveWorkbook.RunAutoMacros xlAutoOpen

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example imports a sheet from another workbook onto a new sheet in the current workbook. Sheet1 in the current workbook must contain the path name of the workbook to import in cell D3, the file name in cell D4, and the worksheet name in cell D5. The imported worksheet is inserted after Sheet1 in the current workbook.

VBA Copy code Copy code
Sub ImportWorksheet()
    ' This macro will import a file into this workbook
    Sheets("Sheet1").Select
    PathName = Range("D3").Value
    Filename = Range("D4").Value
    TabName = Range("D5").Value
    ControlFile = ActiveWorkbook.Name
    Workbooks.Open Filename:=PathName & Filename
    ActiveSheet.Name = TabName
    Sheets(TabName).Copy After:=Workbooks(ControlFile).Sheets(1)
    Windows(Filename).Activate
    ActiveWorkbook.Close SaveChanges:=False
    Windows(ControlFile).Activate
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.OpenDatabase Method (Excel)

 Copy code hover
[image]

Workbooks.OpenDatabase Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Workbook object representing a database.

Syntax

expression .OpenDatabase(Filename, CommandText, CommandType, BackgroundQuery, ImportDataAs)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The connection string which contains the location and filename of the database.
CommandText | Optional | Variant | The command text of the query.
CommandType | Optional | Variant | The command type of the query. Specify one of the constants of the XlCmdType enumeration: xlCmdCube, xlCmdList, xlCmdSql, xlCmdTable, and xlCmdDefault.
BackgroundQuery | Optional | Variant | This parameter is a variant data type but you can only pass a Boolean value. If you pass True, the query is performed in the background (asynchronously). The default value is False.
ImportDataAs | Optional | Variant | This parameter uses one of the values of the XlImportDataAs enumeration. The two values of this enum are xlPivotTableReport and xlQueryTable. Pass one of these values to return the data as a PivotTable or QueryTable. The default value is xlQueryTable.

Return Value

Workbook

Example

In this example, Microsoft Excel opens the "northwind.mdb" file. This example assumes a file called "northwind.mdb file" exists on the C:\ drive.

VBA Copy code Copy code
Sub UseOpenDatabase()
 ' Open the Northwind database in the background and create a PivotTable
 Workbooks.OpenDatabase Filename:="c:\Northwind.mdb", _
 CommandText:="Orders", _
 CommandType:=xlCmdTable, _
 BackgroundQuery:=True, _
 ImportDataAs:=xlPivotTableReport
End Sub

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.OpenText Method (Excel)

 Copy code hover
[image]

Workbooks.OpenText Method (Excel)
See also Send feedback

Published: July 16, 2012

Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.

Syntax

expression .OpenText(Filename, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Specifies the file name of the text file to be opened and parsed.
Origin | Optional | Variant | Specifies the origin of the text file. Can be one of the following XlPlatform constants: xlMacintosh, xlWindows, or xlMSDOS. Additionally, this could be an integer representing the code page number of the desired code page. For example, "1256" would specify that the encoding of the source text file is Arabic (Windows). If this argument is omitted, the method uses the current setting of the File Origin option in the Text Import Wizard.
StartRow | Optional | Variant | The row number at which to start parsing text. The default value is 1.
DataType | Optional | Variant | Specifies the column format of the data in the file. Can be one of the following XlTextParsingType constants: xlDelimited or xlFixedWidth. If this argument is not specified, Microsoft Excel attempts to determine the column format when it opens the file.
TextQualifier | Optional | XlTextQualifier | Specifies the text qualifier.
ConsecutiveDelimiter | Optional | Variant | True to have consecutive delimiters considered one delimiter. The default is False.
Tab | Optional | Variant | True to have the tab character be the delimiter (DataType must be xlDelimited). The default value is False.
Semicolon | Optional | Variant | True to have the semicolon character be the delimiter (DataType must be xlDelimited). The default value is False.
Comma | Optional | Variant | True to have the comma character be the delimiter (DataType must be xlDelimited). The default value is False.
Space | Optional | Variant | True to have the space character be the delimiter (DataType must be xlDelimited). The default value is False.
Other | Optional | Variant | True to have the character specified by the OtherChar argument be the delimiter (DataType must be xlDelimited). The default value is False.
OtherChar | Optional | Variant | (required if Other is True). Specifies the delimiter character when Other is True. If more than one character is specified, only the first character of the string is used; the remaining characters are ignored.
FieldInfo | Optional | Variant | An array containing parse information for individual columns of data. The interpretation depends on the value of DataType. When the data is delimited, this argument is an array of two-element arrays, with each two-element array specifying the conversion options for a particular column. The first element is the column number (1-based), and the second element is one of the XlColumnDataType constants specifying how the column is parsed.
TextVisualLayout | Optional | Variant | The visual layout of the text.
DecimalSeparator | Optional | Variant | The decimal separator that Microsoft Excel uses when recognizing numbers. The default setting is the system setting.
ThousandsSeparator | Optional | Variant | The thousands separator that Excel uses when recognizing numbers. The default setting is the system setting.
TrailingMinusNumbers | Optional | Variant | Specify True if numbers with a minus character at the end should be treated as negative numbers. If False or omitted, numbers with a minus character at the end are treated as text.
Local | Optional | Variant | Specify True if regional settings of the machine should be used for separators, numbers and data formatting.

Remarks

FieldInfo Parameter Information

You can use xlEMDFormat only if you have installed and selected Taiwanese language support. The xlEMDFormat constant specifies that Taiwanese era dates are being used.

The column specifiers can be in any order. If there's no column specifier for a particular column in the input data, the column is parsed with the General setting.

Note Note

  • If you specify that a column is to be skipped, you must explicitly state the type for all remaining columns or the data will not parse correctly.

  • If there is a recognizible date in the data, the cell will be formatted as a date in the worksheet even if the setting for the column is General. Additionally, if you specify one of the above date formats for a column and the data does not contain a recognized date, then the cell format in the worksheet will be General.

This example causes the third column to be parsed as MDY (for example, 01/10/1970), the first column to be parsed as text, and the remaining columns in the source data to be parsed with the General setting.

VBA Copy code Copy code
Array(Array(3, 3), Array(1, 2))

If the source data has fixed-width columns, the first element in each two-element array specifies the position of the starting character in the column (as an integer; character 0 (zero) is the first character). The second element in the two-element array specifies the parse option for the column as a number between 0 and 9, as listed in the preceding table.

ThousandsSeparator Parameter Information

The following table shows the results of importing text into Excel for various import settings. Numeric results are displayed in the rightmost column.

System decimal separator | System thousands separator | Decimal separator value | Thousands separator value | Text imported | Cell value (data type)
Period | Comma | Comma | Period | 123.123,45 | 123,123.45 (numeric)
Period | Comma | Comma | Comma | 123.123,45 | 123.123,45 (text)
Comma | Period | Period | Comma | 123,123.45 | 123,123.45 (numeric)
Period | Comma | Period | Comma | 123 123.45 | 123 123.45 (text)
Period | Comma | Period | Space | 123 123.45 | 123,123.45 (numeric)

Example

This example opens the file Data.txt and uses tab delimiters to parse the text file into a worksheet.

VBA Copy code Copy code
Workbooks.OpenText filename:="DATA.TXT", _
    dataType:=xlDelimited, tab:=True

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Workbooks.OpenXML Method (Excel)

 Copy code hover
[image]

Workbooks.OpenXML Method (Excel)
See also Send feedback

Published: July 16, 2012

Opens an XML data file. Returns a Workbook object.

Syntax

expression .OpenXML(Filename, Stylesheets, LoadOption)

expression A variable that represents a Workbooks object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file to open.
Stylesheets | Optional | Variant | Either a single value or an array of values that specify which XSL Transformation (XSLT) stylesheet processing instructions to apply.
LoadOption | Optional | Variant | Specifies how Excel opens the XML data file. Can be one of the XlXmlLoadOption constants.

Return Value

Workbook

Remarks

XlXmlLoadOption can be one of these XlXmlLoadOption constants.

xlXmlLoadImportToList Automatically creates an XML List and imports data into the list.

xlXmlLoadMapXml Loads the XML file into the XML Source task pane.

xlXmlLoadOpenXml Open XML files in the same way that Excel 2002 opens XML files (for backwards compatibility only).

xlXmlLoadPromptUser Prompts the user and lets them choose the Import method.

Example

The following code opens the XML data file "customers.xml" and displays the file's contents in an XML list.

VBA Copy code Copy code
Sub UseOpenXML()
 Application.Workbooks.OpenXML _
 Filename:="customers.xml", _
 LoadOption:=xlXmlLoadImportToList
End Sub

See also

Concepts

Workbooks Object

Other resources

Workbooks Object Members


Worksheet Object (Excel)

 Copy code hover
[image]

Worksheet Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a worksheet.

Remarks

The Worksheet object is a member of the Worksheets collection. The Worksheets collection contains all the Worksheet objects in a workbook.

The Worksheet object is also a member of the Sheets collection. The Sheets collection contains all the sheets in the workbook (both chart sheets and worksheets).

Example

Use Worksheets(index), where index is the worksheet index number or name, to return a single Worksheet object. The following example hides worksheet one in the active workbook.

VBA Copy code Copy code
Worksheets(1).Visible = False

The worksheet index number denotes the position of the worksheet on the workbook's tab bar. Worksheets(1) is the first (leftmost) worksheet in the workbook, and Worksheets(Worksheets.Count) is the last one. All worksheets are included in the index count, even if they're hidden.

The worksheet name is shown on the tab for the worksheet. Use the Name property to set or return the worksheet name. The following example protects the scenarios on Sheet1.

VBA Copy code Copy code

Dim strPassword As String
strPassword = InputBox ("Enter the password for the worksheet")
Worksheets("Sheet1").Protect password:=strPassword, scenarios:=True

When a worksheet is the active sheet, you can use the ActiveSheet property to refer to it. The following example uses the Activate method to activate Sheet1, sets the page orientation to landscape mode, and then prints the worksheet.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PrintOut

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example uses the BeforeDoubleClick event to open a specified set of files in Notepad. To use this example your worksheet must contain the following data:

  • Cell A1 must contain the names of the files to open, each separated by a comma and a space.

  • Cell D1 must contain the path to where the Notepad files are located.

  • Cell D2 must contain the path to where the Notepad program is located.

  • Cell D3 must contain the file extension, without the period, for the Notepad files (txt).

When you double-click cell A1, the files specified in cell A1 are opened in Notepad.

VBA Copy code Copy code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   'Define your variables.
   Dim sFile As String, sPath As String, sTxt As String, sExe As String, sSfx As String

   'If you did not double-click on A1, then exit the function.
   If Target.Address <> "$A$1" Then Exit Sub

   'If you did double-click on A1, then override the default double-click behaviour with this function.
   Cancel = True

   'Set the path to the files, the path to Notepad, the file extension of the files, and the names of the files,
   'based on the information in the worksheet.
   sPath = Range("D1").Value
   sExe = Range("D2").Value
   sSfx = Range("D3").Value
   sFile = Range("A1").Value

   'Remove the spaces between the file names.
   sFile = WorksheetFunction.Substitute(sFile, " ", "")

   'Go through each file in the list (separated by commas) and
   'create the path, call the executable, and move on to the next comma.
   Do While InStr(sFile, ",")
      sTxt = sPath & "\" & Left(sFile, InStr(sFile, ",") - 1) & "." & sSfx
      If Dir(sTxt) <> "" Then Shell sExe & " " & sTxt, vbNormalFocus
      sFile = Right(sFile, Len(sFile) - InStr(sFile, ","))
   Loop

   'Finish off the last file name in the list
   sTxt = sPath & "\" & sFile & "." & sSfx
   If Dir(sTxt) <> "" Then Shell sExe & " " & sTxt, vbNormalNoFocus
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Excel Object Model Reference

Other resources

Worksheet Object Members


Worksheet Members (Excel)

 Copy code hover
[image]

Worksheet Members (Excel)
Send feedback

Published: July 16, 2012

Represents a worksheet.

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
BeforeDelete |
BeforeDoubleClick | Occurs when a worksheet is double-clicked, before the default double-click action.
BeforeRightClick | Occurs when a worksheet is right-clicked, before the default right-click action.
Calculate | Occurs after the worksheet is recalculated, for the Worksheet object.
Change | Occurs when cells on the worksheet are changed by the user or by an external link.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
FollowHyperlink | Occurs when you click any hyperlink on a worksheet. For application- and workbook-level events, see the SheetFollowHyperlink event and SheetFollowHyperlink event.
LensGalleryRenderComplete | Occurs when a callout gallery's icons (dynamic & static) have completed rendering.
PivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
PivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
PivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
PivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
PivotTableChangeSync | Occurs after changes to a PivotTable.
PivotTableUpdate | Occurs after a PivotTable report is updated on a worksheet.
SelectionChange | Occurs when the selection changes on a worksheet.
TableUpdate | Occurs after a Query table connected to the Data Model is updated on a worksheet.

Methods

Name | Description
Activate | Makes the current sheet the active sheet.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
ChartObjects | Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.
CheckSpelling | Checks the spelling of an object.
CircleInvalid | Circles invalid entries on the worksheet.
ClearArrows | Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature.
ClearCircles | Clears circles from invalid entries on the worksheet.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
Evaluate | Converts a Microsoft Excel name to an object or a value.
ExportAsFixedFormat | Exports to a file of the specified format.
Move | Moves the sheet to another location in the workbook.
OLEObjects | Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.
Paste | Pastes the contents of the Clipboard onto the sheet.
PasteSpecial | Pastes the contents of the Clipboard onto the sheet, using a specified format. Use this method to paste data from other applications or to paste data in a specific format.
PivotTables | Returns an object that represents either a single PivotTable report (a PivotTable object) or a collection of all the PivotTable reports (a PivotTables object) on a worksheet. Read-only.
PivotTableWizard | Creates a new PivotTable report. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a worksheet so that it cannot be modified.
ResetAllPageBreaks | Resets all page breaks on the specified worksheet.
SaveAs | Saves changes to the chart or worksheet in a different file.
Scenarios | Returns an object that represents either a single scenario (a Scenario object) or a collection of scenarios (a Scenarios object) on the worksheet.
Select | Selects the object.
SetBackgroundPicture | Sets the background graphic for a worksheet.
ShowAllData | Makes all rows of the currently filtered list visible. If AutoFilter is in use, this method changes the arrows to "All."
ShowDataForm | Displays the data form associated with the worksheet.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.
XmlDataQuery | Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet, or if the mapped range is empty.
XmlMapQuery | Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilter | Returns an AutoFilter object if filtering is on. Read-only.
AutoFilterMode | True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is independent of the FilterMode property. Read/write Boolean.
Cells | Returns a Range object that represents all the cells on the worksheet (not just the cells that are currently in use).
CircularReference | Returns a Range object that represents the range containing the first circular reference on the sheet, or returns Nothing if there's no circular reference on the sheet. The circular reference must be removed before calculation can proceed.
CodeName | Returns the code name for the object. Read-only String.
Columns | Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.
Comments | Returns a Comments collection that represents all the comments for the specified worksheet. Read-only.
ConsolidationFunction | Returns the function code used for the current consolidation. Can be one of the constants of XlConsolidationFunction. Read-only Long.
ConsolidationOptions | Returns a three-element array of consolidation options, as shown in the following table. If the element is True, that option is set. Read-only Variant.
ConsolidationSources | Returns an array of string values that name the source sheets for the worksheet's current consolidation. Returns Empty if there's no consolidation on the sheet. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomProperties | Returns a CustomProperties object representing the identifier information associated with a worksheet.
DisplayPageBreaks | True if page breaks (both automatic and manual) on the specified worksheet are displayed. Read/write Boolean.
DisplayRightToLeft | True if the specified worksheet is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
EnableAutoFilter | True if AutoFilter arrows are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnableCalculation | True if Microsoft Excel automatically recalculates the worksheet when necessary. False if Excel doesn't recalculate the sheet. Read/write Boolean.
EnableFormatConditionsCalculation | Returms or sets if conditional formats will will occur automatically as needed. Read/write Boolean.
EnableOutlining | True if outlining symbols are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnablePivotTable | True if PivotTable controls and actions are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnableSelection | Returns or sets what can be selected on the sheet. Read/write XlEnableSelection.
FilterMode | True if the worksheet is in the filter mode. Read-only Boolean.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the worksheet.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
ListObjects | Returns a collection of ListObject objects in the worksheet. Read-only ListObjects collection.
MailEnvelope | Rrepresents an e-mail header for a document.
Name | Returns or sets a String value that represents the object name.
Names | Returns a Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). Read-only Names object.
Next | Returns a Worksheet object that represents the next sheet.
Outline | Returns an Outline object that represents the outline for the specified worksheet. Read-only.
PageSetup | Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Previous | Returns a Worksheet object that represents the next sheet.
PrintedCommentPages | Returns the number of comment pages that will be printed for the current worksheet. Read-only
ProtectContents | True if the contents of the sheet are protected. This protects the individual cells. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.
ProtectDrawingObjects | True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.
Protection | Returns a Protection object that represents the protection options of the worksheet.
ProtectionMode | True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.
ProtectScenarios | True if the worksheet scenarios are protected. Read-only Boolean.
QueryTables | Returns the QueryTables collection that represents all the query tables on the specified worksheet. Read-only.
Range | Returns a Range object that represents a cell or a range of cells.
Rows | Returns a Range object that represents all the rows on the specified worksheet. Read-only Range object.
ScrollArea | Returns or sets the range where scrolling is allowed, as an A1-style range reference. Cells outside the scroll area cannot be selected. Read/write String.
Shapes | Returns a Shapes collection that represents all the shapes on the worksheet. Read-only.
Sort | Returns a Sort object. Read-only.
StandardHeight | Returns the standard (default) height of all the rows in the worksheet, in points. Read-only Double.
StandardWidth | Returns or sets the standard (default) width of all the columns in the worksheet. Read/write Double.
Tab | Returns a Tab object for a worksheet.
TransitionExpEval | True if Microsoft Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. Read/write Boolean.
TransitionFormEntry | True if Microsoft Excel uses Lotus 1-2-3 formula entry rules for the worksheet. Read/write Boolean.
Type | Returns an XlSheetType value that represents the worksheet type.
UsedRange | Returns a Range object that represents the used range on the specified worksheet. Read-only.
Visible | Returns or sets an XlSheetVisibility value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Worksheet Properties (Excel)

 Copy code hover
[image]

Worksheet Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
AutoFilter | Returns an AutoFilter object if filtering is on. Read-only.
AutoFilterMode | True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is independent of the FilterMode property. Read/write Boolean.
Cells | Returns a Range object that represents all the cells on the worksheet (not just the cells that are currently in use).
CircularReference | Returns a Range object that represents the range containing the first circular reference on the sheet, or returns Nothing if there's no circular reference on the sheet. The circular reference must be removed before calculation can proceed.
CodeName | Returns the code name for the object. Read-only String.
Columns | Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.
Comments | Returns a Comments collection that represents all the comments for the specified worksheet. Read-only.
ConsolidationFunction | Returns the function code used for the current consolidation. Can be one of the constants of XlConsolidationFunction. Read-only Long.
ConsolidationOptions | Returns a three-element array of consolidation options, as shown in the following table. If the element is True, that option is set. Read-only Variant.
ConsolidationSources | Returns an array of string values that name the source sheets for the worksheet's current consolidation. Returns Empty if there's no consolidation on the sheet. Read-only Variant.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
CustomProperties | Returns a CustomProperties object representing the identifier information associated with a worksheet.
DisplayPageBreaks | True if page breaks (both automatic and manual) on the specified worksheet are displayed. Read/write Boolean.
DisplayRightToLeft | True if the specified worksheet is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.
EnableAutoFilter | True if AutoFilter arrows are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnableCalculation | True if Microsoft Excel automatically recalculates the worksheet when necessary. False if Excel doesn't recalculate the sheet. Read/write Boolean.
EnableFormatConditionsCalculation | Returms or sets if conditional formats will will occur automatically as needed. Read/write Boolean.
EnableOutlining | True if outlining symbols are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnablePivotTable | True if PivotTable controls and actions are enabled when user-interface-only protection is turned on. Read/write Boolean.
EnableSelection | Returns or sets what can be selected on the sheet. Read/write XlEnableSelection.
FilterMode | True if the worksheet is in the filter mode. Read-only Boolean.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Hyperlinks | Returns a Hyperlinks collection that represents the hyperlinks for the worksheet.
Index | Returns a Long value that represents the index number of the object within the collection of similar objects.
ListObjects | Returns a collection of ListObject objects in the worksheet. Read-only ListObjects collection.
MailEnvelope | Rrepresents an e-mail header for a document.
Name | Returns or sets a String value that represents the object name.
Names | Returns a Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). Read-only Names object.
Next | Returns a Worksheet object that represents the next sheet.
Outline | Returns an Outline object that represents the outline for the specified worksheet. Read-only.
PageSetup | Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Previous | Returns a Worksheet object that represents the next sheet.
PrintedCommentPages | Returns the number of comment pages that will be printed for the current worksheet. Read-only
ProtectContents | True if the contents of the sheet are protected. This protects the individual cells. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.
ProtectDrawingObjects | True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.
Protection | Returns a Protection object that represents the protection options of the worksheet.
ProtectionMode | True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.
ProtectScenarios | True if the worksheet scenarios are protected. Read-only Boolean.
QueryTables | Returns the QueryTables collection that represents all the query tables on the specified worksheet. Read-only.
Range | Returns a Range object that represents a cell or a range of cells.
Rows | Returns a Range object that represents all the rows on the specified worksheet. Read-only Range object.
ScrollArea | Returns or sets the range where scrolling is allowed, as an A1-style range reference. Cells outside the scroll area cannot be selected. Read/write String.
Shapes | Returns a Shapes collection that represents all the shapes on the worksheet. Read-only.
Sort | Returns a Sort object. Read-only.
StandardHeight | Returns the standard (default) height of all the rows in the worksheet, in points. Read-only Double.
StandardWidth | Returns or sets the standard (default) width of all the columns in the worksheet. Read/write Double.
Tab | Returns a Tab object for a worksheet.
TransitionExpEval | True if Microsoft Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. Read/write Boolean.
TransitionFormEntry | True if Microsoft Excel uses Lotus 1-2-3 formula entry rules for the worksheet. Read/write Boolean.
Type | Returns an XlSheetType value that represents the worksheet type.
UsedRange | Returns a Range object that represents the used range on the specified worksheet. Read-only.
Visible | Returns or sets an XlSheetVisibility value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Worksheet.Application Property (Excel)

 Copy code hover
[image]

Worksheet.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Worksheet object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.AutoFilter Property (Excel)

 Copy code hover
[image]

Worksheet.AutoFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an AutoFilter object if filtering is on. Read-only.

Syntax

expression .AutoFilter

expression A variable that represents a Worksheet object.

Remarks

The property returns Nothing if filtering is off.

To create an AutoFilter object for a worksheet, you must turn autofiltering on for a range on the worksheet either manually or using the AutoFilter method of the Range object.

Example

The following example returns autofilter for the current worksheet.

Copy code Copy code
Dim Worksheet1 As Worksheet

Dim returnValue As AutoFilter
returnValue = Worksheet1.AutoFilter

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.AutoFilterMode Property (Excel)

 Copy code hover
[image]

Worksheet.AutoFilterMode Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is independent of the FilterMode property. Read/write Boolean.

Syntax

expression .AutoFilterMode

expression A variable that represents a Worksheet object.

Remarks

This property returns True if the drop-down arrows are currently displayed. You can set this property to False to remove the arrows, but you cannot set it to True. Use the AutoFilter method to filter a list and display the drop-down arrows.

Example

This example displays the current status of the AutoFilterMode property on Sheet1.

VBA Copy code Copy code
If Worksheets("Sheet1").AutoFilterMode Then
 isOn = "On"
Else
 isOn = "Off"
End If
MsgBox "AutoFilterMode is " & isOn

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Cells Property (Excel)

 Copy code hover
[image]

Worksheet.Cells Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the cells on the worksheet (not just the cells that are currently in use).

Syntax

expression .Cells

expression A variable that represents a Worksheet object.

Remarks

Because the Item property is the default property for the Range object, you can specify the row and column index immediately after the Cells keyword. For more information, see the Item property and the examples for this topic.

Using this property without an object qualifier returns a Range object that represents all the cells on the active worksheet.

Example

This example sets the font size for cell C5 on Sheet1 to 14 points.

VBA Copy code Copy code
Worksheets("Sheet1").Cells(5, 3).Font.Size = 14

This example clears the formula in cell one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Cells(1).ClearContents

This example sets the font and font size for every cell on Sheet1 to 8-point Arial

VBA Copy code Copy code
With Worksheets("Sheet1").Cells.Font
    .Name = "Arial"
    .Size = 8
End With

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributor

This example toggles a sort between ascending and descending order when you double-click any cell in the data range. The data is sorted based on the column of the cell that is double-clicked.

VBA Copy code Copy code
Option Explicit
Public blnToggle As Boolean

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim LastColumn As Long, keyColumn As Long, LastRow As Long
    Dim SortRange As Range
    LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

    keyColumn = Target.Column

    If keyColumn <= LastColumn Then

        Application.ScreenUpdating = False
        Cancel = True
        LastRow = Cells(Rows.Count, keyColumn).End(xlUp).Row
        Set SortRange = Target.CurrentRegion

        blnToggle = Not blnToggle
        If blnToggle = True Then
            SortRange.Sort Key1:=Cells(2, keyColumn), Order1:=xlAscending, Header:=xlYes
        Else
            SortRange.Sort Key1:=Cells(2, keyColumn), Order1:=xlDescending, Header:=xlYes
        End If

        Set SortRange = Nothing
        Application.ScreenUpdating = True

    End If
End Sub

About the Contributor

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.CircularReference Property (Excel)

 Copy code hover
[image]

Worksheet.CircularReference Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range containing the first circular reference on the sheet, or returns Nothing if there's no circular reference on the sheet. The circular reference must be removed before calculation can proceed.

Syntax

expression .CircularReference

expression A variable that represents a Worksheet object.

Example

This example selects the first cell in the first circular reference on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").CircularReference.Select

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.CodeName Property (Excel)

 Copy code hover
[image]

Worksheet.CodeName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the code name for the object. Read-only String.

Syntax

expression .CodeName

expression An expression that returns a Worksheet object.

Remarks

The value that you see in the cell to the right of (Name) in the Properties window is the code name of the selected object. At design time, you can change the code name of an object by changing this value. You cannot programmatically change this property at run time.

The code name for an object can be used in place of an expression that returns the object. For example, if the code name for worksheet one is "Sheet1", the following expressions are identical:

VBA Copy code Copy code
Worksheets(1).Range("a1")
Sheet1.Range("a1")

It's possible for the sheet name to be different from the code name. When you create a sheet, the sheet name and code name are the same, but changing the sheet name doesn't change the code name, and changing the code name (using the Properties window in the Visual Basic Editor) doesn't change the sheet name.

Example

This example displays the code name for worksheet one.

VBA Copy code Copy code
MsgBox Worksheets(1).CodeName

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Columns Property (Excel)

 Copy code hover
[image]

Worksheet.Columns Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.

Syntax

expression .Columns

expression A variable that represents a Worksheet object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Columns.

When applied to a Range object that's a multiple-area selection, this property returns columns from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Columns.Count returns 2, not 4. To use this property on a range that may contain a multiple-area selection, test Areas.Count to determine whether the range contains more than one area. If it does, loop over each area in the range.

Example

This example formats the font of column one (column A) on Sheet1 as bold.

VBA Copy code Copy code
Worksheets("Sheet1").Columns(1).Font.Bold = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Comments Property (Excel)

 Copy code hover
[image]

Worksheet.Comments Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Comments collection that represents all the comments for the specified worksheet. Read-only.

Syntax

expression .Comments

expression A variable that represents a Worksheet object.

Example

This example deletes all comments added by Jean Selva on the active sheet.

VBA Copy code Copy code
For Each c in ActiveSheet.Comments
 If c.Author = "Jean Selva" Then c.Delete
Next

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ConsolidationFunction Property (Excel)

 Copy code hover
[image]

Worksheet.ConsolidationFunction Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the function code used for the current consolidation. Can be one of the constants of XlConsolidationFunction. Read-only Long.

Syntax

expression .ConsolidationFunction

expression A variable that represents a Worksheet object.

Example

This example displays a message box if the current consolidation is using the SUM function.

VBA Copy code Copy code
If Worksheets("Sheet1").ConsolidationFunction = xlSum Then
 MsgBox "Sheet1 uses the SUM function for consolidation."
End If

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ConsolidationOptions Property (Excel)

 Copy code hover
[image]

Worksheet.ConsolidationOptions Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a three-element array of consolidation options, as shown in the following table. If the element is True, that option is set. Read-only Variant.

Syntax

expression .ConsolidationOptions

expression A variable that represents a Worksheet object.

Remarks

Element | Meaning
1 | Use labels in top row
2 | Use labels in left column
3 | Create links to source data

Example

This example displays the consolidation options for Sheet1. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
aOptions = Worksheets("Sheet1").ConsolidationOptions
newSheet.Range("A1").Value = "Use labels in top row"
newSheet.Range("A2").Value = "Use labels in left column"
newSheet.Range("A3").Value = "Create links to source data"
For i = 1 To 3
 If aOptions(i) = True Then
 newSheet.Cells(i, 2).Value = "True"
 Else
 newSheet.Cells(i, 2).Value = "False"
 End If
Next i
newSheet.Columns("A:B").AutoFit

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ConsolidationSources Property (Excel)

 Copy code hover
[image]

Worksheet.ConsolidationSources Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an array of string values that name the source sheets for the worksheet's current consolidation. Returns Empty if there's no consolidation on the sheet. Read-only Variant.

Syntax

expression .ConsolidationSources

expression A variable that represents a Worksheet object.

Example

This example displays the names of the source ranges for the consolidation on Sheet1. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
newSheet.Range("A1").Value = "Consolidation Sources"
aSources = Worksheets("Sheet1").ConsolidationSources
If IsEmpty(aSources) Then
 newSheet.Range("A2").Value = "none"
Else
 For i = 1 To UBound(aSources)
 newSheet.Cells(i + 1, 1).Value = aSources(i)
 Next i
End If
newSheet.Columns("A:B").AutoFit

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Creator Property (Excel)

 Copy code hover
[image]

Worksheet.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Worksheet object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.CustomProperties Property (Excel)

 Copy code hover
[image]

Worksheet.CustomProperties Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a CustomProperties object representing the identifier information associated with a worksheet.

Syntax

expression .CustomProperties

expression A variable that represents a Worksheet object.

Remarks

For the CustomProperties property, identifier information for a worksheet can represent metadata for XML.

Example

In this example, Microsoft Excel adds identifier information to the active worksheet and returns the name and value to the user.

VBA Copy code Copy code
Sub CheckCustomProperties()

 Dim wksSheet1 As Worksheet

 Set wksSheet1 = Application.ActiveSheet

 ' Add metadata to worksheet.
 wksSheet1.CustomProperties.Add _
 Name:="Market", Value:="Nasdaq"

 ' Display metadata.
 With wksSheet1.CustomProperties.Item(1)
 MsgBox .Name & vbTab & .Value
 End With

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.DisplayPageBreaks Property (Excel)

 Copy code hover
[image]

Worksheet.DisplayPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

True if page breaks (both automatic and manual) on the specified worksheet are displayed. Read/write Boolean.

Syntax

expression .DisplayPageBreaks

expression A variable that represents a Worksheet object.

Remarks

You can't set this property if you don't have a printer installed.

Example

This example causes Sheet1 to display page breaks.

VBA Copy code Copy code
Worksheets("Sheet1").DisplayPageBreaks = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.DisplayRightToLeft Property (Excel)

 Copy code hover
[image]

Worksheet.DisplayRightToLeft Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the specified worksheet is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.

Syntax

expression .DisplayRightToLeft

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnableAutoFilter Property (Excel)

 Copy code hover
[image]

Worksheet.EnableAutoFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

True if AutoFilter arrows are enabled when user-interface-only protection is turned on. Read/write Boolean.

Syntax

expression .EnableAutoFilter

expression A variable that represents a Worksheet object.

Example

This example enables the AutoFilter arrows on a protected worksheet.

VBA Copy code Copy code
ActiveSheet.EnableAutoFilter = True
ActiveSheet.Protect contents:=True, userInterfaceOnly:=True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnableCalculation Property (Excel)

 Copy code hover
[image]

Worksheet.EnableCalculation Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel automatically recalculates the worksheet when necessary. False if Excel doesn't recalculate the sheet. Read/write Boolean.

Syntax

expression .EnableCalculation

expression A variable that represents a Worksheet object.

Remarks

When the value of this property is False, you cannot request a recalculation. When you change the value from False to True, Excel recalculates the worksheet.

Example

This example sets Microsoft Excel to not recalculate worksheet one automatically.

VBA Copy code Copy code
Worksheets(1).EnableCalculation = False

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnableFormatConditionsCalculation Property (Excel)

 Copy code hover
[image]

Worksheet.EnableFormatConditionsCalculation Property (Excel)
See also Send feedback

Published: July 16, 2012

Returms or sets if conditional formats will will occur automatically as needed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .EnableFormatConditionsCalculation

expression A variable that represents a Worksheet object.

Remarks

When set to True (default), evaluation of conditional formats will will occur automatically as needed. When set to False, conditional formats will not be re-evaluated. Any previously applied conditional formatting will still be visible, but it will not update as cell values or AppliesTo ranges are changed.

The purpose of this flag is to allow VBA programmers to configure a rule completely before evaluating it. This is particularly useful when condition is applied over a large range as performance can be slow in these cases.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnableOutlining Property (Excel)

 Copy code hover
[image]

Worksheet.EnableOutlining Property (Excel)
See also Send feedback

Published: July 16, 2012

True if outlining symbols are enabled when user-interface-only protection is turned on. Read/write Boolean.

Syntax

expression .EnableOutlining

expression A variable that represents a Worksheet object.

Remarks

This example enables outlining symbols on a protected worksheet.

Example

VBA Copy code Copy code
ActiveSheet.EnableOutlining = True
ActiveSheet.Protect contents:=True, userInterfaceOnly:=True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnablePivotTable Property (Excel)

 Copy code hover
[image]

Worksheet.EnablePivotTable Property (Excel)
See also Send feedback

Published: July 16, 2012

True if PivotTable controls and actions are enabled when user-interface-only protection is turned on. Read/write Boolean.

Syntax

expression .EnablePivotTable

expression A variable that represents a Worksheet object.

Remarks

This property applies to each worksheet and isn't saved with the worksheet or session.

There must be a sufficient number of unlocked cells below and to the right of the PivotTable report for Microsoft Excel to recalculate and display the PivotTable report.

Example

This example enables PivotTable controls on a protected worksheet.

VBA Copy code Copy code
ActiveSheet.EnablePivotTable = True
ActiveSheet.Protect contents:=True, userInterfaceOnly:=True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.EnableSelection Property (Excel)

 Copy code hover
[image]

Worksheet.EnableSelection Property (Excel)
See also Send feedback

Returns or sets what can be selected on the sheet. Read/write XlEnableSelection.

Syntax

expression .EnableSelection

expression A variable that represents a Worksheet object.

Remarks

This property takes effect only when the worksheet is protected: xlNoSelection prevents any selection on the sheet, xlUnlockedCells allows only those cells whose Locked property is False to be selected, and xlNoRestrictions allows any cell to be selected.

Example

This example sets worksheet one so that nothing on it can be selected.

VBA Copy code Copy code
With Worksheets(1)
 .EnableSelection = xlNoSelection
 .Protect Contents:=True, UserInterfaceOnly:=True
End With

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.FilterMode Property (Excel)

 Copy code hover
[image]

Worksheet.FilterMode Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the worksheet is in the filter mode. Read-only Boolean.

Syntax

expression .FilterMode

expression A variable that represents a Worksheet object.

Example

In the following example, the code returns True if the worksheet is in the filter mode.

Copy code Copy code
Dim Worksheet1 As Worksheet

Dim returnValue As Boolean
returnValue = Worksheet1.FilterMode

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.HPageBreaks Property (Excel)

 Copy code hover
[image]

Worksheet.HPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.

Syntax

expression .HPageBreaks

expression A variable that represents a Worksheet object.

Remarks

There is a limit of 1,026 horizontal page breaks per sheet.

Example

The following code example displays the number of full-screen and print-area horizontal page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).HPageBreaks
    If pb.Extent = xlPageBreakFull Then
        cFull = cFull + 1
    Else
        cPartial = cPartial + 1
    End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
    " print-area page breaks"

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example adds a page break when the value of a cell in column A changes.

VBA Copy code Copy code
Sub AddPageBreaks()
    StartRow = 2
    FinalRow = Range("A65536").End(xlUp).Row
    LastVal = Cells(StartRow, 1).Value
    For i = StartRow To FinalRow
    ThisVal = Cells(i, 1).Value
    If Not ThisVal = LastVal Then
    ActiveSheet.HPageBreaks.Add before:=Cells(i, 1)
    End If
    LastVal = ThisVal
    Next i
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Hyperlinks Property (Excel)

 Copy code hover
[image]

Worksheet.Hyperlinks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents the hyperlinks for the worksheet.

Syntax

expression .Hyperlinks

expression A variable that represents a Worksheet object.

Example

This example checks to see whether any of the hyperlinks on worksheet one contain the word "Microsoft."

VBA Copy code Copy code
For Each h in Worksheets(1).Hyperlinks
 If Instr(h.Name, "Microsoft") <> 0 Then h.Follow
Next

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Index Property (Excel)

 Copy code hover
[image]

Worksheet.Index Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the index number of the object within the collection of similar objects.

Syntax

expression .Index

expression A variable that represents a Worksheet object.

Example

This example displays the tab number of the sheet specified by the name that you type. For example, if Sheet4 is the third tab in the active workbook, the example displays "3" in a message box.

VBA Copy code Copy code
Sub DisplayTabNumber()
 Dim strSheetName as String

 strSheetName = InputBox("Type a sheet name, such as Sheet4.")

 MsgBox "This sheet is tab number " & Sheets(strSheetName).Index
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ListObjects Property (Excel)

 Copy code hover
[image]

Worksheet.ListObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a collection of ListObject objects in the worksheet. Read-only ListObjects collection.

Syntax

expression .ListObjects

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.MailEnvelope Property (Excel)

 Copy code hover
[image]

Worksheet.MailEnvelope Property (Excel)
See also Send feedback

Published: July 16, 2012

Rrepresents an e-mail header for a document.

Syntax

expression .MailEnvelope

expression A variable that represents a Worksheet object.

Example

This example sets the comments for the header of the active worksheet.

VBA Copy code Copy code
Sub HeaderComments()

 ActiveSheet.MailEnvelope.Introduction = "To Whom It May Concern: "

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Name Property (Excel)

 Copy code hover
[image]

Worksheet.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the object name.

Syntax

expression .Name

expression A variable that represents a Worksheet object.

Example

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example sets the name of the active worksheet equal to today's date.

VBA Copy code Copy code
' This macro sets today's date as the name for the current sheet
Sub NameWorksheetByDate()
    Range("D5").Select
    Selection.Formula = "=text(now(),""mmm dd yyyy"")"
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues
    Application.CutCopyMode = False
    Selection.Columns.AutoFit
    ActiveSheet.Name = Range("D5").Value
    Range("D5").Value = ""
End Sub

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Names Property (Excel)

 Copy code hover
[image]

Worksheet.Names Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). Read-only Names object.

Syntax

expression .Names

expression A variable that represents a Worksheet object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveWorkbook.Names.

Example

This example defines the name "myName" for cell A1 on Sheet1.

VBA Copy code Copy code
ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
 "=Sheet1!R1C1"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Next Property (Excel)

 Copy code hover
[image]

Worksheet.Next Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Worksheet object that represents the next sheet.

Syntax

expression .Next

expression A variable that represents a Worksheet object.

Remarks

If the object is a range, this property emulates the TAB key, although the property returns the next cell without selecting it.

On a protected sheet, this property returns the next unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the right of the specified cell.

Example

This example selects the next unlocked cell on Sheet1. If Sheet1 is unprotected, this is the cell immediately to the right of the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Next.Select

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Outline Property (Excel)

 Copy code hover
[image]

Worksheet.Outline Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Outline object that represents the outline for the specified worksheet. Read-only.

Syntax

expression .Outline

expression A variable that represents a Worksheet object.

Example

This example sets the outline on Sheet1 to use automatic styles.

VBA Copy code Copy code
Worksheets("Sheet1").Outline.AutomaticStyles = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PageSetup Property (Excel)

 Copy code hover
[image]

Worksheet.PageSetup Property (Excel)
See also Send feedback

Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.

Syntax

expression .PageSetup

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Parent Property (Excel)

 Copy code hover
[image]

Worksheet.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Previous Property (Excel)

 Copy code hover
[image]

Worksheet.Previous Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Worksheet object that represents the next sheet.

Syntax

expression .Previous

expression A variable that represents a Worksheet object.

Remarks

If the object is a range, this property emulates pressing SHIFT+TAB; unlike the key combination, however, the property returns the previous cell without selecting it.

On a protected sheet, this property returns the previous unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the left of the specified cell.

Example

This example selects the previous unlocked cell on Sheet1. If Sheet1 is unprotected, this is the cell immediately to the left of the active cell.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveCell.Previous.Select

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PrintedCommentPages Property (Excel)

 Copy code hover
[image]

Worksheet.PrintedCommentPages Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of comment pages that will be printed for the current worksheet. Read-only

Version Information

Version Added: Excel 2010

Syntax

expression .PrintedCommentPages

expression A variable that returns a Worksheet object.

Return Value

Long

Remarks

The PrintedCommentPages property will only return a number greater than zero if the Comments setting on the Sheet tab of the Page Setup dialog box is set to At end of sheet. This property will return zero if the sheet is a Chart sheet or a MS Excel 5.0 Dialog sheet.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ProtectContents Property (Excel)

 Copy code hover
[image]

Worksheet.ProtectContents Property (Excel)
See also Send feedback

True if the contents of the sheet are protected. This protects the individual cells. To turn on content protection, use the Protect method with the Contents argument set to True. Read-only Boolean.

Syntax

expression .ProtectContents

expression A variable that represents a Worksheet object.

Example

This example displays a message box if the contents of Sheet1 are protected.

VBA Copy code Copy code
If Worksheets("Sheet1").ProtectContents = True Then
 MsgBox "The contents of Sheet1 are protected."
End If

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ProtectDrawingObjects Property (Excel)

 Copy code hover
[image]

Worksheet.ProtectDrawingObjects Property (Excel)
See also Send feedback

Published: July 16, 2012

True if shapes are protected. To turn on shape protection, use the Protect method with the DrawingObjects argument set to True. Read-only Boolean.

Syntax

expression .ProtectDrawingObjects

expression A variable that represents a Worksheet object.

Example

This example displays a message box if the shapes on Sheet1 are protected.

VBA Copy code Copy code
If Worksheets("Sheet1").ProtectDrawingObjects = True Then
 MsgBox "The shapes on Sheet1 are protected."
End If

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Protection Property (Excel)

 Copy code hover
[image]

Worksheet.Protection Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Protection object that represents the protection options of the worksheet.

Syntax

expression .Protection

expression A variable that represents a Worksheet object.

Example

This example protects the active worksheet and then determines if columns can be inserted on the protected worksheet, notifying the user of this status.

VBA Copy code Copy code
Sub CheckProtection()

 ActiveSheet.Protect

 ' Check the ability to insert columns on a protected sheet.
 ' Notify the user of this status.
 If ActiveSheet.Protection.AllowInsertingColumns = True Then
 MsgBox "The insertion of columns is allowed on this protected worksheet."
 Else
 MsgBox "The insertion of columns is not allowed on this protected worksheet."
 End If

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ProtectionMode Property (Excel)

 Copy code hover
[image]

Worksheet.ProtectionMode Property (Excel)
See also Send feedback

Published: July 16, 2012

True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect method with the UserInterfaceOnly argument set to True. Read-only Boolean.

Syntax

expression .ProtectionMode

expression A variable that represents a Worksheet object.

Example

This example displays the status of the ProtectionMode property.

VBA Copy code Copy code
MsgBox ActiveSheet.ProtectionMode

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ProtectScenarios Property (Excel)

 Copy code hover
[image]

Worksheet.ProtectScenarios Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the worksheet scenarios are protected. Read-only Boolean.

Syntax

expression .ProtectScenarios

expression A variable that represents a Worksheet object.

Example

This example displays a message box if scenarios are protected on Sheet1.

VBA Copy code Copy code
If Worksheets("Sheet1").ProtectScenarios Then _
 MsgBox "Scenarios are protected on this worksheet."

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.QueryTables Property (Excel)

 Copy code hover
[image]

Worksheet.QueryTables Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the QueryTables collection that represents all the query tables on the specified worksheet. Read-only.

Syntax

expression .QueryTables

expression A variable that represents a Worksheet object.

Example

This example refreshes all query tables on worksheet one.

VBA Copy code Copy code
For Each qt in Worksheets(1).QueryTables
 qt.Refresh
Next

This example sets query table one so that formulas to the right of it are automatically updated whenever it's refreshed.

VBA Copy code Copy code
Sheets("sheet1").QueryTables(1).FillAdjacentFormulas = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Range Property (Excel)

 Copy code hover
[image]

Worksheet.Range Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a cell or a range of cells.

Syntax

expression .Range(Cell1, Cell2)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Cell1 | Required | Variant | The name of the range. This must be an A1-style reference in the language of the macro. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but they're ignored. You can use a local defined name in any part of the range. If you use a name, the name is assumed to be in the language of the macro.
Cell2 | Optional | Variant | The cell in the upper-left and lower-right corner of the range. Can be a Range object that contains a single cell, an entire column, or entire row, or it can be a string that names a single cell in the language of the macro.

Remarks

When used without an object qualifier, this property is a shortcut for ActiveSheet.Range (it returns a range from the active sheet; if the active sheet isn't a worksheet, the property fails).

When applied to a Range object, the property is relative to the Range object. For example, if the selection is cell C3, then Selection.Range("B1") returns cell D3 because it's relative to the Range object returned by the Selection property. On the other hand, the code ActiveSheet.Range("B1") always returns cell B1.

Example

This example sets the value of cell A1 on Sheet1 to 3.14159.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Value = 3.14159

This example creates a formula in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("A1").Formula = "=10*RAND()"

This example loops on cells A1:D10 on Sheet1. If one of the cells has a value less than 0.001, the code replaces that value with 0 (zero).

VBA Copy code Copy code
For Each c in Worksheets("Sheet1").Range("A1:D10")
 If c.Value < .001 Then
 c.Value = 0
 End If
Next c

This example loops on the range named "TestRange" and displays the number of empty cells in the range.

VBA Copy code Copy code
numBlanks = 0
For Each c In Range("TestRange")
 If c.Value = "" Then
 numBlanks = numBlanks + 1
 End If
Next c
MsgBox "There are " & numBlanks & " empty cells in this range"

This example sets the font style in cells A1:C5 on Sheet1 to italic. The example uses Syntax 2 of the Range property.

VBA Copy code Copy code
Worksheets("Sheet1").Range(Cells(1, 1), Cells(5, 3)). _
 Font.Italic = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Rows Property (Excel)

 Copy code hover
[image]

Worksheet.Rows Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents all the rows on the specified worksheet. Read-only Range object.

Syntax

expression .Rows

expression A variable that represents a Worksheet object.

Remarks

Using this property without an object qualifier is equivalent to using ActiveSheet.Rows.

When applied to a Range object that's a multiple selection, this property returns rows from only the first area of the range. For example, if the Range object has two areas — A1:B2 and C3:D4 — Selection.Rows.Count returns 2, not 4. To use this property on a range that may contain a multiple selection, test Areas.Count to determine whether the range is a multiple selection. If it is, loop over each area in the range, as shown in the third example.

Example

This example deletes row three on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(3).Delete

This example deletes rows in the current region on worksheet one where the value of cell one in the row is the same as the value in cell one in the previous row.

VBA Copy code Copy code
For Each rw In Worksheets(1).Cells(1, 1).CurrentRegion.Rows
 this = rw.Cells(1, 1).Value
 If this = last Then rw.Delete
 last = this
Next

This example displays the number of rows in the selection on Sheet1. If more than one area is selected, the example loops through each area.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
 MsgBox "The selection contains " & _
 Selection.Rows.Count & " rows."
Else
 i = 1
 For Each a In Selection.Areas
 MsgBox "Area " & i & " of the selection contains " & _
 a.Rows.Count & " rows."
 i = i + 1
 Next a
End If

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ScrollArea Property (Excel)

 Copy code hover
[image]

Worksheet.ScrollArea Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the range where scrolling is allowed, as an A1-style range reference. Cells outside the scroll area cannot be selected. Read/write String.

Syntax

expression .ScrollArea

expression A variable that represents a Worksheet object.

Remarks

Set this property to the empty string ("") to enable cell selection for the entire sheet.

Example

This example sets the scroll area for worksheet one.

VBA Copy code Copy code
Worksheets(1).ScrollArea = "a1:f10"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Shapes Property (Excel)

 Copy code hover
[image]

Worksheet.Shapes Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Shapes collection that represents all the shapes on the worksheet. Read-only.

Syntax

expression .Shapes

expression An expression that returns a Worksheet object.

Example

This example adds a blue dashed line to worksheet one.

VBA Copy code Copy code
With Worksheets(1).Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Sort Property (Excel)

 Copy code hover
[image]

Worksheet.Sort Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Sort object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Sort

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.StandardHeight Property (Excel)

 Copy code hover
[image]

Worksheet.StandardHeight Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the standard (default) height of all the rows in the worksheet, in points. Read-only Double.

Syntax

expression .StandardHeight

expression A variable that represents a Worksheet object.

Example

This example sets the height of row one on Sheet1 to the standard height.

VBA Copy code Copy code
Worksheets("Sheet1").Rows(1).RowHeight = _
 Worksheets("Sheet1").StandardHeight

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.StandardWidth Property (Excel)

 Copy code hover
[image]

Worksheet.StandardWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the standard (default) width of all the columns in the worksheet. Read/write Double.

Syntax

expression .StandardWidth

expression A variable that represents a Worksheet object.

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Example

This example sets the width of column one on Sheet1 to the standard width.

VBA Copy code Copy code
Worksheets("Sheet1").Columns(1).ColumnWidth = _
 Worksheets("Sheet1").StandardWidth

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Tab Property (Excel)

 Copy code hover
[image]

Worksheet.Tab Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Tab object for a worksheet.

Syntax

expression .Tab

expression A variable that represents a Worksheet object.

Example

In this example, Microsoft Excel determines if the worksheet's first tab color index is set to none and notifies the user.

VBA Copy code Copy code
Sub CheckTab()

 ' Determine if color index of 1st tab is set to none.
 If Worksheets(1).Tab.ColorIndex = xlColorIndexNone Then
 MsgBox "The color index is set to none for the 1st " & _
 "worksheet tab."
 Else
 MsgBox "The color index for the tab of the 1st worksheet " & _
 "is not set none."
 End If

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.TransitionExpEval Property (Excel)

 Copy code hover
[image]

Worksheet.TransitionExpEval Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. Read/write Boolean.

Syntax

expression .TransitionExpEval

expression A variable that represents a Worksheet object.

Example

This example causes Microsoft Excel to use Lotus 1-2-3 expression evaluation rules for Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").TransitionExpEval = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.TransitionFormEntry Property (Excel)

 Copy code hover
[image]

Worksheet.TransitionFormEntry Property (Excel)
See also Send feedback

Published: July 16, 2012

True if Microsoft Excel uses Lotus 1-2-3 formula entry rules for the worksheet. Read/write Boolean.

Syntax

expression .TransitionFormEntry

expression A variable that represents a Worksheet object.

Example

This example causes Microsoft Excel to use Lotus 1-2-3 formula entry rules for Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").TransitionFormEntry = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Type Property (Excel)

 Copy code hover
[image]

Worksheet.Type Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XlSheetType value that represents the worksheet type.

Syntax

expression .Type

expression A variable that represents a Worksheet object.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.UsedRange Property (Excel)

 Copy code hover
[image]

Worksheet.UsedRange Property (Excel)
See also Send feedback

Returns a Range object that represents the used range on the specified worksheet. Read-only.

Syntax

expression .UsedRange

expression A variable that represents a Worksheet object.

Example

This example selects the used range on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Select

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Visible Property (Excel)

 Copy code hover
[image]

Worksheet.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlSheetVisibility value that determines whether the object is visible.

Syntax

expression .Visible

expression A variable that represents a Worksheet object.

Example

This example hides Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Visible = False

This example makes Sheet1 visible.

VBA Copy code Copy code
Worksheets("Sheet1").Visible = True

This example makes every sheet in the active workbook visible.

VBA Copy code Copy code
For Each sh In Sheets
 sh.Visible = True
Next sh

This example creates a new worksheet and then sets its Visible property to xlVeryHidden. To refer to the sheet, use its object variable, newSheet, as shown in the last line of the example. To use the newSheet object variable in another procedure, you must declare it as a public variable (Public newSheet As Object) in the first line of the module preceding any Sub or Function procedure.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
newSheet.Visible = xlVeryHidden
newSheet.Range("A1:D4").Formula = "=RAND()"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.VPageBreaks Property (Excel)

 Copy code hover
[image]

Worksheet.VPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.

Syntax

expression .VPageBreaks

expression A variable that represents a Worksheet object.

Example

This example displays the total number of full-screen and print-area vertical page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).VPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet Methods (Excel)

 Copy code hover
[image]

Worksheet Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Makes the current sheet the active sheet.
Calculate | Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.
ChartObjects | Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.
CheckSpelling | Checks the spelling of an object.
CircleInvalid | Circles invalid entries on the worksheet.
ClearArrows | Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature.
ClearCircles | Clears circles from invalid entries on the worksheet.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
Evaluate | Converts a Microsoft Excel name to an object or a value.
ExportAsFixedFormat | Exports to a file of the specified format.
Move | Moves the sheet to another location in the workbook.
OLEObjects | Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.
Paste | Pastes the contents of the Clipboard onto the sheet.
PasteSpecial | Pastes the contents of the Clipboard onto the sheet, using a specified format. Use this method to paste data from other applications or to paste data in a specific format.
PivotTables | Returns an object that represents either a single PivotTable report (a PivotTable object) or a collection of all the PivotTable reports (a PivotTables object) on a worksheet. Read-only.
PivotTableWizard | Creates a new PivotTable report. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Protect | Protects a worksheet so that it cannot be modified.
ResetAllPageBreaks | Resets all page breaks on the specified worksheet.
SaveAs | Saves changes to the chart or worksheet in a different file.
Scenarios | Returns an object that represents either a single scenario (a Scenario object) or a collection of scenarios (a Scenarios object) on the worksheet.
Select | Selects the object.
SetBackgroundPicture | Sets the background graphic for a worksheet.
ShowAllData | Makes all rows of the currently filtered list visible. If AutoFilter is in use, this method changes the arrows to "All."
ShowDataForm | Displays the data form associated with the worksheet.
Unprotect | Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.
XmlDataQuery | Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet, or if the mapped range is empty.
XmlMapQuery | Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet.


Worksheet.Activate Method (Excel)

 Copy code hover
[image]

Worksheet.Activate Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes the current sheet the active sheet.

Syntax

expression .Activate

expression A variable that represents a Worksheet object.

Remarks

Calling this method is equivalent to clicking the sheet's tab.

Example

This example activates Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Calculate Method (Excel)

 Copy code hover
[image]

Worksheet.Calculate Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.

Syntax

expression .Calculate

expression A variable that represents a Worksheet object.

Remarks

To calculate | Follow this example
All open workbooks | Application.Calculate (or just Calculate)
A specific worksheet | Worksheets(1).Calculate
A specified range | Worksheets(1).Rows(2).Calculate

Example

This example calculates the formulas in columns A, B, and C in the used range on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").UsedRange.Columns("A:C").Calculate

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ChartObjects Method (Excel)

 Copy code hover
[image]

Worksheet.ChartObjects Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.

Syntax

expression .ChartObjects(Index)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the chart. This argument can be an array, to specify more than one chart.

Return Value

Object

Remarks

This method isn't equivalent to the Charts property. This method returns embedded charts; the Charts property returns chart sheets. Use the Chart property to return the Chart object for an embedded chart.

Example

This example adds a title to embedded chart one on Sheet1.

VBA Copy code Copy code
With Worksheets("Sheet1").ChartObjects(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "1995 Rainfall Totals by Month"
End With

This example creates a new series in embedded chart one on Sheet1. The data source for the new series is the range B1:B10 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Activate
ActiveChart.SeriesCollection.Add _
 source:=Worksheets("Sheet1").Range("B1:B10")

This example clears the formatting of embedded chart one on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ChartObjects(1).Chart.ChartArea.ClearFormats

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.CheckSpelling Method (Excel)

 Copy code hover
[image]

Worksheet.CheckSpelling Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the spelling of an object.

Syntax

expression .CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest, SpellLang)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
CustomDictionary | Optional | Variant | A string that indicates the file name of the custom dictionary to be examined if the word isn't found in the main dictionary. If this argument is omitted, the currently specified dictionary is used.
IgnoreUppercase | Optional | Variant | True to have Microsoft Excel ignore words that are all uppercase. False to have Microsoft Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
AlwaysSuggest | Optional | Variant | True to have Microsoft Excel display a list of suggested alternate spellings when an incorrect spelling is found. False to have Microsoft Excel wait for you to input the correct spelling. If this argument is omitted, the current setting will be used.
SpellLang | Optional | Variant | The language of the dictionary being used. Can be one of the MsoLanguageID values.

Remarks

This method has no return value; Microsoft Excel displays the Spelling dialog box.

To check headers, footers, and objects on a worksheet, use this method on a Worksheet object.

To check only cells and notes, use this method with the object returned by the Cells property.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.CircleInvalid Method (Excel)

 Copy code hover
[image]

Worksheet.CircleInvalid Method (Excel)
See also Send feedback

Published: July 16, 2012

Circles invalid entries on the worksheet.

Syntax

expression .CircleInvalid

expression A variable that represents a Worksheet object.

Example

This example circles invalid entries on worksheet one.

VBA Copy code Copy code
Worksheets(1).CircleInvalid

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ClearArrows Method (Excel)

 Copy code hover
[image]

Worksheet.ClearArrows Method (Excel)
See also Send feedback

Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature.

Syntax

expression .ClearArrows

expression A variable that represents a Worksheet object.

Example

This example clears tracer arrows from Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").ClearArrows

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ClearCircles Method (Excel)

 Copy code hover
[image]

Worksheet.ClearCircles Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears circles from invalid entries on the worksheet.

Syntax

expression .ClearCircles

expression A variable that represents a Worksheet object.

Remarks

Use the CircleInvalid method to circle cells that contain invalid data.

Example

This example clears circles from invalid entries on worksheet one.

VBA Copy code Copy code
Worksheets(1).ClearCircles

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Copy Method (Excel)

 Copy code hover
[image]

Worksheet.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the sheet to another location in the workbook.

Syntax

expression .Copy(Before, After)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the copied sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the copied sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.

Example

This example copies Sheet1, placing the copy after Sheet3.

VBA Copy code Copy code
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Delete Method (Excel)

 Copy code hover
[image]

Worksheet.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Worksheet object.

Return Value

Boolean

Remarks

When you delete a Worksheet, this method displays a dialog box that prompts the user to confirm the deletion. This dialog box is displayed by default. When called on the Worksheet object, the Delete method returns a Boolean value that is False if the user clicked Cancel on the dialog box or True if the user clicked Delete.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Evaluate Method (Excel)

 Copy code hover
[image]

Worksheet.Evaluate Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a Microsoft Excel name to an object or a value.

Syntax

expression .Evaluate(Name)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Variant | The name of the object, using the naming convention of Microsoft Excel.

Return Value

Variant

Remarks

The following types of names in Microsoft Excel can be used with this method:

  • A1-style references. You can use any reference to a single cell in A1-style notation. All references are considered to be absolute references.

  • Ranges. You can use the range, intersect, and union operators (colon, space, and comma, respectively) with references.

  • Defined names. You can specify any name in the language of the macro.

  • External references. You can use the ! operator to refer to a cell or to a name defined in another workbook — for example, Evaluate("[BOOK1.XLS]Sheet1!A1").

  • Chart Objects. You can specify any chart object name, such as "Legend", "Plot Area", or "Series 1", to access the properties and methods of that object. For example, Charts("Chart1").Evaluate("Legend").Font.Name returns the name of the font used in the legend.

Note Note

Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument. For example, the following expression pairs are equivalent.

VBA Copy code Copy code
[a1].Value = 25
Evaluate("A1").Value = 25

trigVariable = [SIN(45)]
trigVariable = Evaluate("SIN(45)")

Set firstCellInSheet = Workbooks("BOOK1.XLS").Sheets(4).[A1]
Set firstCellInSheet = _
 Workbooks("BOOK1.XLS").Sheets(4).Evaluate("A1")

The advantage of using square brackets is that the code is shorter. The advantage of using Evaluate is that the argument is a string, so you can either construct the string in your code or use a Visual Basic variable.

Example

This example turns on bold formatting in cell A1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Activate
boldCell = "A1"
Application.Evaluate(boldCell).Font.Bold = True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ExportAsFixedFormat Method (Excel)

 Copy code hover
[image]

Worksheet.ExportAsFixedFormat Method (Excel)
See also Send feedback

Exports to a file of the specified format.

Version Information

Version Added: Excel 2007

Syntax

expression .ExportAsFixedFormat(Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlFixedFormatType | The type of file format to export to.
Filename | Optional | Variant | The file name of the file to be saved. You can include a full path, or Excel saves the file in the current folder.
Quality | Optional | Variant | Optional XlFixedFormatQuality. Specifies the quality of the published file.
IncludeDocProperties | Optional | Variant | True to include the document properties; otherwise False.
IgnorePrintAreas | Optional | Variant | True to ignore any print areas set when publishing; otherwise False.
From | Optional | Variant | The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To | Optional | Variant | The number of the last page to publish. If this argument is omitted, publishing ends with the last page.
OpenAfterPublish | Optional | Variant | True to display the file in the viewer after it is published; otherwise False.
FixedFormatExtClassPtr | Optional | Variant | Pointer to the FixedFormatExt class.

Remarks

This method also supports initializing an add-in to export a file to a fixed-format file. For example, Excel will perform file format conversion if the converters are present. The conversion is usually initiated by the user.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Move Method (Excel)

 Copy code hover
[image]

Worksheet.Move Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the sheet to another location in the workbook.

Syntax

expression .Move(Before, After)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the moved sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the moved sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the moved sheet.

Example

This example moves Sheet1 after Sheet3 in the active workbook.

VBA Copy code Copy code
Worksheets("Sheet1").Move _
 after:=Worksheets("Sheet3")

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.OLEObjects Method (Excel)

 Copy code hover
[image]

Worksheet.OLEObjects Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single OLE object (an OLEObject ) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.

Syntax

expression .OLEObjects(Index)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the OLE object.

Return Value

Object

Example

This example creates a list of link types for OLE objects on Sheet1. The list appears on a new worksheet created by the example.

VBA Copy code Copy code
Set newSheet = Worksheets.Add
i = 2
newSheet.Range("A1").Value = "Name"
newSheet.Range("B1").Value = "Link Type"
For Each obj In Worksheets("Sheet1").OLEObjects
 newSheet.Cells(i, 1).Value = obj.Name
 If obj.OLEType = xlOLELink Then
 newSheet.Cells(i, 2) = "Linked"
 Else
 newSheet.Cells(i, 2) = "Embedded"
 End If
 i = i + 1
Next

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Paste Method (Excel)

 Copy code hover
[image]

Worksheet.Paste Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard onto the sheet.

Syntax

expression .Paste(Destination, Link)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Destination | Optional | Variant | A Range object that specifies where the Clipboard contents should be pasted. If this argument is omitted, the current selection is used. This argument can be specified only if the contents of the Clipboard can be pasted into a range. If this argument is specified, the Link argument cannot be used.
Link | Optional | Variant | True to establish a link to the source of the pasted data. If this argument is specified, the Destination argument cannot be used. The default value is False.

Remarks

If you don't specify the Destination argument, you must select the destination range before you use this method.

This method may modify the sheet selection, depending on the contents of the Clipboard.

Example

This example copies data from cells C1:C5 on Sheet1 to cells D1:D5 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("C1:C5").Copy
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("D1:D5")

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PasteSpecial Method (Excel)

 Copy code hover
[image]

Worksheet.PasteSpecial Method (Excel)
See also Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard onto the sheet, using a specified format. Use this method to paste data from other applications or to paste data in a specific format.

Syntax

expression .PasteSpecial(Format, Link, DisplayAsIcon, IconFileName, IconIndex, IconLabel, NoHTMLFormatting)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Optional | Variant | A string that specifies the Clipboard format of the data.
Link | Optional | Variant | True to establish a link to the source of the pasted data. If the source data isn't suitable for linking or the source application doesn't support linking, this parameter is ignored. The default value is False.
DisplayAsIcon | Optional | Variant | True to display the pasted as an icon. The default value is False.
IconFileName | Optional | Variant | The name of the file that contains the icon to use if DisplayAsIcon is True.
IconIndex | Optional | Variant | The index number of the icon within the icon file.
IconLabel | Optional | Variant | The text label of the icon.
NoHTMLFormatting | Optional | Variant | True to remove all formatting, hyperlinks, and images from HTML. False to paste HTML as is. The default value is False.

Remarks

Note Note

NoHTMLFormatting will only matter when Format = "HTML". In all other cases, NoHTMLFormatting will be ignored.

You must select the destination range before you use this method.

This method may modify the sheet selection, depending on the contents of the Clipboard.

Example

This example pastes a Microsoft Word document object from the Clipboard to cell D1 on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Range("D1").Select
ActiveSheet.PasteSpecial format:= _
 "Microsoft Word 8.0 Document Object"

This example pastes the same Microsoft Word document object and displays it as an icon.

VBA Copy code Copy code
Worksheets("Sheet1").Range("F5").Select
ActiveSheet.PasteSpecial _
 Format:="Microsoft Word 8.0 Document Object", _
 DisplayAsIcon:=True

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTables Method (Excel)

 Copy code hover
[image]

Worksheet.PivotTables Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single PivotTable report (a PivotTable object) or a collection of all the PivotTable reports (a PivotTables object) on a worksheet. Read-only.

Syntax

expression .PivotTables(Index)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the report.

Return Value

Object

Example

This example sets the Sum of 1994 field in the first PivotTable report on the active sheet to use the SUM function.

VBA Copy code Copy code
ActiveSheet.PivotTables("PivotTable1"). _
 PivotFields("Sum of 1994").Function = xlSum

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableWizard Method (Excel)

 Copy code hover
[image]

Worksheet.PivotTableWizard Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new PivotTable report. This method doesn't display the PivotTable Wizard. This method isn't available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.

Syntax

expression .PivotTableWizard(SourceType, SourceData, TableDestination, TableName, RowGrand, ColumnGrand, SaveData, HasAutoFormat, AutoPage, Reserved, BackgroundQuery, OptimizeCache, PageFieldOrder, PageFieldWrapCount, ReadData, Connection)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
SourceType | Optional | Variant | An XlPivotTableSourceType value that represents the source of the report data. If you specify this argument, you must also specify SourceData. If SourceType and SourceData are omitted, Microsoft Excel assumes that the source type is xlDatabase, and the source data comes from the named range "Database." If this named range doesn't exist, Microsoft Excel uses the current region if the current selection is in a range of more than 10 cells that contain data. If this isn't true, this method will fail.
SourceData | Optional | Variant | The data for the new report. Can be a Range object, an array of ranges, or a text constant that represents the name of another report. For an external database, SourceData is an array of strings containing the SQL query string, where each element is up to 255 characters in length. You should use the Connection argument to specify the ODBC connection string. For compatibility with earlier versions of Excel, SourceData can be a two-element array. The first element is the connection string specifying the ODBC source for the data. The second element is the SQL query string used to get the data. If you specify SourceData, you must also specify SourceType. If the active cell is inside the SourceData range, you must specify TableDestination as well.
TableDestination | Optional | Variant | A Range object specifying where the report should be placed on the worksheet. If this argument is omitted, the report is placed at the active cell.
TableName | Optional | Variant | A string that specifies the name of the new report.
RowGrand | Optional | Variant | True to show grand totals for rows in the report.
ColumnGrand | Optional | Variant | True to show grand totals for columns in the report.
SaveData | Optional | Variant | True to save data with the report. False to save only the report definition.
HasAutoFormat | Optional | Variant | True to have Microsoft Excel automatically format the report when it's refreshed or when fields are moved.
AutoPage | Optional | Variant | Valid only if SourceType is xlConsolidation. True to have Microsoft Excel create a page field for the consolidation. If AutoPage is False, you must create the page field or fields.
Reserved | Optional | Variant | Not used by Microsoft Excel.
BackgroundQuery | Optional | Variant | True to have Excel perform queries for the report asynchronously (in the background). The default value is False.
OptimizeCache | Optional | Variant | True to optimize the PivotTable cache when it's constructed. The default value is False.
PageFieldOrder | Optional | Variant | The order in which page fields are added to the PivotTable report's layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default value is xlDownThenOver.
PageFieldWrapCount | Optional | Variant | The number of page fields in each column or row in the PivotTable report. The default value is 0 (zero).
ReadData | Optional | Variant | True to create a PivotTable cache that contains all records from the external database; this cache can be very large. If ReadData is False, you can set some of the fields asserver-based page fields before the data is actually read.
Connection | Optional | Variant | A string that contains ODBC settings that allow Excel to connect to an ODBC data source. The connection string has the form "ODBC;<connection string>". This argument overrides any previous setting for the PivotCache object's Connection property.

Return Value

A PivotTable object that represents the new PivotTable report.

Example

This example creates a new PivotTable report from a Microsoft Excel database (contained in the range A1:C100).

VBA Copy code Copy code
ActiveSheet.PivotTableWizard xlDatabase, Range("A1:C100")

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PrintOut Method (Excel)

 Copy code hover
[image]

Worksheet.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.
IgnorePrintAreas | Optional | Variant | True to ignore print areas and print the entire object.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PrintPreview Method (Excel)

 Copy code hover
[image]

Worksheet.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Protect Method (Excel)

 Copy code hover
[image]

Worksheet.Protect Method (Excel)
See also Send feedback

Published: July 16, 2012

Protects a worksheet so that it cannot be modified.

Syntax

expression .Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that specifies a case-sensitive password for the worksheet or workbook. If this argument is omitted, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook. If you forget the password, you cannot unprotect the worksheet or workbook. Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords. It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.
DrawingObjects | Optional | Variant | True to protect shapes. The default value is True.
Contents | Optional | Variant | True to protect contents. For a chart, this protects the entire chart. For a worksheet, this protects the locked cells. The default value is True.
Scenarios | Optional | Variant | True to protect scenarios. This argument is valid only for worksheets. The default value is True.
UserInterfaceOnly | Optional | Variant | True to protect the user interface, but not macros. If this argument is omitted, protection applies both to macros and to the user interface.
AllowFormattingCells | Optional | Variant | True allows the user to format any cell on a protected worksheet. The default value is False.
AllowFormattingColumns | Optional | Variant | True allows the user to format any column on a protected worksheet. The default value is False.
AllowFormattingRows | Optional | Variant | True allows the user to format any row on a protected. The default value is False.
AllowInsertingColumns | Optional | Variant | True allows the user to insert columns on the protected worksheet. The default value is False.
AllowInsertingRows | Optional | Variant | True allows the user to insert rows on the protected worksheet. The default value is False.
AllowInsertingHyperlinks | Optional | Variant | True allows the user to insert hyperlinks on the worksheet. The default value is False.
AllowDeletingColumns | Optional | Variant | True allows the user to delete columns on the protected worksheet, where every cell in the column to be deleted is unlocked. The default value is False.
AllowDeletingRows | Optional | Variant | True allows the user to delete rows on the protected worksheet, where every cell in the row to be deleted is unlocked. The default value is False.
AllowSorting | Optional | Variant | True allows the user to sort on the protected worksheet. Every cell in the sort range must be unlocked or unprotected. The default value is False.
AllowFiltering | Optional | Variant | True allows the user to set filters on the protected worksheet. Users can change filter criteria but can not enable or disable an auto filter. Users can set filters on an existing auto filter. The default value is False.
AllowUsingPivotTables | Optional | Variant | True allows the user to use pivot table reports on the protected worksheet. The default value is False.

Remarks

If changes wanted to be made to a protected worksheet, it is possible to use the Protect method on a protected worksheet if the password is supplied. Also, another method would be to unprotect the worksheet, make the necessary changes, and then protect the worksheet again.

Note Note

'Unprotected' means the cell may be locked (Format Cells dialog box) but is included in a range defined in the Allow Users to Edit Ranges dialog box, and the user has unprotected the range with a password or been validated via NT permissions.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ResetAllPageBreaks Method (Excel)

 Copy code hover
[image]

Worksheet.ResetAllPageBreaks Method (Excel)
See also Send feedback

Published: July 16, 2012

Resets all page breaks on the specified worksheet.

Syntax

expression .ResetAllPageBreaks

expression A variable that represents a Worksheet object.

Example

This example resets all page breaks on worksheet one.

VBA Copy code Copy code
Worksheets(1).ResetAllPageBreaks

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.SaveAs Method (Excel)

 Copy code hover
[image]

Worksheet.SaveAs Method (Excel)
See also Send feedback

Published: July 16, 2012

Saves changes to the chart or worksheet in a different file.

Syntax

expression .SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AddToMru, TextCodepage, TextVisualLayout, Local)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Variant. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.
FileFormat | Optional | Variant | The file format to use when you save the file. For a list of valid choices, see the XlFileFormat enumeration. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.
Password | Optional | Variant | A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.
WriteResPassword | Optional | Variant | A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.
ReadOnlyRecommended | Optional | Variant | True to display a message when the file is opened, recommending that the file be opened as read-only.
CreateBackup | Optional | Variant | True to create a backup file.
AddToMru | Optional | Variant | True to add this workbook to the list of recently used files. The default value is False.
TextCodepage | Optional | Variant | Not used in U.S. English Microsoft Excel.
TextVisualLayout | Optional | Variant | Not used in U.S. English Microsoft Excel.
Local | Optional | Variant | True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

Remarks

Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Scenarios Method (Excel)

 Copy code hover
[image]

Worksheet.Scenarios Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single scenario (a Scenario object) or a collection of scenarios (a Scenarios object) on the worksheet.

Syntax

expression .Scenarios(Index)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the scenario. Use an array to specify more than one scenario.

Return Value

Object

Example

This example sets the comment for the first scenario on Sheet1.

VBA Copy code Copy code
Worksheets("Sheet1").Scenarios(1).Comment = _
 "Worst-case July 1993 sales"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Select Method (Excel)

 Copy code hover
[image]

Worksheet.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

Remarks

To select a cell or a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.SetBackgroundPicture Method (Excel)

 Copy code hover
[image]

Worksheet.SetBackgroundPicture Method (Excel)
See also Send feedback

Published: July 16, 2012

Sets the background graphic for a worksheet.

Syntax

expression .SetBackgroundPicture(Filename)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the graphic file.

Example

This example sets the background graphic for worksheet one.

VBA Copy code Copy code
Worksheets(1).SetBackgroundPicture "c:\graphics\watermark.gif"

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ShowAllData Method (Excel)

 Copy code hover
[image]

Worksheet.ShowAllData Method (Excel)
See also Send feedback

Published: July 16, 2012

Makes all rows of the currently filtered list visible. If AutoFilter is in use, this method changes the arrows to "All."

Syntax

expression .ShowAllData

expression A variable that represents a Worksheet object.

Example

This example makes all data on Sheet1 visible. The example should be run on a worksheet that contains a list you filtered using the AutoFilter command.

VBA Copy code Copy code
Worksheets("Sheet1").ShowAllData

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.ShowDataForm Method (Excel)

 Copy code hover
[image]

Worksheet.ShowDataForm Method (Excel)
See also Send feedback

Published: July 16, 2012

Displays the data form associated with the worksheet.

Syntax

expression .ShowDataForm

expression A variable that represents a Worksheet object.

Remarks

The macro pauses while you're using the data form. When you close the data form, the macro resumes at the line following the ShowDataForm method.

This method runs the custom data form, if one exists.

Example

This example displays the data form for Sheet1.

VBA Copy code Copy code
Worksheets(1).ShowDataForm

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Unprotect Method (Excel)

 Copy code hover
[image]

Worksheet.Unprotect Method (Excel)
See also Send feedback

Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

Syntax

expression .Unprotect(Password)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | A string that denotes the case-sensitive password to use to unprotect the sheet or workbook. If the sheet or workbook isn't protected with a password, this argument is ignored. If you omit this argument for a sheet that's protected with a password, you'll be prompted for the password. If you omit this argument for a workbook that's protected with a password, the method fails.

Remarks

If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.

Example

This example removes protection from the active workbook.

VBA Copy code Copy code
ActiveSheet.Unprotect

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.XmlDataQuery Method (Excel)

 Copy code hover
[image]

Worksheet.XmlDataQuery Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet, or if the mapped range is empty.

Syntax

expression .XmlDataQuery(XPath, SelectionNamespaces, Map)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | The XPath to query for.
SelectionNamespaces | Optional | Variant | A space-delimited String that contains the namespaces referenced in the XPath parameter. A run-time error will be generated if one of the specified namespaces cannot be resolved.
Map | Optional | Variant | Specify an XmlMap if you want to query for the XPath within a specific map.

Return Value

Range

Remarks

If the XPath exists within a column in an XML list, the Range object returned does not include the header row.

This method returns Nothing if the XPath location path is not mapped into the grid. Thus, a return of Nothing doesn't necessarily mean that the map doesn't exist. It could mean that there is currently no data range available at the specified XPath location. You can use the XmlMapQuery method to check for the existence of a mapped XPath.

Note Note

The XmlDataQuery method allows you to query for the existence of particular map data. It can not be used to query for a piece of data in a map. For example, it is valid for a mapped range to exist in which the XPath for that range is "/root/People[@Age="23"]/FirstName". An XmlDataQuery query for this XPath location path will returnreturns the correct range. However, a query for "/root/People[FirstName="Joe"]" hoping to find "Joe" within the above mapped range will fail because the XPath definitions for the mapped ranges are different.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.XmlMapQuery Method (Excel)

 Copy code hover
[image]

Worksheet.XmlMapQuery Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet.

Syntax

expression .XmlMapQuery(XPath, SelectionNamespaces, Map)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | The XPath to query for.
SelectionNamespaces | Optional | Variant | A space-delimited String that contains the namespaces referenced in the XPath parameter. A run-time error will be generated if one of the specified namespaces cannot be resolved.
Map | Optional | Variant | Specify an XML map if you want to query for the XPath within a specific map.

Return Value

Range

Remarks

Unlike the XmlDataQuery method, the XmlMapQuery method returns the entire column of an XML list, including the header row.

Note Note

XmlMapQuery allows developers to query for the existence of particular maps. It can not be used to query for a piece of data in a map. For example, it is valid for a mapped range to exist in which the XPath for that range is "/root/People[@Age="23"]/FirstName". An XmlMapQuery call for this XPath will returnreturns the correct range. However, a query for "/root/People[FirstName="Joe"]" expecting to find "Joe" within the above mapped range will fail because the XPath definitions for the mapped ranges are different.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet Events (Excel)

 Copy code hover
[image]

Worksheet Events (Excel)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
Activate | Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.
BeforeDelete |
BeforeDoubleClick | Occurs when a worksheet is double-clicked, before the default double-click action.
BeforeRightClick | Occurs when a worksheet is right-clicked, before the default right-click action.
Calculate | Occurs after the worksheet is recalculated, for the Worksheet object.
Change | Occurs when cells on the worksheet are changed by the user or by an external link.
Deactivate | Occurs when the chart, worksheet, or workbook is deactivated.
FollowHyperlink | Occurs when you click any hyperlink on a worksheet. For application- and workbook-level events, see the SheetFollowHyperlink event and SheetFollowHyperlink event.
LensGalleryRenderComplete | Occurs when a callout gallery's icons (dynamic & static) have completed rendering.
PivotTableAfterValueChange | Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).
PivotTableBeforeAllocateChanges | Occurs before changes are applied to a PivotTable.
PivotTableBeforeCommitChanges | Occurs before changes are committed against the OLAP data source for a PivotTable.
PivotTableBeforeDiscardChanges | Occurs before changes to a PivotTable are discarded.
PivotTableChangeSync | Occurs after changes to a PivotTable.
PivotTableUpdate | Occurs after a PivotTable report is updated on a worksheet.
SelectionChange | Occurs when the selection changes on a worksheet.
TableUpdate | Occurs after a Query table connected to the Data Model is updated on a worksheet.


Worksheet.Activate Event (Excel)

 Copy code hover
[image]

Worksheet.Activate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a workbook, worksheet, chart sheet, or embedded chart is activated.

Syntax

expression .Activate

expression A variable that represents a Worksheet object.

Return Value

nothing

Remarks

This event doesn't occur when you create a new window.

When you switch between two windows showing the same workbook, the WindowActivate event occurs, but the Activate event for the workbook doesn't occur.

Example

This example sorts the range A1:A10 when the worksheet is activated.

VBA Copy code Copy code
Private Sub Worksheet_Activate()
 Range("a1:a10").Sort Key1:=Range("a1"), Order:=xlAscending
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.BeforeDelete Event (Excel)

 Copy code hover
[image]

Worksheet.BeforeDelete Event (Excel)
See also Send feedback

Occurs before the worksheet is deleted.

Syntax

expression .BeforeDelete

expression A variable that represents a Worksheet object.

Return Value

None

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.BeforeDoubleClick Event (Excel)

 Copy code hover
[image]

Worksheet.BeforeDoubleClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a worksheet is double-clicked, before the default double-click action.

Syntax

expression .BeforeDoubleClick(Target, Cancel)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Range | The cell nearest to the mouse pointer when the double-click occurs.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default double-click action isn't performed when the procedure is finished.

Remarks

The DoubleClick method doesn't cause this event to occur.

This event doesn't occur when the user double-clicks the border of a cell.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.BeforeRightClick Event (Excel)

 Copy code hover
[image]

Worksheet.BeforeRightClick Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when a worksheet is right-clicked, before the default right-click action.

Syntax

expression .BeforeRightClick(Target, Cancel)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Range | The cell nearest to the mouse pointer when the right-click occurs.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default right-click action doesn't occur when the procedure is finished.

Remarks

Like other worksheet events, this event doesn't occur if you right-click while the pointer is on a shape or a command bar (a toolbar or menu bar).

Example

This example adds a new menu item to the shortcut menu for cells B1:B10.

VBA Copy code Copy code
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
 Cancel As Boolean)
 Dim icbc As Object
 For Each icbc In Application.CommandBars("cell").Controls
 If icbc.Tag = "brccm" Then icbc.Delete
 Next icbc
 If Not Application.Intersect(Target, Range("b1:b10")) _
 Is Nothing Then
 With Application.CommandBars("cell").Controls _
 .Add(Type:=msoControlButton, before:=6, _
 temporary:=True)
 .Caption = "New Context Menu Item"
 .OnAction = "MyMacro"
 .Tag = "brccm"
 End With
 End If
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Calculate Event (Excel)

 Copy code hover
[image]

Worksheet.Calculate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after the worksheet is recalculated, for the Worksheet object.

Syntax

expression .Calculate

expression A variable that represents a Worksheet object.

Return Value

nothing

Example

This example adjusts the size of columns A through F whenever the worksheet is recalculated.

VBA Copy code Copy code
Private Sub Worksheet_Calculate()
 Columns("A:F").AutoFit
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Change Event (Excel)

 Copy code hover
[image]

Worksheet.Change Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when cells on the worksheet are changed by the user or by an external link.

Syntax

expression .Change(Target)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Range | The changed range. Can be more than one cell.

Return Value

Nothing

Remarks

This event does not occur when cells change during a recalculation. Use the Calculate event to trap a sheet recalculation.

Example

The following code example changes the color of changed cells to blue.

VBA Copy code Copy code
Private Sub Worksheet_Change(ByVal Target as Range)
    Target.Font.ColorIndex = 5
End Sub

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributors

The following code example verifies that, when a cell value changes, the changed cell is in column A, and if the changed value of the cell is greater than 100. If the value is greater than 100, the adjacent cell in column B is changed to the color red.

VBA Copy code Copy code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Column = 1 Then
        ThisRow = Target.Row
        If Target.Value > 100 Then
            Range("B" & ThisRow).Interior.ColorIndex = 3
        Else
            Range("B" & ThisRow).Interior.ColorIndex = xlColorIndexNone
        End If
    End If
End Sub

Sample code provided by: MVP Contributor Tom Urtis, Atlas Programming Management | About the Contributors

The following code example sets the values in the range A1:A10 to be uppercase as the data is entered into the cell.

VBA Copy code Copy code
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1:A10")) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
    Application.EnableEvents = False
    'Set the values to be uppercase
    Target.Value = UCase(Target.Value)
    Application.EnableEvents = True
End Sub

About the Contributors

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

MVP Tom Urtis is the founder of Atlas Programming Management, a full-service Microsoft Office and Excel business solutions company in Silicon Valley. Tom has over 25 years of experience in business management and developing Microsoft Office applications, and is the co-author of "Holy Macro! It's 2,500 Excel VBA Examples."

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.Deactivate Event (Excel)

 Copy code hover
[image]

Worksheet.Deactivate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the chart, worksheet, or workbook is deactivated.

Syntax

expression .Deactivate

expression A variable that represents a Worksheet object.

Return Value

nothing

Example

This example arranges all open windows when the workbook is deactivated.

VBA Copy code Copy code
Private Sub Workbook_Deactivate()
 Application.Windows.Arrange xlArrangeStyleTiled
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.FollowHyperlink Event (Excel)

 Copy code hover
[image]

Worksheet.FollowHyperlink Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when you click any hyperlink on a worksheet. For application- and workbook-level events, see the SheetFollowHyperlink event and SheetFollowHyperlink event.

Syntax

expression .FollowHyperlink(Target)

expression An expression that returns a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Hyperlink | A Hyperlink object that represents the destination of the hyperlink.

Example

This example keeps a list, or history, of all the links that have been visited from the active worksheet.

VBA Copy code Copy code
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    With UserForm1
        .ListBox1.AddItem Target.Address
        .Show
    End With
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.LensGalleryRenderComplete Event (Excel)

 Copy code hover
[image]

Worksheet.LensGalleryRenderComplete Event (Excel)
See also Send feedback

Occurs when a callout gallery's icons (dynamic & static) have completed rendering.

Version information

Version Added: Excel 2013

Syntax

expression .LensGalleryRenderComplete

expression A variable that represents a Worksheet object.

Remarks

This event can be used to indicate when re-enable screen updating or display additional dialogs, for example.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableAfterValueChange Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableAfterValueChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a cell or range of cells inside a PivotTable are edited or recalculated (for cells that contain formulas).

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTableAfterValueChange(TargetPivotTable, TargetRange)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
TargetPivotTable | Required | PivotTable | The PivotTable that contains the edited or recalculated cells.
TargetRange | Required | Range | The range that contains all the edited or recalcuated cells.

Return Value

Nothing

Remarks

The PivotTableAfterValueChange event does not occur under any conditions other than editing or recalculating cells. For example, it will not occur when the PivotTable is refreshed, sorted, filtered, or drilled down on, even though those operations move cells and potentially retrieve new values from the OLAP data source.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableBeforeAllocateChanges Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableBeforeAllocateChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are applied to a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTableBeforeAllocateChanges(TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to apply.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList collection. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not applied to the PivotTable and all edits are lost.

Return Value

Nothing

Remarks

The PivotTableBeforeAllocateChanges event occurs immediately before Excel executes an UPDATE CUBE statement to apply all changes to the PivotTable's OLAP data source, and immediately after the user has chosen to apply changes in the user interface.

Example

The following code example prompts the user before updates are applied to the PivotTable's OLAP data source.

VBA Copy code Copy code
Sub Worksheet_PivotTableBeforeAllocateChanges(ByVal TargetPivotTable As PivotTable, _
 ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
 Dim UserChoice As VbMsgBoxResult

 UserChoice = MsgBox("Allow updates to be applied to: " + TargetPivotTable.Name + "?", vbYesNo)
 If UserChoice = vbNo Then Cancel = True
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableBeforeCommitChanges Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableBeforeCommitChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes are committed against the OLAP data source for a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTableBeforeCommitChanges(TargetPivotTable, ValueChangeStart, ValueChangeEnd, Cancel)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to commit.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the changes are not committed against the OLAP data source of the PivotTable.

Return Value

Nothing

Remarks

The PivotTableBeforeCommitChanges event occurs immediately before Excel executes a COMMIT TRANSACTION against the PivotTable's OLAP data source, and immediately after the user has chosen to save changes for the whole PivotTable.

Example

The following code example prompts the user before changes are commited to the PivotTable's OLAP data source.

VBA Copy code Copy code
Sub Worksheet_PivotTableBeforeCommitChanges(ByVal TargetPivotTable As PivotTable, _
 ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)

 Dim UserChoice As VbMsgBoxResult

 UserChoice = MsgBox("Allow updates to be saved to: " + TargetPivotTable.Name + "?", vbYesNo)
 If UserChoice = vbNo Then Cancel = True
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableBeforeDiscardChanges Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableBeforeDiscardChanges Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs before changes to a PivotTable are discarded.

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTableBeforeDiscardChanges(TargetPivotTable, ValueChangeStart, ValueChangeEnd)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
TargetPivotTable | Required | PivotTable | The PivotTable that contains the changes to discard.
ValueChangeStart | Required | Long | The index to the first change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.
ValueChangeEnd | Required | Long | The index to the last change in the associated PivotTableChangeList object. The index is specified by the Order property of the ValueChange object in the PivotTableChangeList collection.

Return Value

Nothing

Remarks

Occurs immediately before Excel executes a ROLLBACK TRANSACTION statement against the OLAP data source, if a transaction is still active, and then discards all edited values in the PivotTable, after the user has chosen to discard changes.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableChangeSync Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableChangeSync Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after changes to a PivotTable.

Version Information

Version Added: Excel 2010

Syntax

expression .PivotTableChangeSync(Target )

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | PivotTable | The PivotTable that was changed.

Return Value

Nothing

Remarks

The PivotTableChangeEvent occurs during most changes to a PivotTable, so that you can write code to respond to user actions, such as clearing, grouping, or refreshing items in the PivotTable.

Example

The following code example displays a message box that shows the name of the PivotTable the user changed.

VBA Copy code Copy code
Private Sub Worksheet_PivotTableChangeSync(ByVal Target As PivotTable)

With Target
 MsgBox "You performed an operation in the following PivotTable: " & .Name
End With

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.PivotTableUpdate Event (Excel)

 Copy code hover
[image]

Worksheet.PivotTableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a PivotTable report is updated on a worksheet.

Syntax

expression .PivotTableUpdate(Target)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | PivotTable | The selected PivotTable report.

Return Value

Nothing

Example

This example displays a message stating that the PivotTable report has been updated. This example assumes you have declared an object of type Worksheet with events in a class module.

VBA Copy code Copy code
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

 MsgBox "The PivotTable connection has been updated."

End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.SelectionChange Event (Excel)

 Copy code hover
[image]

Worksheet.SelectionChange Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs when the selection changes on a worksheet.

Syntax

expression .SelectionChange(Target)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data Type | Description
Target | Required | Range | The new selected range.

Example

This example scrolls through the workbook window until the selection is in the upper-left corner of the window.

VBA Copy code Copy code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 With ActiveWindow
 .ScrollRow = Target.Row
 .ScrollColumn = Target.Column
 End With
End Sub

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


Worksheet.TableUpdate Event (Excel)

 Copy code hover
[image]

Worksheet.TableUpdate Event (Excel)
See also Send feedback

Published: July 16, 2012

Occurs after a Query table connected to the Data Model is updated on a worksheet.

Version information

Version Added: Excel 2013

Syntax

expression .TableUpdate(Target)

expression A variable that represents a Worksheet object.

Parameters

Name | Required/Optional | Data type | Description
Target | Required | TABLEOBJECT | The Query table with data from the Data Model.

See also

Concepts

Worksheet Object

Other resources

Worksheet Object Members


WorksheetDataConnection Object (Excel)

 Copy code hover
[image]

WorksheetDataConnection Object (Excel)
See also Send feedback

Published: July 16, 2012

Used to import data into the Data Model from data on the worksheet such as ranges and tables.

Version information

Version Added: Excel 2013

See also

Other resources

WorksheetDataConnection Object Members


WorksheetDataConnection Members (Excel)

 Copy code hover
[image]

WorksheetDataConnection Members (Excel)
Send feedback

Published: July 16, 2012

Used to import data into the Data Model from data on the worksheet such as ranges and tables.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets one of the XlCmdType Enumeration (Excel) constants. For a WorksheetDataConnection object, this type will be set to xlCmdExcel.
Connection | Returns the internal connection string to the object in Excel. Variant Read-only
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified WorksheetDataConnection Object (Excel) object. Read-only.


WorksheetDataConnection Properties (Excel)

 Copy code hover
[image]

WorksheetDataConnection Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Excel application. Read-only.
CommandText | Returns or sets the command string for the specified data source. Variant Read/Write
CommandType | Returns or sets one of the XlCmdType Enumeration (Excel) constants. For a WorksheetDataConnection object, this type will be set to xlCmdExcel.
Connection | Returns the internal connection string to the object in Excel. Variant Read-only
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified WorksheetDataConnection Object (Excel) object. Read-only.


WorksheetDataConnection.Application Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Excel application. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Application

expression A variable that represents a WorksheetDataConnection Object (Excel) object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

Property value

APPLICATION

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetDataConnection.CommandText Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.CommandText Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets the command string for the specified data source. Variant Read/Write

Version information

Version Added: Excel 2013

Syntax

expression .CommandText

expression A variable that represents a WorksheetDataConnection object.

Property value

VARIANT

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetDataConnection.CommandType Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.CommandType Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets one of the XlCmdType Enumeration (Excel) constants. For a WorksheetDataConnection object, this type will be set to xlCmdExcel.

Version information

Version Added: Excel 2013

Syntax

expression .CommandType

expression A variable that represents a WorksheetDataConnection object.

Property value

XLCMDTYPE

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetDataConnection.Connection Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.Connection Property (Excel)
See also Send feedback

Returns the internal connection string to the object in Excel. Variant Read-only

Version information

Version Added: Excel 2013

Syntax

expression .Connection

expression A variable that represents a WorksheetDataConnection object.

Property value

VARIANT

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetDataConnection.Creator Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Excel 2013

Syntax

expression .Creator

expression A variable that represents a WorksheetDataConnection Object (Excel) object.

Remarks

Because the object was created in Microsoft Excel, this property returns the hexadecimal value, 5843454C, which represents the string "XCEL".

Property value

XLCREATOR

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetDataConnection.Parent Property (Excel)

 Copy code hover
[image]

WorksheetDataConnection.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified WorksheetDataConnection Object (Excel) object. Read-only.

Version information

Version Added: Excel 2013

Syntax

expression .Parent

expression A variable that represents a WorksheetDataConnection Object (Excel) object.

Property value

OBJECT

See also

Other resources

WorksheetDataConnection Object Members
WorksheetDataConnection Object


WorksheetFunction Object (Excel)

 Copy code hover
[image]

WorksheetFunction Object (Excel)
See also Send feedback

Used as a container for Microsoft Excel worksheet functions that can be called from Visual Basic.

Example

Use the WorksheetFunction property to return the WorksheetFunction object. The following example displays the result of applying the Min worksheet function to the range A1:C10.

VBA Copy code Copy code
Set myRange = Worksheets("Sheet1").Range("A1:C10")
answer = Application.WorksheetFunction.Min(myRange)
MsgBox answer

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

This example uses the CountA worksheet function to determine how many cells in column A contain a value. For this example, the values in column A should be text. This example does a spell check on each value in column A, and if the value is spelled incorrectly, inserts the text "Wrong" into column B; otherwise, it inserts the text "OK" into column B.

VBA Copy code Copy code
Sub StartSpelling()
   'Set up your variables
   Dim iRow As Integer

   'And define your error handling routine.
   On Error GoTo ERRORHANDLER

   'Go through all the cells in column A, and perform a spellcheck on the value.
   'If the value is spelled incorrectly, write "Wrong" in column B, otherwise write "OK".
   For iRow = 1 To WorksheetFunction.CountA(Columns(1))
      If Application.CheckSpelling( _
         Cells(iRow, 1).Value, , True) = False Then
         Cells(iRow, 2).Value = "Wrong"
      Else
         Cells(iRow, 2).Value = "OK"
      End If
   Next iRow
   Exit Sub

    'Error handling routine.
ERRORHANDLER:
    MsgBox "The spell check feature is not installed!"

End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

Excel Object Model Reference

Other resources

WorksheetFunction Object Members


WorksheetFunction Members (Excel)

 Copy code hover
[image]

WorksheetFunction Members (Excel)
Send feedback

Published: July 16, 2012

Used as a container for Microsoft Excel worksheet functions that can be called from Visual Basic.

Methods

Name | Description
AccrInt | Returns the accrued interest for a security that pays periodic interest.
AccrIntM | Returns the accrued interest for a security that pays interest at maturity.
Acos | Returns the arccosine, or inverse cosine, of a number. The arccosine is the angle whose cosine is Arg1. The returned angle is given in radians in the range 0 (zero) to pi.
Acosh | Returns the inverse hyperbolic cosine of a number. Number must be greater than or equal to 1. The inverse hyperbolic cosine is the value whose hyperbolic cosine is Arg1, so Acosh(Cosh(number)) equals Arg1.
Acot | Returns the arccotangent of a number, in radians in the range 0 to Pi.
Acoth | Returns the inverse hyperbolic cotangent of a number.
Aggregate | Returns an aggregate in a list or database.
AmorDegrc | Returns the depreciation for each accounting period. This function is provided for the French accounting system.
AmorLinc | Returns the depreciation for each accounting period. This function is provided for the French accounting system.
And | Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
Arabic | Converts a Roman numeral to an Arabic numeral.
Asc | For Double-byte character set (DBCS) languages, changes full-width (double-byte) characters to half-width (single-byte) characters.
Asin | Returns the arcsine, or inverse sine, of a number. The arcsine is the angle whose sine is Arg1. The returned angle is given in radians in the range -pi/2 to pi/2.
Asinh | Returns the inverse hyperbolic sine of a number. The inverse hyperbolic sine is the value whose hyperbolic sine is Arg1, so Asinh(Sinh(number)) equals Arg1.
Atan2 | Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, excluding -pi.
Atanh | Returns the inverse hyperbolic tangent of a number. Number must be between -1 and 1 (excluding -1 and 1).
AveDev | Returns the average of the absolute deviations of data points from their mean. AveDev is a measure of the variability in a data set.
Average | Returns the average (arithmetic mean) of the arguments.
AverageIf | Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria.
AverageIfs | Returns the average (arithmetic mean) of all cells that meet multiple criteria.
BahtText | Converts a number to Thai text and adds a suffix of "Baht."
Base | Converts a number into a text representation with the given radix (base).
BesselI | Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments.
BesselJ | Returns the Bessel function.
BesselK | Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments.
BesselY | Returns the Bessel function, which is also called the Weber function or the Neumann function.
Beta_Dist | Returns the beta cumulative distribution function.
Beta_Inv | Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = Beta_Dist(x,...), then Beta_Inv(probability,...) = x.
BetaDist | Returns the beta cumulative distribution function.
BetaInv | Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = BetaDist(x,...), then BetaInv(probability,...) = x.
Bin2Dec | Converts a binary number to decimal.
Bin2Hex | Converts a binary number to hexadecimal.
Bin2Oct | Converts a binary number to octal.
Binom_Dist | Returns the individual term binomial distribution probability.
Binom_Dist_Range | Returns the probability of a trial result using a binomial distribution.
Binom_Inv | Returns the inverse of the individual term binomial distribution probability.
BinomDist | Returns the individual term binomial distribution probability.
Bitand | Returns a 'Bitwise And' of two numbers
Bitlshift | Returns a value number shifted left by shift_amount bits.
Bitor | Returns a bitwise OR of 2 numbers.
Bitrshift | Returns a value number shifted right by shift_amount bits.
Bitxor | Returns a bitwise 'Exclusive Or' of two numbers.
Ceiling | Returns number rounded up, away from zero, to the nearest multiple of significance.
Ceiling_Math | Rounds a number up, to the nearest integer or to the nearest multiple of significance.
Ceiling_Precise | Returns the specified number rounded to the nearest multiple of significance.
ChiDist | Returns the one-tailed probability of the chi-squared distribution.
ChiInv | Returns the inverse of the one-tailed probability of the chi-squared distribution.
ChiSq_Dist | Returns the chi-squared distribution.
ChiSq_Dist_RT | Returns the right-tailed probability of the chi-squared distribution.
ChiSq_Inv | Returns the inverse of the left-tailed probability of the chi-squared distribution.
ChiSq_Inv_RT | Returns the inverse of the right-tailed probability of the chi-squared distribution.
ChiSq_Test | Returns the test for independence.
ChiTest | Returns the test for independence.
Choose | Uses Arg1 as the index to return a value from the list of value arguments.
Clean | Removes all nonprintable characters from text.
Combin | Returns the number of combinations for a given number of items. Use Combin to determine the total possible number of groups for a given number of items.
Combina | Returns the number of combinations with repetitions for a given number of items.
Complex | Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj.
Confidence | Returns a value that you can use to construct a confidence interval for a population mean.
Confidence_Norm | Returns a value that you can use to construct a confidence interval for a population mean.
Confidence_T | Returns the confidence interval for a population mean, using a Student's t distribution.
Convert | Converts a number from one measurement system to another. For example, Convert can translate a table of distances in miles to a table of distances in kilometers.
Correl | Returns the correlation coefficient of the Arg1 and Arg2 cell ranges.
Cosh | Returns the hyperbolic cosine of a number.
Cot | Returns the cotangent of an angle.
Coth | Returns the hyperbolic cotangent of a number
Count | Counts the number of cells that contain numbers and counts numbers within the list of arguments.
CountA | Counts the number of cells that are not empty and the values within the list of arguments.
CountBlank | Counts empty cells in a specified range of cells.
CountIf | Counts the number of cells within a range that meet the given criteria.
CountIfs | Counts the number of cells within a range that meet multiple criteria.
CoupDayBs | Returns the number of days from the beginning of the coupon period to the settlement date.
CoupDays | Returns the number of days in the coupon period that contains the settlement date.
CoupDaysNc | Returns the number of days from the settlement date to the next coupon date.
CoupNcd | Returns a number that represents the next coupon date after the settlement date.
CoupNum | Returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.
CoupPcd |
Covar | Returns covariance, the average of the products of deviations for each data point pair.
Covariance_P | Returns population covariance, the average of the products of deviations for each data point pair.
Covariance_S | Returns the sample covariance, the average of the products of deviations for each data point pair in two data sets.
CritBinom | Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.
Csc | Returns the cosecant of an angle.
Csch | Returns the hyperbolic cosecant of an angle.
CumIPmt | Returns the cumulative interest paid on a loan between start_period and end_period.
CumPrinc | Returns the cumulative principal paid on a loan between start_period and end_period.
DAverage | Averages the values in a column of a list or database that match conditions you specify.
Days | Returns the number of days between the two dates.
Days360 | Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.
Db | Returns the depreciation of an asset for a specified period using the fixed-declining balance method.
Dbcs | Converts half-width (single-byte) letters within a character string to full-width (double-byte) characters. The name of the function (and the characters that it converts) depends upon the language settings. Read/write String.
DCount | Counts the cells that contain numbers in a column of a list or database that match conditions that you specify.
DCountA | Counts the nonblank cells in a column of a list or database that match conditions that you specify.
Ddb | Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.
Dec2Bin | Converts a decimal number to binary.
Dec2Hex | Converts a decimal number to hexadecimal.
Dec2Oct | Converts a decimal number to octal.
Decimal | Converts a text representation of a number in a given base into a decimal number.
Degrees | Converts radians into degrees.
Delta | Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise.
DevSq | Returns the sum of squares of deviations of data points from their sample mean.
DGet | Extracts a single value from a column of a list or database that matches conditions that you specify.
Disc | Returns the discount rate for a security.
DMax | Returns the largest number in a column of a list or database that matches conditions you that specify.
DMin | Returns the smallest number in a column of a list or database that matches conditions that you specify.
Dollar | The function described in this Help topic converts a number to text format and applies a currency symbol. The name of the function (and the symbol that it applies) depends upon your language settings.
DollarDe | Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. Use DOLLARDE to convert fractional dollar numbers, such as securities prices, to decimal numbers.
DollarFr | Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Use DOLLARFR to convert decimal numbers to fractional dollar numbers, such as securities prices.
DProduct | Multiplies the values in a column of a list or database that match conditions that you specify.
DStDev | Estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
DStDevP | Calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
DSum | Adds the numbers in a column of a list or database that match conditions that you specify.
Duration | Returns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of the cash flows and is used as a measure of a bond price's response to changes in yield.
DVar | Estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
DVarP | Calculates the variance of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
EDate | Returns the serial number that represents the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
Effect | Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year.
EncodeURL | URL encodes the argument.
EoMonth | Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
Erf | Returns the error function integrated between lower_limit and upper_limit.
Erf_Precise | Returns the error function integrated between zero and lower_limit.
ErfC | Returns the complementary ERF function integrated between the specified parameter and infinity.
ErfC_Precise | Returns the complementary error function integrated between the specified value and infinity.
Even | Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.
Expon_Dist | Returns the exponential distribution. Use EXPON_DIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPON_DIST to determine the probability that the process takes at most 1 minute.
ExponDist | Returns the exponential distribution. Use EXPONDIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPONDIST to determine the probability that the process takes at most 1 minute.
F_Dist | Returns the F probability distribution.
F_Dist_RT | Returns the right-tailed F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.
F_Inv | Returns the inverse of the F probability distribution.
F_Inv_RT | Returns the inverse of the right-tailed F probability distribution. If p = F_DIST_RT(x,...), then F_INV_RT(p,...) = x.
F_Test | Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.
Fact | Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.
FactDouble | Returns the double factorial of a number.
FDist | Returns the F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.
FilterXML | Get specific data from the returned XML, typically from a WebService function call.
Find | Finds specific information in a worksheet.
FindB | FIND and FINDB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
FInv | Returns the inverse of the F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x.
Fisher | Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient.
FisherInv | Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x.
Fixed | Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.
Floor | Rounds number down, toward zero, to the nearest multiple of significance.
Floor_Math | Rounds a number down, to the nearest integer or to the nearest multiple of significance.
Floor_Precise | Rounds the specified number to the nearest multiple of significance.
Forecast | Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. You can use this function to predict future sales, inventory requirements, or consumer trends.
Frequency | Calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula.
FTest | Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.
Fv | Returns the future value of an investment based on periodic, constant payments and a constant interest rate.
FVSchedule | Returns the future value of an initial principal after applying a series of compound interest rates. Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
Gamma | Returns the Gamma function value.
Gamma_Dist | Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.
Gamma_Inv | Returns the inverse of the gamma cumulative distribution. If p = GAMMA_DIST(x,...), then GAMMA_INV(p,...) = x.
GammaDist | Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.
GammaInv | Returns the inverse of the gamma cumulative distribution. If p = GAMMADIST(x,...), then GAMMAINV(p,...) = x.
GammaLn | Returns the natural logarithm of the gamma function, Γ(x).
GammaLn_Precise | Returns the natural logarithm of the gamma function, Γ(x).
Gauss | Returns 0.5 less than the standard normal cumulative distribution.
Gcd | Returns the greatest common divisor of two or more integers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.
GeoMean | Returns the geometric mean of an array or range of positive data. For example, you can use GEOMEAN to calculate average growth rate given compound interest with variable rates.
GeStep | Returns 1 if number ≥ step; returns 0 (zero) otherwise. Use this function to filter a set of values. For example, by summing several GESTEP functions you calculate the count of values that exceed a threshold.
Growth | Calculates predicted exponential growth by using existing data. GROWTH returns the y-values for a series of new x-values that you specify by using existing x-values and y-values. You can also use the GROWTH worksheet function to fit an exponential curve to existing x-values and y-values.
HarMean | Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals.
Hex2Bin | Converts a hexadecimal number to binary.
Hex2Dec | Converts a hexadecimal number to decimal.
Hex2Oct | Converts a hexadecimal number to octal.
HLookup | Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find.
HypGeom_Dist | Returns the hypergeometric distribution. HYPGEOM_DIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOM_DIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.
HypGeomDist | Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOMDIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.
IfError | Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula.
IfNa | Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression.
ImAbs | Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.
Imaginary | Returns the imaginary coefficient of a complex number in x + yi or x + yj text format.
ImArgument | Returns the argument [image] (theta), an angle expressed in radians, such that:
ImConjugate | Returns the complex conjugate of a complex number in x + yi or x + yj text format.
ImCos | Returns the cosine of a complex number in x + yi or x + yj text format.
ImCosh | Returns the hyperbolic cosine of a complex number.
ImCot | Returns the cotangent of a complex number.
ImCsc | Returns the cosecant of a complex number.
ImCsch | Returns the hyperbolic cosecant of a complex number.
ImDiv | Returns the quotient of two complex numbers in x + yi or x + yj text format.
ImExp | Returns the exponential of a complex number in x + yi or x + yj text format.
ImLn | Returns the natural logarithm of a complex number in x + yi or x + yj text format.
ImLog10 | Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
ImLog2 | Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.
ImPower | Returns a complex number in x + yi or x + yj text format raised to a power.
ImProduct | Returns the product of 2 to 29 complex numbers in x + yi or x + yj text format.
ImReal | Returns the real coefficient of a complex number in x + yi or x + yj text format.
ImSec | Returns the hyperbolic cosecant of a complex number.
ImSech | Returns the secant of a complex number.
ImSin | Returns the sine of a complex number in x + yi or x + yj text format.
ImSinh | Returns the hyperbolic sine of a complex number.
ImSqrt | Returns the square root of a complex number in x + yi or x + yj text format.
ImSub | Returns the difference of two complex numbers in x + yi or x + yj text format.
ImSum | Returns the sum of two or more complex numbers in x + yi or x + yj text format.
ImTan | Returns the tangent of a complex number.
Index | Returns a value or the reference to a value from within a table or range. There are two forms of the INDEX function: the array form and the reference form.
Intercept | Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. The intercept point is based on a best-fit regression line plotted through the known x-values and known y-values. Use the INTERCEPT function when you want to determine the value of the dependent variable when the independent variable is 0 (zero). For example, you can use the INTERCEPT function to predict a metal's electrical resistance at 0°C when your data points were taken at room temperature and higher.
IntRate | Returns the interest rate for a fully invested security.
Ipmt | Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
Irr | Returns the internal rate of return for a series of cash flows represented by the numbers in values. These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods.
IsErr | Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value except #N/A.
IsError | Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!).
IsEven | Checks the type of value and returns TRUE or FALSE depending if the value is even.
IsFormula | Checks whether a reference is to a cell containing a formula, and returns TRUE or FALSE.
IsLogical | Checks the type of value and returns TRUE or FALSE depending if the value refers to a logical value.
IsNA | Checks the type of value and returns TRUE or FALSE depending if the value refers to the #N/A (value not available) error value.
IsNonText | Checks the type of value and returns TRUE or FALSE depending if the value refers to any item that is not text. (Note that this function returns TRUE if value refers to a blank cell.)
IsNumber | Checks the type of value and returns TRUE or FALSE depending if the value refers to a number.
ISO_Ceiling | Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance.
IsOdd | Checks the type of value and returns TRUE or FALSE depending if the value is odd.
IsoWeekNum | Returns the ISO week number of the year for a given date. .
Ispmt | Calculates the interest paid during a specific period of an investment. This function is provided for compatibility with Lotus 1-2-3.
IsText | Checks the type of value and returns TRUE or FALSE depending if the value refers to text.
Kurt | Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution.
Large | Returns the k-th largest value in a data set. You can use this function to select a value based on its relative standing. For example, you can use LARGE to return the highest, runner-up, or third-place score.
Lcm | Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.
LinEst | Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, and returns an array that describes the line. Because this function returns an array of values, it must be entered as an array formula.
Ln | Returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904).
Log | Returns the logarithm of a number to the base you specify.
Log10 | Returns the base-10 logarithm of a number.
LogEst | In regression analysis, calculates an exponential curve that fits your data and returns an array of values that describes the curve. Because this function returns an array of values, it must be entered as an array formula.
LogInv | Use the lognormal distribution to analyze logarithmically transformed data.
LogNorm_Dist | Returns the lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.
LogNorm_Inv | Returns the inverse of the lognormal cumulative distribution function. Use the lognormal distribution to analyze logarithmically transformed data.
LogNormDist | Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.
Lookup | Returns a value either from a one-row or one-column range or from an array. The LOOKUP function has two syntax forms: the vector form and the array form.
Match | Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.
Max | Returns the largest value in a set of values.
MDeterm | Returns the matrix determinant of an array.
MDuration | Returns the modified Macauley duration for a security with an assumed par value of $100.
Median | Returns the median of the given numbers. The median is the number in the middle of a set of numbers.
Min | Returns the smallest number in a set of values.
MInverse | Returns the inverse matrix for the matrix stored in an array.
MIrr | Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash.
MMult | Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2.
Mode | Returns the most frequently occurring, or repetitive, value in an array or range of data.
Mode_Mult | Returns a vertical array of the most frequently occurring, or repetitive, values in an array or range of data.
Mode_Sngl | Returns the most frequently occurring, or repetitive, value in an array or range of data.
MRound | Returns a number rounded to the desired multiple.
MultiNomial | Returns the ratio of the factorial of a sum of values to the product of factorials.
Munit | Returns the unit matrix for the specified dimension.
NegBinom_Dist | Returns the negative binomial distribution. NEGBINOM_DIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.
NegBinomDist | Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.
NetworkDays | Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.
NetworkDays_Intl | Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.
Nominal | Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year.
Norm_Dist | Returns the normal distribution for the specified mean and standard deviation. This function has a wide range of applications in statistics, including hypothesis testing.
Norm_Inv | Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
Norm_S_Dist | Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.
Norm_S_Inv | Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of 0 (zero) and a standard deviation of one.
NormDist | Returns the normal distribution for the specified mean and standard deviation. This function has a very wide range of applications in statistics, including hypothesis testing.
NormInv | Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
NormSDist | Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.
NormSInv | Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.
NPer | Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate.
Npv | Calculates the net present value of an investment by using a discount rate and a series of future payments (negative values) and income (positive values).
NumberValue | Converts text to number in a locale-independent manner.
Oct2Bin | Converts an octal number to binary.
Oct2Dec | Converts an octal number to decimal.
Oct2Hex | Converts an octal number to hexadecimal.
Odd | Returns number rounded up to the nearest odd integer.
OddFPrice | Returns the price per $100 face value of a security having an odd (short or long) first period.
OddFYield | Returns the yield of a security that has an odd (short or long) first period.
OddLPrice | Returns the price per $100 face value of a security having an odd (short or long) last coupon period.
OddLYield | Returns the yield of a security that has an odd (short or long) last period.
Or | Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
PDuration | Returns the number of periods required by an investment to reach a specified value.
Pearson | Returns the Pearson product moment correlation coefficient, r, a dimensionless index that ranges from -1.0 to 1.0 inclusive and reflects the extent of a linear relationship between two data sets.
Percentile | Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile.
Percentile_Exc | Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive.
Percentile_Inc | Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can examine candidates who score above the 90th percentile.
PercentRank | Returns the rank of a value in a data set as a percentage of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK to evaluate the standing of an aptitude test score among all scores for the test.
PercentRank_Exc | Returns the rank of a value in a data set as a percentage (0..1, exclusive) of the data set.
PercentRank_Inc | Returns the rank of a value in a data set as a percentage (0..1, inclusive) of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK_INC to evaluate the standing of an aptitude test score among all scores for the test.
Permut | Returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations.
Permutationa | Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects.
Phi | Returns the value of the density function for a standard normal distribution.
Phonetic | Extracts the phonetic (furigana) characters from a text string.
Pi | Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15 digits.
Pmt | Calculates the payment for a loan based on constant payments and a constant interest rate.
Poisson | Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute.
Poisson_Dist | Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in one minute.
Power | Returns the result of a number raised to a power.
Ppmt | Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
Price | Returns the price per $100 face value of a security that pays periodic interest.
PriceDisc | Returns the price per $100 face value of a discounted security.
PriceMat | Returns the price per $100 face value of a security that pays interest at maturity.
Prob | Returns the probability that values in a range are between two limits. If upper_limit is not supplied, returns the probability that values in x_range are equal to lower_limit.
Product | Multiplies all the numbers given as arguments and returns the product.
Proper | Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters.
Pv | Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now. For example, when you borrow money, the loan amount is the present value to the lender.
Quartile | Returns the quartile of a data set. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE to find the top 25 percent of incomes in a population.
Quartile_Exc | Returns the quartile of the data set, based on percentile values from 0..1, exclusive.
Quartile_Inc | Returns the quartile of a data set based on percentile values from 0..1, inclusive. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE_INC to find the top 25 percent of incomes in a population.
Quotient | Returns the integer portion of a division. Use this function when you want to discard the remainder of a division.
Radians | Converts degrees to radians.
RandBetween | Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.
Rank | Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)
Rank_Avg | Returns the rank of a number in a list of numbers; that is its size relative to other values in the list. If more than one value has the same rank, the average rank is returned.
Rank_Eq | Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)
Rate | Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value.
Received | Returns the amount received at maturity for a fully invested security.
Replace | Replaces part of a text string, based on the number of characters you specify, with a different text string.
ReplaceB | REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string.
Rept | Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.
Roman | Converts an arabic numeral to roman, as text.
Round | Rounds a number to a specified number of digits.
RoundDown | Rounds a number down, toward zero.
RoundUp | Rounds a number up, away from 0 (zero).
Rri | Returns an equivalent interest rate for the growth of an investment.
RSq | Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. For more information, see PEARSON. The r-squared value can be interpreted as the proportion of the variance in y attributable to the variance in x.
RTD | This method connects to a source to receive real-time data.
Search | SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
SearchB | SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
Sec | Returns the secant of an angle.
Sech | Returns the hyperbolic secant of an angle.
SeriesSum | Returns the sum of a power series based on the formula:
Sinh | Returns the hyperbolic sine of a number.
Skew | Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.
Skew_p | Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean.
Sln | Returns the straight-line depreciation of an asset for one period.
Slope | Returns the slope of the linear regression line through data points in known_y's and known_x's. The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line.
Small | Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set.
SqrtPi | Returns the square root of (number * pi).
Standardize | Returns a normalized value from a distribution characterized by mean and standard_dev.
StDev | Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDev_P | Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDev_S | Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDevP | Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StEyx | Returns the standard error of the predicted y-value for each x in the regression. The standard error is a measure of the amount of error in the prediction of y for an individual x.
Substitute | Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.
Subtotal | Creates subtotals.
Sum | Adds all the numbers in a range of cells.
SumIf | Adds the cells specified by a given criteria.
SumIfs | Adds the cells in a range that meet multiple criteria.
SumProduct | Multiplies corresponding components in the given arrays, and returns the sum of those products.
SumSq | Returns the sum of the squares of the arguments.
SumX2MY2 | Returns the sum of the difference of squares of corresponding values in two arrays.
SumX2PY2 | Returns the sum of the sum of squares of corresponding values in two arrays. The sum of the sum of squares is a common term in many statistical calculations.
SumXMY2 | Returns the sum of squares of differences of corresponding values in two arrays.
Syd | Returns the sum-of-years' digits depreciation of an asset for a specified period.
T_Dist | Returns a Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are computed.
T_Dist_2T | Returns the two-tailed Student t-distribution.
T_Dist_RT | Returns the right-tailed Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.
T_Inv | Returns the left-tailed inverse of the Student t-distribution.
T_Inv_2T | Returns the t-value of the Student t-distribution as a function of the probability and the degrees of freedom.
T_Test | Returns the probability associated with a Student t-Test. Use T_TEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.
Tanh | Returns the hyperbolic tangent of a number.
TBillEq | Returns the bond-equivalent yield for a Treasury bill.
TBillPrice | Returns the price per $100 face value for a Treasury bill.
TBillYield | Returns the yield for a Treasury bill.
TDist | Returns the Percentage Points (probability) for the Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.
Text | Converts a value to text in a specific number format.
TInv | Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom.
Transpose | Returns a vertical range of cells as a horizontal range, or vice versa. TRANSPOSE must be entered as an array formula in a range that has the same number of rows and columns, respectively, as an array has columns and rows. Use TRANSPOSE to shift the vertical and horizontal orientation of an array on a worksheet.
Trend | Returns values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known_y's and known_x's. Returns the y-values along that line for the array of new_x's that you specify.
Trim | Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing.
TrimMean | Returns the mean of the interior of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set. You can use this function when you wish to exclude outlying data from your analysis.
TTest | Returns the probability associated with a Student's t-Test. Use TTEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.
Unichar | Returns the Unicode character referenced by the given numeric value.
Unicode | Returns the number (code point) corresponding to the first character of the text.
USDollar | Converts a number to text format and applies a currency symbol. The name of the method (and the symbol that it applies) depends upon the language settings.
Var | Estimates variance based on a sample.
Var_P | Calculates variance based on the entire population.
Var_S | Estimates variance based on a sample.
VarP | Calculates variance based on the entire population.
Vdb | Returns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify. VDB stands for variable declining balance.
VLookup | Searches for a value in the first column of a table array and returns a value in the same row from another column in the table array.
WebService | Underlying function that calls the web service asynchronously, using an HTTP GET request, and returns the response.
Weekday | Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.
WeekNum | Returns a number that indicates where the week falls numerically within a year.
Weibull | Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.
Weibull_Dist | Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating the mean time to failure for a device.
WorkDay | Returns a number that represents a date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.
WorkDay_Intl | Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters. Weekend parameters indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.
Xirr | Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the IRR function.
Xnpv | Returns the net present value for a schedule of cash flows that is not necessarily periodic. Read/write Double.
Xor | Returns a logical exclusive OR of all arguments.
YearFrac | Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term.
YieldDisc | Returns the annual yield for a discounted security.
YieldMat | Returns the annual yield of a security that pays interest at maturity.
Z_Test | Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, Z_TEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.
ZTest | Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, ZTEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. You can use this property with an OLE Automation object to return the application of that object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


WorksheetFunction Properties (Excel)

 Copy code hover
[image]

WorksheetFunction Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. You can use this property with an OLE Automation object to return the application of that object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.


WorksheetFunction.Application Property (Excel)

 Copy code hover
[image]

WorksheetFunction.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. You can use this property with an OLE Automation object to return the application of that object. Read-only.

Syntax

expression .Application

expression A variable that represents a WorksheetFunction object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Creator Property (Excel)

 Copy code hover
[image]

WorksheetFunction.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a WorksheetFunction object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Parent Property (Excel)

 Copy code hover
[image]

WorksheetFunction.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a WorksheetFunction object.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction Methods (Excel)

 Copy code hover
[image]

WorksheetFunction Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AccrInt | Returns the accrued interest for a security that pays periodic interest.
AccrIntM | Returns the accrued interest for a security that pays interest at maturity.
Acos | Returns the arccosine, or inverse cosine, of a number. The arccosine is the angle whose cosine is Arg1. The returned angle is given in radians in the range 0 (zero) to pi.
Acosh | Returns the inverse hyperbolic cosine of a number. Number must be greater than or equal to 1. The inverse hyperbolic cosine is the value whose hyperbolic cosine is Arg1, so Acosh(Cosh(number)) equals Arg1.
Acot | Returns the arccotangent of a number, in radians in the range 0 to Pi.
Acoth | Returns the inverse hyperbolic cotangent of a number.
Aggregate | Returns an aggregate in a list or database.
AmorDegrc | Returns the depreciation for each accounting period. This function is provided for the French accounting system.
AmorLinc | Returns the depreciation for each accounting period. This function is provided for the French accounting system.
And | Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
Arabic | Converts a Roman numeral to an Arabic numeral.
Asc | For Double-byte character set (DBCS) languages, changes full-width (double-byte) characters to half-width (single-byte) characters.
Asin | Returns the arcsine, or inverse sine, of a number. The arcsine is the angle whose sine is Arg1. The returned angle is given in radians in the range -pi/2 to pi/2.
Asinh | Returns the inverse hyperbolic sine of a number. The inverse hyperbolic sine is the value whose hyperbolic sine is Arg1, so Asinh(Sinh(number)) equals Arg1.
Atan2 | Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, excluding -pi.
Atanh | Returns the inverse hyperbolic tangent of a number. Number must be between -1 and 1 (excluding -1 and 1).
AveDev | Returns the average of the absolute deviations of data points from their mean. AveDev is a measure of the variability in a data set.
Average | Returns the average (arithmetic mean) of the arguments.
AverageIf | Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria.
AverageIfs | Returns the average (arithmetic mean) of all cells that meet multiple criteria.
BahtText | Converts a number to Thai text and adds a suffix of "Baht."
Base | Converts a number into a text representation with the given radix (base).
BesselI | Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments.
BesselJ | Returns the Bessel function.
BesselK | Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments.
BesselY | Returns the Bessel function, which is also called the Weber function or the Neumann function.
Beta_Dist | Returns the beta cumulative distribution function.
Beta_Inv | Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = Beta_Dist(x,...), then Beta_Inv(probability,...) = x.
BetaDist | Returns the beta cumulative distribution function.
BetaInv | Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = BetaDist(x,...), then BetaInv(probability,...) = x.
Bin2Dec | Converts a binary number to decimal.
Bin2Hex | Converts a binary number to hexadecimal.
Bin2Oct | Converts a binary number to octal.
Binom_Dist | Returns the individual term binomial distribution probability.
Binom_Dist_Range | Returns the probability of a trial result using a binomial distribution.
Binom_Inv | Returns the inverse of the individual term binomial distribution probability.
BinomDist | Returns the individual term binomial distribution probability.
Bitand | Returns a 'Bitwise And' of two numbers
Bitlshift | Returns a value number shifted left by shift_amount bits.
Bitor | Returns a bitwise OR of 2 numbers.
Bitrshift | Returns a value number shifted right by shift_amount bits.
Bitxor | Returns a bitwise 'Exclusive Or' of two numbers.
Ceiling | Returns number rounded up, away from zero, to the nearest multiple of significance.
Ceiling_Math | Rounds a number up, to the nearest integer or to the nearest multiple of significance.
Ceiling_Precise | Returns the specified number rounded to the nearest multiple of significance.
ChiDist | Returns the one-tailed probability of the chi-squared distribution.
ChiInv | Returns the inverse of the one-tailed probability of the chi-squared distribution.
ChiSq_Dist | Returns the chi-squared distribution.
ChiSq_Dist_RT | Returns the right-tailed probability of the chi-squared distribution.
ChiSq_Inv | Returns the inverse of the left-tailed probability of the chi-squared distribution.
ChiSq_Inv_RT | Returns the inverse of the right-tailed probability of the chi-squared distribution.
ChiSq_Test | Returns the test for independence.
ChiTest | Returns the test for independence.
Choose | Uses Arg1 as the index to return a value from the list of value arguments.
Clean | Removes all nonprintable characters from text.
Combin | Returns the number of combinations for a given number of items. Use Combin to determine the total possible number of groups for a given number of items.
Combina | Returns the number of combinations with repetitions for a given number of items.
Complex | Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj.
Confidence | Returns a value that you can use to construct a confidence interval for a population mean.
Confidence_Norm | Returns a value that you can use to construct a confidence interval for a population mean.
Confidence_T | Returns the confidence interval for a population mean, using a Student's t distribution.
Convert | Converts a number from one measurement system to another. For example, Convert can translate a table of distances in miles to a table of distances in kilometers.
Correl | Returns the correlation coefficient of the Arg1 and Arg2 cell ranges.
Cosh | Returns the hyperbolic cosine of a number.
Cot | Returns the cotangent of an angle.
Coth | Returns the hyperbolic cotangent of a number
Count | Counts the number of cells that contain numbers and counts numbers within the list of arguments.
CountA | Counts the number of cells that are not empty and the values within the list of arguments.
CountBlank | Counts empty cells in a specified range of cells.
CountIf | Counts the number of cells within a range that meet the given criteria.
CountIfs | Counts the number of cells within a range that meet multiple criteria.
CoupDayBs | Returns the number of days from the beginning of the coupon period to the settlement date.
CoupDays | Returns the number of days in the coupon period that contains the settlement date.
CoupDaysNc | Returns the number of days from the settlement date to the next coupon date.
CoupNcd | Returns a number that represents the next coupon date after the settlement date.
CoupNum | Returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.
CoupPcd |
Covar | Returns covariance, the average of the products of deviations for each data point pair.
Covariance_P | Returns population covariance, the average of the products of deviations for each data point pair.
Covariance_S | Returns the sample covariance, the average of the products of deviations for each data point pair in two data sets.
CritBinom | Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.
Csc | Returns the cosecant of an angle.
Csch | Returns the hyperbolic cosecant of an angle.
CumIPmt | Returns the cumulative interest paid on a loan between start_period and end_period.
CumPrinc | Returns the cumulative principal paid on a loan between start_period and end_period.
DAverage | Averages the values in a column of a list or database that match conditions you specify.
Days | Returns the number of days between the two dates.
Days360 | Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.
Db | Returns the depreciation of an asset for a specified period using the fixed-declining balance method.
Dbcs | Converts half-width (single-byte) letters within a character string to full-width (double-byte) characters. The name of the function (and the characters that it converts) depends upon the language settings. Read/write String.
DCount | Counts the cells that contain numbers in a column of a list or database that match conditions that you specify.
DCountA | Counts the nonblank cells in a column of a list or database that match conditions that you specify.
Ddb | Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.
Dec2Bin | Converts a decimal number to binary.
Dec2Hex | Converts a decimal number to hexadecimal.
Dec2Oct | Converts a decimal number to octal.
Decimal | Converts a text representation of a number in a given base into a decimal number.
Degrees | Converts radians into degrees.
Delta | Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise.
DevSq | Returns the sum of squares of deviations of data points from their sample mean.
DGet | Extracts a single value from a column of a list or database that matches conditions that you specify.
Disc | Returns the discount rate for a security.
DMax | Returns the largest number in a column of a list or database that matches conditions you that specify.
DMin | Returns the smallest number in a column of a list or database that matches conditions that you specify.
Dollar | The function described in this Help topic converts a number to text format and applies a currency symbol. The name of the function (and the symbol that it applies) depends upon your language settings.
DollarDe | Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. Use DOLLARDE to convert fractional dollar numbers, such as securities prices, to decimal numbers.
DollarFr | Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Use DOLLARFR to convert decimal numbers to fractional dollar numbers, such as securities prices.
DProduct | Multiplies the values in a column of a list or database that match conditions that you specify.
DStDev | Estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
DStDevP | Calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
DSum | Adds the numbers in a column of a list or database that match conditions that you specify.
Duration | Returns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of the cash flows and is used as a measure of a bond price's response to changes in yield.
DVar | Estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
DVarP | Calculates the variance of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
EDate | Returns the serial number that represents the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
Effect | Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year.
EncodeURL | URL encodes the argument.
EoMonth | Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
Erf | Returns the error function integrated between lower_limit and upper_limit.
Erf_Precise | Returns the error function integrated between zero and lower_limit.
ErfC | Returns the complementary ERF function integrated between the specified parameter and infinity.
ErfC_Precise | Returns the complementary error function integrated between the specified value and infinity.
Even | Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.
Expon_Dist | Returns the exponential distribution. Use EXPON_DIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPON_DIST to determine the probability that the process takes at most 1 minute.
ExponDist | Returns the exponential distribution. Use EXPONDIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPONDIST to determine the probability that the process takes at most 1 minute.
F_Dist | Returns the F probability distribution.
F_Dist_RT | Returns the right-tailed F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.
F_Inv | Returns the inverse of the F probability distribution.
F_Inv_RT | Returns the inverse of the right-tailed F probability distribution. If p = F_DIST_RT(x,...), then F_INV_RT(p,...) = x.
F_Test | Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.
Fact | Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.
FactDouble | Returns the double factorial of a number.
FDist | Returns the F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.
FilterXML | Get specific data from the returned XML, typically from a WebService function call.
Find | Finds specific information in a worksheet.
FindB | FIND and FINDB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
FInv | Returns the inverse of the F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x.
Fisher | Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient.
FisherInv | Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x.
Fixed | Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.
Floor | Rounds number down, toward zero, to the nearest multiple of significance.
Floor_Math | Rounds a number down, to the nearest integer or to the nearest multiple of significance.
Floor_Precise | Rounds the specified number to the nearest multiple of significance.
Forecast | Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. You can use this function to predict future sales, inventory requirements, or consumer trends.
Frequency | Calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula.
FTest | Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.
Fv | Returns the future value of an investment based on periodic, constant payments and a constant interest rate.
FVSchedule | Returns the future value of an initial principal after applying a series of compound interest rates. Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
Gamma | Returns the Gamma function value.
Gamma_Dist | Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.
Gamma_Inv | Returns the inverse of the gamma cumulative distribution. If p = GAMMA_DIST(x,...), then GAMMA_INV(p,...) = x.
GammaDist | Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.
GammaInv | Returns the inverse of the gamma cumulative distribution. If p = GAMMADIST(x,...), then GAMMAINV(p,...) = x.
GammaLn | Returns the natural logarithm of the gamma function, Γ(x).
GammaLn_Precise | Returns the natural logarithm of the gamma function, Γ(x).
Gauss | Returns 0.5 less than the standard normal cumulative distribution.
Gcd | Returns the greatest common divisor of two or more integers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.
GeoMean | Returns the geometric mean of an array or range of positive data. For example, you can use GEOMEAN to calculate average growth rate given compound interest with variable rates.
GeStep | Returns 1 if number ≥ step; returns 0 (zero) otherwise. Use this function to filter a set of values. For example, by summing several GESTEP functions you calculate the count of values that exceed a threshold.
Growth | Calculates predicted exponential growth by using existing data. GROWTH returns the y-values for a series of new x-values that you specify by using existing x-values and y-values. You can also use the GROWTH worksheet function to fit an exponential curve to existing x-values and y-values.
HarMean | Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals.
Hex2Bin | Converts a hexadecimal number to binary.
Hex2Dec | Converts a hexadecimal number to decimal.
Hex2Oct | Converts a hexadecimal number to octal.
HLookup | Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find.
HypGeom_Dist | Returns the hypergeometric distribution. HYPGEOM_DIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOM_DIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.
HypGeomDist | Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOMDIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.
IfError | Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula.
IfNa | Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression.
ImAbs | Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.
Imaginary | Returns the imaginary coefficient of a complex number in x + yi or x + yj text format.
ImArgument | Returns the argument [image] (theta), an angle expressed in radians, such that:
ImConjugate | Returns the complex conjugate of a complex number in x + yi or x + yj text format.
ImCos | Returns the cosine of a complex number in x + yi or x + yj text format.
ImCosh | Returns the hyperbolic cosine of a complex number.
ImCot | Returns the cotangent of a complex number.
ImCsc | Returns the cosecant of a complex number.
ImCsch | Returns the hyperbolic cosecant of a complex number.
ImDiv | Returns the quotient of two complex numbers in x + yi or x + yj text format.
ImExp | Returns the exponential of a complex number in x + yi or x + yj text format.
ImLn | Returns the natural logarithm of a complex number in x + yi or x + yj text format.
ImLog10 | Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
ImLog2 | Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.
ImPower | Returns a complex number in x + yi or x + yj text format raised to a power.
ImProduct | Returns the product of 2 to 29 complex numbers in x + yi or x + yj text format.
ImReal | Returns the real coefficient of a complex number in x + yi or x + yj text format.
ImSec | Returns the hyperbolic cosecant of a complex number.
ImSech | Returns the secant of a complex number.
ImSin | Returns the sine of a complex number in x + yi or x + yj text format.
ImSinh | Returns the hyperbolic sine of a complex number.
ImSqrt | Returns the square root of a complex number in x + yi or x + yj text format.
ImSub | Returns the difference of two complex numbers in x + yi or x + yj text format.
ImSum | Returns the sum of two or more complex numbers in x + yi or x + yj text format.
ImTan | Returns the tangent of a complex number.
Index | Returns a value or the reference to a value from within a table or range. There are two forms of the INDEX function: the array form and the reference form.
Intercept | Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. The intercept point is based on a best-fit regression line plotted through the known x-values and known y-values. Use the INTERCEPT function when you want to determine the value of the dependent variable when the independent variable is 0 (zero). For example, you can use the INTERCEPT function to predict a metal's electrical resistance at 0°C when your data points were taken at room temperature and higher.
IntRate | Returns the interest rate for a fully invested security.
Ipmt | Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
Irr | Returns the internal rate of return for a series of cash flows represented by the numbers in values. These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods.
IsErr | Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value except #N/A.
IsError | Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!).
IsEven | Checks the type of value and returns TRUE or FALSE depending if the value is even.
IsFormula | Checks whether a reference is to a cell containing a formula, and returns TRUE or FALSE.
IsLogical | Checks the type of value and returns TRUE or FALSE depending if the value refers to a logical value.
IsNA | Checks the type of value and returns TRUE or FALSE depending if the value refers to the #N/A (value not available) error value.
IsNonText | Checks the type of value and returns TRUE or FALSE depending if the value refers to any item that is not text. (Note that this function returns TRUE if value refers to a blank cell.)
IsNumber | Checks the type of value and returns TRUE or FALSE depending if the value refers to a number.
ISO_Ceiling | Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance.
IsOdd | Checks the type of value and returns TRUE or FALSE depending if the value is odd.
IsoWeekNum | Returns the ISO week number of the year for a given date. .
Ispmt | Calculates the interest paid during a specific period of an investment. This function is provided for compatibility with Lotus 1-2-3.
IsText | Checks the type of value and returns TRUE or FALSE depending if the value refers to text.
Kurt | Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution.
Large | Returns the k-th largest value in a data set. You can use this function to select a value based on its relative standing. For example, you can use LARGE to return the highest, runner-up, or third-place score.
Lcm | Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.
LinEst | Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, and returns an array that describes the line. Because this function returns an array of values, it must be entered as an array formula.
Ln | Returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904).
Log | Returns the logarithm of a number to the base you specify.
Log10 | Returns the base-10 logarithm of a number.
LogEst | In regression analysis, calculates an exponential curve that fits your data and returns an array of values that describes the curve. Because this function returns an array of values, it must be entered as an array formula.
LogInv | Use the lognormal distribution to analyze logarithmically transformed data.
LogNorm_Dist | Returns the lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.
LogNorm_Inv | Returns the inverse of the lognormal cumulative distribution function. Use the lognormal distribution to analyze logarithmically transformed data.
LogNormDist | Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.
Lookup | Returns a value either from a one-row or one-column range or from an array. The LOOKUP function has two syntax forms: the vector form and the array form.
Match | Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.
Max | Returns the largest value in a set of values.
MDeterm | Returns the matrix determinant of an array.
MDuration | Returns the modified Macauley duration for a security with an assumed par value of $100.
Median | Returns the median of the given numbers. The median is the number in the middle of a set of numbers.
Min | Returns the smallest number in a set of values.
MInverse | Returns the inverse matrix for the matrix stored in an array.
MIrr | Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash.
MMult | Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2.
Mode | Returns the most frequently occurring, or repetitive, value in an array or range of data.
Mode_Mult | Returns a vertical array of the most frequently occurring, or repetitive, values in an array or range of data.
Mode_Sngl | Returns the most frequently occurring, or repetitive, value in an array or range of data.
MRound | Returns a number rounded to the desired multiple.
MultiNomial | Returns the ratio of the factorial of a sum of values to the product of factorials.
Munit | Returns the unit matrix for the specified dimension.
NegBinom_Dist | Returns the negative binomial distribution. NEGBINOM_DIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.
NegBinomDist | Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.
NetworkDays | Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.
NetworkDays_Intl | Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.
Nominal | Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year.
Norm_Dist | Returns the normal distribution for the specified mean and standard deviation. This function has a wide range of applications in statistics, including hypothesis testing.
Norm_Inv | Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
Norm_S_Dist | Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.
Norm_S_Inv | Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of 0 (zero) and a standard deviation of one.
NormDist | Returns the normal distribution for the specified mean and standard deviation. This function has a very wide range of applications in statistics, including hypothesis testing.
NormInv | Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
NormSDist | Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.
NormSInv | Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.
NPer | Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate.
Npv | Calculates the net present value of an investment by using a discount rate and a series of future payments (negative values) and income (positive values).
NumberValue | Converts text to number in a locale-independent manner.
Oct2Bin | Converts an octal number to binary.
Oct2Dec | Converts an octal number to decimal.
Oct2Hex | Converts an octal number to hexadecimal.
Odd | Returns number rounded up to the nearest odd integer.
OddFPrice | Returns the price per $100 face value of a security having an odd (short or long) first period.
OddFYield | Returns the yield of a security that has an odd (short or long) first period.
OddLPrice | Returns the price per $100 face value of a security having an odd (short or long) last coupon period.
OddLYield | Returns the yield of a security that has an odd (short or long) last period.
Or | Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
PDuration | Returns the number of periods required by an investment to reach a specified value.
Pearson | Returns the Pearson product moment correlation coefficient, r, a dimensionless index that ranges from -1.0 to 1.0 inclusive and reflects the extent of a linear relationship between two data sets.
Percentile | Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile.
Percentile_Exc | Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive.
Percentile_Inc | Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can examine candidates who score above the 90th percentile.
PercentRank | Returns the rank of a value in a data set as a percentage of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK to evaluate the standing of an aptitude test score among all scores for the test.
PercentRank_Exc | Returns the rank of a value in a data set as a percentage (0..1, exclusive) of the data set.
PercentRank_Inc | Returns the rank of a value in a data set as a percentage (0..1, inclusive) of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK_INC to evaluate the standing of an aptitude test score among all scores for the test.
Permut | Returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations.
Permutationa | Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects.
Phi | Returns the value of the density function for a standard normal distribution.
Phonetic | Extracts the phonetic (furigana) characters from a text string.
Pi | Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15 digits.
Pmt | Calculates the payment for a loan based on constant payments and a constant interest rate.
Poisson | Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute.
Poisson_Dist | Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in one minute.
Power | Returns the result of a number raised to a power.
Ppmt | Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
Price | Returns the price per $100 face value of a security that pays periodic interest.
PriceDisc | Returns the price per $100 face value of a discounted security.
PriceMat | Returns the price per $100 face value of a security that pays interest at maturity.
Prob | Returns the probability that values in a range are between two limits. If upper_limit is not supplied, returns the probability that values in x_range are equal to lower_limit.
Product | Multiplies all the numbers given as arguments and returns the product.
Proper | Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters.
Pv | Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now. For example, when you borrow money, the loan amount is the present value to the lender.
Quartile | Returns the quartile of a data set. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE to find the top 25 percent of incomes in a population.
Quartile_Exc | Returns the quartile of the data set, based on percentile values from 0..1, exclusive.
Quartile_Inc | Returns the quartile of a data set based on percentile values from 0..1, inclusive. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE_INC to find the top 25 percent of incomes in a population.
Quotient | Returns the integer portion of a division. Use this function when you want to discard the remainder of a division.
Radians | Converts degrees to radians.
RandBetween | Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.
Rank | Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)
Rank_Avg | Returns the rank of a number in a list of numbers; that is its size relative to other values in the list. If more than one value has the same rank, the average rank is returned.
Rank_Eq | Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)
Rate | Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value.
Received | Returns the amount received at maturity for a fully invested security.
Replace | Replaces part of a text string, based on the number of characters you specify, with a different text string.
ReplaceB | REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string.
Rept | Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.
Roman | Converts an arabic numeral to roman, as text.
Round | Rounds a number to a specified number of digits.
RoundDown | Rounds a number down, toward zero.
RoundUp | Rounds a number up, away from 0 (zero).
Rri | Returns an equivalent interest rate for the growth of an investment.
RSq | Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. For more information, see PEARSON. The r-squared value can be interpreted as the proportion of the variance in y attributable to the variance in x.
RTD | This method connects to a source to receive real-time data.
Search | SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
SearchB | SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
Sec | Returns the secant of an angle.
Sech | Returns the hyperbolic secant of an angle.
SeriesSum | Returns the sum of a power series based on the formula:
Sinh | Returns the hyperbolic sine of a number.
Skew | Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.
Skew_p | Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean.
Sln | Returns the straight-line depreciation of an asset for one period.
Slope | Returns the slope of the linear regression line through data points in known_y's and known_x's. The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line.
Small | Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set.
SqrtPi | Returns the square root of (number * pi).
Standardize | Returns a normalized value from a distribution characterized by mean and standard_dev.
StDev | Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDev_P | Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDev_S | Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StDevP | Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
StEyx | Returns the standard error of the predicted y-value for each x in the regression. The standard error is a measure of the amount of error in the prediction of y for an individual x.
Substitute | Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.
Subtotal | Creates subtotals.
Sum | Adds all the numbers in a range of cells.
SumIf | Adds the cells specified by a given criteria.
SumIfs | Adds the cells in a range that meet multiple criteria.
SumProduct | Multiplies corresponding components in the given arrays, and returns the sum of those products.
SumSq | Returns the sum of the squares of the arguments.
SumX2MY2 | Returns the sum of the difference of squares of corresponding values in two arrays.
SumX2PY2 | Returns the sum of the sum of squares of corresponding values in two arrays. The sum of the sum of squares is a common term in many statistical calculations.
SumXMY2 | Returns the sum of squares of differences of corresponding values in two arrays.
Syd | Returns the sum-of-years' digits depreciation of an asset for a specified period.
T_Dist | Returns a Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are computed.
T_Dist_2T | Returns the two-tailed Student t-distribution.
T_Dist_RT | Returns the right-tailed Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.
T_Inv | Returns the left-tailed inverse of the Student t-distribution.
T_Inv_2T | Returns the t-value of the Student t-distribution as a function of the probability and the degrees of freedom.
T_Test | Returns the probability associated with a Student t-Test. Use T_TEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.
Tanh | Returns the hyperbolic tangent of a number.
TBillEq | Returns the bond-equivalent yield for a Treasury bill.
TBillPrice | Returns the price per $100 face value for a Treasury bill.
TBillYield | Returns the yield for a Treasury bill.
TDist | Returns the Percentage Points (probability) for the Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.
Text | Converts a value to text in a specific number format.
TInv | Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom.
Transpose | Returns a vertical range of cells as a horizontal range, or vice versa. TRANSPOSE must be entered as an array formula in a range that has the same number of rows and columns, respectively, as an array has columns and rows. Use TRANSPOSE to shift the vertical and horizontal orientation of an array on a worksheet.
Trend | Returns values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known_y's and known_x's. Returns the y-values along that line for the array of new_x's that you specify.
Trim | Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing.
TrimMean | Returns the mean of the interior of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set. You can use this function when you wish to exclude outlying data from your analysis.
TTest | Returns the probability associated with a Student's t-Test. Use TTEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.
Unichar | Returns the Unicode character referenced by the given numeric value.
Unicode | Returns the number (code point) corresponding to the first character of the text.
USDollar | Converts a number to text format and applies a currency symbol. The name of the method (and the symbol that it applies) depends upon the language settings.
Var | Estimates variance based on a sample.
Var_P | Calculates variance based on the entire population.
Var_S | Estimates variance based on a sample.
VarP | Calculates variance based on the entire population.
Vdb | Returns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify. VDB stands for variable declining balance.
VLookup | Searches for a value in the first column of a table array and returns a value in the same row from another column in the table array.
WebService | Underlying function that calls the web service asynchronously, using an HTTP GET request, and returns the response.
Weekday | Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.
WeekNum | Returns a number that indicates where the week falls numerically within a year.
Weibull | Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.
Weibull_Dist | Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating the mean time to failure for a device.
WorkDay | Returns a number that represents a date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.
WorkDay_Intl | Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters. Weekend parameters indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.
Xirr | Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the IRR function.
Xnpv | Returns the net present value for a schedule of cash flows that is not necessarily periodic. Read/write Double.
Xor | Returns a logical exclusive OR of all arguments.
YearFrac | Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term.
YieldDisc | Returns the annual yield for a discounted security.
YieldMat | Returns the annual yield of a security that pays interest at maturity.
Z_Test | Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, Z_TEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.
ZTest | Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, ZTEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.


WorksheetFunction.AccrInt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AccrInt Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the accrued interest for a security that pays periodic interest.

Syntax

expression .AccrInt(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Issue date - Security's issue date.
Arg2 | Required | Variant | First interest - Security's first interest date.
Arg3 | Required | Variant | Settlement - Security's settlement date
Arg4 | Required | Variant | Rate - Security's annual coupon rate.
Arg5 | Required | Variant | Par - Security's par value.
Arg6 | Required | Variant | Frequency - Number of coupon payments per year.
Arg7 | Optional | Variant | Basis - The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table describes the values that can be used for Arg5.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AccrIntM Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AccrIntM Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the accrued interest for a security that pays interest at maturity.

Syntax

expression .AccrIntM(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's issue date.
Arg2 | Required | Variant | The security's maturity date.
Arg3 | Required | Variant | The security's annual coupon rate.
Arg4 | Required | Variant | The security's par value. If you omit par, ACCRINTM uses $1,000.
Arg5 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table describes the values that can be used for Arg5.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • Issue, maturity, and basis are truncated to integers.

  • If issue or maturity is not a valid date, ACCRINTM will generate an error.

  • If rate ≤ 0 or if par ≤ 0, ACCRINTM will generate an error.

  • If basis < 0 or if basis > 4, ACCRINTM will generate an error.

  • If issue ≥ maturity, ACCRINTM will generate an error.

  • ACCRINTM is calculated as follows: where: A = Number of accrued days counted according to a monthly basis. For interest at maturity items, the number of days from the issue date to the maturity date is used. D = Annual Year Basis.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Acos Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Acos Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the arccosine, or inverse cosine, of a number. The arccosine is the angle whose cosine is Arg1. The returned angle is given in radians in the range 0 (zero) to pi.

Syntax

expression .Acos(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The cosine of the angle you want and must be from -1 to 1.

Return Value

Double

Remarks

If you want to convert the result from radians to degrees, multiply it by 180/PI() or use the Degrees method.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Acosh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Acosh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse hyperbolic cosine of a number. Number must be greater than or equal to 1. The inverse hyperbolic cosine is the value whose hyperbolic cosine is Arg1, so Acosh(Cosh(number)) equals Arg1.

Syntax

expression .Acosh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Any real number equal to or greater than 1.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Acot Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Acot Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the arccotangent of a number, in radians in the range 0 to Pi.

Version information

Version Added: Excel 2013

Syntax

expression .Acot(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The cotangent of the angle you want.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Acoth Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Acoth Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse hyperbolic cotangent of a number.

Version information

Version Added: Excel 2013

Syntax

expression .Acoth(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The hyperbolic cotangent of the angle that you want.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Aggregate Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Aggregate Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an aggregate in a list or database.

Version Information

Version Added: Excel 2010

Syntax

expression .Aggregate(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Double

Function_num - A number from 1 to 19 that specifies which function to use.

Function_num | Function
1 | AVERAGE
2 | COUNT
3 | COUNTA
4 | MAX
5 | MIN
6 | PRODUCT
7 | STDEV.S
8 | STDEV.P
9 | SUM
10 | VAR.S
11 | VAR.P
12 | MEDIAN
13 | MODE.SNGL
14 | LARGE
15 | SMALL
16 | PERCENTILE.INC
17 | QUARTILE.INC
18 | PERCENTILE.EXC
19 | QUARTILE.EXC

Arg2

Required

Double

Options - A numerical value that determines which values to ignore in the evaluation range for the function.

Option | Behavior
0 or omitted | Ignore nested SUBTOTAL and AGGREGATE functions
1 | Ignore hidden rows, nested SUBTOTAL and AGGREGATE functions
2 | Ignore error values, nested SUBTOTAL and AGGREGATE functions
3 | Ignore hidden rows, error values, nested SUBTOTAL and AGGREGATE functions
4 | Ignore nothing
5 | Ignore hidden rows
6 | Ignore error values
7 | Ignore hidden rows and error values

Arg3

Required

Range

Ref1 - The first numeric argument for functions that take multiple numeric arguments for which you want the aggregate value.

Arg4 - Arg 30

Optional

Variant

Ref2 - Ref30 - Numeric arguments 2 to 30 for which you want the aggregate value.

Return Value

Double

Remarks

  • The following constraints apply to the Ref arguments (Arg3 - Arg 30) based on the Function_num value.

    Function_num

    Ref1

    Ref2

    Ref3, Ref4, …

    1-13

    Valid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    Invalid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    • Actual data

    • Arrays

    Invalid types:

    • Actual data

    • Arrays

    Valid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    Invalid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    • Actual data

    • Arrays

    Invalid types:

    • Actual data

    • Arrays

    Valid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    Invalid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    • Actual data

    • Arrays

    Invalid types:

    • Actual data

    • Arrays

    14-17

    Valid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    • Actual data

    • Arrays

    Valid types:

    • Any cell reference

    • Unions

    • Intersections

    • Defined names

    • Structured references

    • Actual data

    • Arrays

    No references are allowed

  • If a second ref argument is required but not provided, AGGREGATE returns a #VALUE! error.

  • If one or more of the references are 3-D references, AGGREGATE returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AmorDegrc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AmorDegrc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the depreciation for each accounting period. This function is provided for the French accounting system.

Syntax

expression .AmorDegrc(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The cost of the asset.
Arg2 | Required | Variant | The date of the purchase of the asset.
Arg3 | Required | Variant | The date of the end of the first period.
Arg4 | Required | Variant | The salvage value at the end of the life of the asset.
Arg5 | Required | Variant | The period.
Arg6 | Required | Variant | The rate of depreciation.
Arg7 | Optional | Variant | The year basis to be used.

Return Value

Double

Remarks

If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account. The method is similar to AmorLinc, except that a depreciation coefficient is applied in the calculation depending on the life of the assets.

The following table describes the values used in Arg7.

Basis | Date system
0 or omitted | 360 days (NASD method)
1 | Actual
3 | 365 days in a year
4 | 360 days in a year (European method)

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • This function will return the depreciation until the last period of the life of the assets or until the cumulated value of depreciation is greater than the cost of the assets minus the salvage value.

  • The depreciation coefficients are:

    Life of assets (1/rate)

    Depreciation coefficient

    Between 3 and 4 years

    1.5

    Between 5 and 6 years

    2

    More than 6 years

    2.5

  • The depreciation rate will grow to 50 percent for the period preceding the last period and will grow to 100 percent for the last period.

  • If the life of assets is between 0 (zero) and 1, 1 and 2, 2 and 3, or 4 and 5, the #NUM! error value is returned.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AmorLinc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AmorLinc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the depreciation for each accounting period. This function is provided for the French accounting system.

Syntax

expression .AmorLinc(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The cost of the asset.
Arg2 | Required | Variant | The date of the purchase of the asset.
Arg3 | Required | Variant | The date of the end of the first period.
Arg4 | Required | Variant | The salvage value at the end of the life of the asset.
Arg5 | Required | Variant | The period.
Arg6 | Required | Variant | The rate of depreciation.
Arg7 | Optional | Variant | The year basis to be used.

Return Value

Double

Remarks

If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account.

The following table describes values used for Arg7.

Basis | Date system
0 or omitted | 360 days (NASD method)
1 | Actual
3 | 365 days in a year
4 | 360 days in a year (European method)
Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Note Note

Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.And Method (Excel)

 Copy code hover
[image]

WorksheetFunction.And Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.

Syntax

expression .And(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | 1 to 30 conditions you want to test that can be either TRUE or FALSE.

Return Value

Boolean

Remarks

  • The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays or references that contain logical values.

  • If an array or reference argument contains text or empty cells, those values are ignored.

  • If the specified range contains no logical values, this method generates an error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Arabic Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Arabic Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a Roman numeral to an Arabic numeral.

Version information

Version Added: Excel 2013

Syntax

expression .Arabic(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | The Roman numeral you want to convert.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Asc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Asc Method (Excel)
See also Send feedback

Published: July 16, 2012

For Double-byte character set (DBCS) languages, changes full-width (double-byte) characters to half-width (single-byte) characters.

Syntax

expression .Asc(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | The text or a reference to a cell that contains the text you want to change. If text does not contain any full-width letters, text is not changed.

Return Value

String

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Asin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Asin Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the arcsine, or inverse sine, of a number. The arcsine is the angle whose sine is Arg1. The returned angle is given in radians in the range -pi/2 to pi/2.

Syntax

expression .Asin(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The sine of the angle you want and must be from -1 to 1.

Return Value

Double

Remarks

To express the arcsine in degrees, multiply the result by 180/PI( ) or use the Degrees method.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Asinh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Asinh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse hyperbolic sine of a number. The inverse hyperbolic sine is the value whose hyperbolic sine is Arg1, so Asinh(Sinh(number)) equals Arg1.

Syntax

expression .Asinh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Any real number.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Atan2 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Atan2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, excluding -pi.

Syntax

expression .Atan2(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The x-coordinate of the point.
Arg2 | Required | Double | The y-coordinate of the point.

Return Value

Double

Remarks

  • A positive result represents a counterclockwise angle from the x-axis; a negative result represents a clockwise angle.

  • The following conditions apply:

    • Where x > 0 ATAN2(x,y) = ATAN(y/x)

    • Where y >= 0, x < 0 ATAN2(x,y) = ATAN(y/x)+PI()

    • Where y < 0, x < 0 ATAN2(x,y) = ATAN(y/x) - PI()

    • Where y > 0, x = 0 ATAN2(x,y) = PI()/2

    • Where y < 0, x = 0 ATAN2(x,y) = -PI()/2

    • If both x and y are 0, Atan2 returns an error value.

  • To express the arctangent in degrees, multiply the result by 180/PI( ) or use the Degrees method.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Atanh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Atanh Method (Excel)
See also Send feedback

Returns the inverse hyperbolic tangent of a number. Number must be between -1 and 1 (excluding -1 and 1).

Syntax

expression .Atanh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Any real number between 1 and -1.

Return Value

Double

Remarks

The inverse hyperbolic tangent is the value whose hyperbolic tangent is Arg1, so Atanh(Tanh(number)) equals Arg1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AveDev Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AveDev Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the average of the absolute deviations of data points from their mean. AveDev is a measure of the variability in a data set.

Syntax

expression .AveDev(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg 30 | Required | Variant | 1 to 30 arguments for which you want the average of the absolute deviations. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • AveDev is influenced by the unit of measurement in the input data.

  • Arguments must either be numbers or be names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • The equation for average deviation is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Average Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Average Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the average (arithmetic mean) of the arguments.

Syntax

expression .Average(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | 1 to 30 numeric arguments for which you want the average.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If you want to include logical values and text representations of numbers in a reference as part of the calculation, use the AVERAGEA function.

Note Note

The Average method measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

Tip When averaging cells, keep in mind the difference between empty cells and those containing the value zero, especially if you have cleared the Zero values check box on the View tab (Options command, Tools menu). Empty cells are not counted, but zero values are.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AverageIf Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AverageIf Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria.

Syntax

expression .AverageIf(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | One or more cells to average.
Arg2 | Required | Variant | The criteria in the form of a number, expression, cell reference, or text that defines which cells are averaged. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.
Arg3 | Optional | Variant | The actual set of cells to average. If omitted, range is used.

Return Value

Double

Remarks

  • Cells in range that contain TRUE or FALSE are ignored.

  • If a cell in range or average_range is an empty cell, AverageIf ignores it.

  • If a cell in criteria is empty, AverageIf treats it as a 0 value.

  • If no cells in the range meet the criteria, AverageIf generates an error value.

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • Average_range does not have to be the same size and shape as range. The actual cells that are averaged are determined by using the top, left cell in average_range as the beginning cell, and then including cells that correspond in size and shape to range. For example:

    If range is

    And average_range is

    Then the actual cells evaluated are

    A1:A5

    B1:B5

    B1:B5

    A1:A5

    B1:B3

    B1:B5

    A1:B4

    C1:D4

    C1:D4

    A1:B4

    C1:C2

    C1:D4

Note Note

The AverageIf method measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.AverageIfs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.AverageIfs Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the average (arithmetic mean) of all cells that meet multiple criteria.

Syntax

expression .AverageIfs(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Range | One or more ranges in which to evaluate the associated criteria.

Return Value

Double

Remarks

  • If a cell in average_range is an empty cell, AverageIfs ignores it.

  • If a cell in a criteria range is empty, AverageIfs treats it as a 0 value.

  • Cells in range that contain TRUE evaluate as 1; cells in range that contain FALSE evaluate as 0 (zero).

  • Each cell in average_range is used in the average calculation only if all of the corresponding criteria specified are true for that cell.

  • If cells in average_range are empty or contain text values that cannot be translated into numbers, AverageIfs generates an error.

  • If there are no cells that meet all the criteria, AverageIfs generates an error value.

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • Each criteria_range does not have to be the same size and shape as average_range. The actual cells that are averaged are determined by using the top, left cell in that criteria_range as the beginning cell, and then including cells that correspond in size and shape to range. For example:

    If average_range is

    And the criteria_range is

    Then the actual cells evaluated are

    A1:A5

    B1:B5

    B1:B5

    A1:A5

    B1:B3

    B1:B5

    A1:B4

    C1:D4

    C1:D4

    A1:B4

    C1:C2

    C1:D4

Note Note

The AverageIfs function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BahtText Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BahtText Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a number to Thai text and adds a suffix of "Baht."

Syntax

expression .BahtText(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A number you want to convert to text, or a reference to a cell containing a number, or a formula that evaluates to a number.

Return Value

String

Remarks

In Microsoft Excel for Windows, you can change the Baht format to a different style by using Regional Settings or Regional Options in Control Panel.

In Excel for the Macintosh, you can change the Baht number format to a different style by using Control Panel for Numbers.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Base Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Base Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a number into a text representation with the given radix (base).

Version information

Version Added: Excel 2013

Syntax

expression .Base(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The number that you want to convert.
Arg2 | Required | DOUBLE | The base Radix that you want to convert the number into.
Arg3 | Optional | VARIANT | The minimum length of the returned string. If omitted leading zeros are not added.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BesselI Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BesselI Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments.

Syntax

expression .BesselI(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The value at which to evaluate the function.
Arg2 | Required | Variant | The order of the Bessel function. If n is not an integer, it is truncated.

Return Value

Double

Remarks

  • If x is nonnumeric, BesselI returns the #VALUE! error value.

  • If n is nonnumeric, BesselI generates an error value.

  • If n < 0, BesselI generates an error value.

  • The n-th order modified Bessel function of the variable x is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BesselJ Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BesselJ Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Bessel function.

Syntax

expression .BesselJ(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The value at which to evaluate the function.
Arg2 | Required | Variant | The order of the Bessel function. If n is not an integer, it is truncated.

Return Value

Double

Remarks

  • If x is nonnumeric, BesselJ generates an error value.

  • If n is nonnumeric, BesselJ returns the generates an error value.

  • If n < 0, BesselJ generates an error value.

  • The n-th order Bessel function of the variable x is: where: is the Gamma function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BesselK Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BesselK Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments.

Syntax

expression .BesselK(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | the value at which to evaluate the function.
Arg2 | Required | Variant | the order of the function. If n is not an integer, it is truncated.

Return Value

Double

Remarks

  • If x is nonnumeric, BesselK generates an error value.

  • If n is nonnumeric, BesselK generates an error value.

  • If n < 0, BesselK generates an error value.

  • The n-th order modified Bessel function of the variable x is: where Jn and Yn are the J and Y Bessel functions, respectively.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BesselY Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BesselY Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Bessel function, which is also called the Weber function or the Neumann function.

Syntax

expression .BesselY(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The value at which to evaluate the function.
Arg2 | Required | Variant | The order of the function. If n is not an integer, it is truncated.

Return Value

Double

Remarks

  • If x is nonnumeric, BesselY generates an error value.

  • If n is nonnumeric, BesselY generates an error value.

  • If n < 0, BesselY generates an error value.

  • The n-th order Bessel function of the variable x is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Beta_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Beta_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the beta cumulative distribution function.

Version Information

Version Added: Excel 2010

Syntax

expression .Beta_Dist(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The value between A and B at which to evaluate the function.
Arg2 | Required | Double | The Alpha parameter of the distribution.
Arg3 | Required | Double | The Beta parameter of the distribution.
Arg4 | Optional | Variant | Cumulative - a logical value that determines the form of the function. If cumulative is TRUE, BETA.DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.
Arg5 | Optional | Variant | An optional lower bound to the interval of x.
Arg6 | Optional | Variant | An optional upper bound to the interval of x.

Return Value

Double

Remarks

The beta distribution is commonly used to study variation in the percentage of something across samples, such as the fraction of the day people spend watching television:

  • If any argument is nonnumeric, Beta_Dist returns the #VALUE! error value.

  • If alpha ≤ 0 or beta ≤ 0, Beta_Dist generates an error value.

  • If x < A, x > B, or A = B, Beta_Dist generates an error value.

  • If you omit values for A and B (lower and upper bound), Beta_Dist uses the standard cumulative beta distribution, so that A = 0 and B = 1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Beta_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Beta_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = Beta_Dist(x,...), then Beta_Inv(probability,...) = x.

Version Information

Version Added: Excel 2010

Syntax

expression .Beta_Inv(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A probability associated with the beta distribution.
Arg2 | Required | Double | The Alpha parameter of the distribution.
Arg3 | Required | Double | The Beta parameter the distribution.
Arg4 | Optional | Variant | An optional lower bound to the interval of x.
Arg5 | Optional | Variant | An optional upper bound to the interval of x.

Return Value

Double

Remarks

The beta distribution can be used in project planning to model probable completion times given an expected completion time and variability:

  • If any argument is nonnumeric, Beta_Inv generates an error value.

  • If alpha ≤ 0 or beta ≤ 0, Beta_Inv generates an error value.

  • If probability ≤ 0 or probability > 1, Beta_Inv generates an error value.

  • If you omit values for A and B (lower and upper bound), Beta_Inv uses the standard cumulative beta distribution, so that A = 0 and B = 1.

Given a value for probability, Beta_Inv seeks that value x such that Beta_Dist(x, alpha, beta, TRUE, A, B) = probability. Thus, precision of Beta_Inv depends on precision of Beta_Dist. Beta_Inv uses an iterative search technique.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BetaDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BetaDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the beta cumulative distribution function.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Beta_Dist method.

Syntax

expression .BetaDist(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The value between A and B at which to evaluate the function.
Arg2 | Required | Double | A parameter of the distribution.
Arg3 | Required | Double | A parameter of the distribution.
Arg4 | Optional | Variant | An optional lower bound to the interval of x.
Arg5 | Optional | Variant | An optional upper bound to the interval of x.

Return Value

Double

Remarks

The beta distribution is commonly used to study variation in the percentage of something across samples, such as the fraction of the day people spend watching television.

  • If any argument is nonnumeric, BetaDist returns the #VALUE! error value.

  • If alpha ≤ 0 or beta ≤ 0, BetaDist generates an error value.

  • If x < A, x > B, or A = B, BetaDist generates an error value.

  • If you omit values for A and B, BetaDist uses the standard cumulative beta distribution, so that A = 0 and B = 1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BetaInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BetaInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = BetaDist(x,...), then BetaInv(probability,...) = x.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Beta_Inv method.

Syntax

expression .BetaInv(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A probability associated with the beta distribution.
Arg2 | Required | Double | The Alpha parameter of the distribution.
Arg3 | Required | Double | The Beta parameter the distribution.
Arg4 | Optional | Variant | An optional lower bound to the interval of x.
Arg5 | Optional | Variant | An optional upper bound to the interval of x.

Return Value

Double

Remarks

The beta distribution can be used in project planning to model probable completion times given an expected completion time and variability.

  • If any argument is nonnumeric, BetaInv generates an error value.

  • If alpha ≤ 0 or beta ≤ 0, BetaInv generates an error value.

  • If probability ≤ 0 or probability > 1, BetaInv generates an error value.

  • If you omit values for A and B, BetaInv uses the standard cumulative beta distribution, so that A = 0 and B = 1.

Given a value for probability, BetaInv seeks that value x such that BetaDist(x, alpha, beta, A, B) = probability. Thus, precision of BetaInv depends on precision of BetaDist. BetaInv uses an iterative search technique. If the search has not converged after 100 iterations, the function generates an error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bin2Dec Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bin2Dec Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a binary number to decimal.

Syntax

expression .Bin2Dec(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The binary number you want to convert. Number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation.

Return Value

String

Remarks

If number is not a valid binary number, or if number contains more than 10 characters (10 bits), Bin2Dec generates an error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bin2Hex Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bin2Hex Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a binary number to hexadecimal.

Syntax

expression .Bin2Hex(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The binary number you want to convert. Number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | The number of characters to use. If places is omitted, Bin2Hex uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is not a valid binary number, or if number contains more than 10 characters (10 bits), Bin2Hex generates an error.

  • If number is negative, Bin2Hex ignores places and returns a 10-character hexadecimal number.

  • If Bin2Hex requires more than places characters, it generates an error.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, Bin2Hex generates an error.

  • If places is negative, Bin2Hex generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bin2Oct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bin2Oct Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a binary number to octal.

Syntax

expression .Bin2Oct(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The binary number you want to convert. Number cannot contain more than 10 characters (10 bits). The most significant bit of number is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | The number of characters to use. If places is omitted, Bin2Oct uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is not a valid binary number, or if number contains more than 10 characters (10 bits), Bin2Oct generates an error.

  • If number is negative, Bin2Oct ignores places and returns a 10-character octal number.

  • If Bin2Oct requires more than places characters, it generates an error.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, Bin2Oct generates an error.

  • If places is negative, Bin2Oct generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Binom_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Binom_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the individual term binomial distribution probability.

Version Information

Version Added: Excel 2010

Syntax

expression .Binom_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number_s - the number of successes in trials.
Arg2 | Required | Double | Trials - the number of independent trials.
Arg3 | Required | Double | Probability_s - the probability of success on each trial.
Arg4 | Required | Boolean | Cumulative - a logical value that determines the form of the function. If cumulative is True, then the Binom_Dist method returns the cumulative distribution function, which is the probability that there are at most number_s successes; if False, it returns the probability mass function, which is the probability that there are number_s successes.

Return Value

Double

Remarks

Use the Binom_Dist method in problems with a fixed number of tests or trials, when the outcomes of any trial are only success or failure, when trials are independent, and when the probability of success is constant throughout the experiment. For example, the Binom_Dist method can calculate the probability that two of the next three babies born are male.

  • Number_s and trials are truncated to integers.

  • If number_s, trials, or probability_s is nonnumeric, the Binom_Dist method generates an error.

  • If number_s < 0 or number_s > trials, the Binom_Dist method generates an error.

  • If probability_s < 0 or probability_s > 1, the Binom_Dist method generates an error.

  • The binomial probability mass function is: where: is COMBIN(n,x). The cumulative binomial distribution is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Binom_Dist_Range Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Binom_Dist_Range Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the probability of a trial result using a binomial distribution.

Version information

Version Added: Excel 2013

Syntax

expression .Binom_Dist_Range(Arg1,Arg2,Arg3,Arg4)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The number of independent trials.
Arg2 | Required | DOUBLE | The probability of success on each trial.
Arg3 | Required | DOUBLE | The number of successes in trials.
Arg4 | Optional | VARIANT | If provided, this function returns the probability that the number of successful trials shall lie between Arg3 and Arg4.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Binom_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Binom_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the individual term binomial distribution probability.

Version Information

Version Added: Excel 2010

Syntax

expression .Binom_Inv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Trials - the number of Bernoulli trials.
Arg2 | Required | Double | Probability_s - the probability of a success on each trial.
Arg3 | Required | Double | Alpha - the criterion value.

Return Value

Double

Remarks

  • If Trials, Probability_s, or Alpha is nonnumeric, the Binom_Inv method generates an error.

  • If Trials is not an integer, it is truncated.

  • If Trials < 0, the Binom_Inv method generates an error.

  • If Probability_s < 0 or Probability_s > 1, the Binom_Inv method generates an error.

  • If Alpha < 0 or Alpha > 1, the Binom_Inv method generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.BinomDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.BinomDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the individual term binomial distribution probability.

Syntax

expression .BinomDist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | the number of successes in trials.
Arg2 | Required | Double | the number of independent trials.
Arg3 | Required | Double | the probability of success on each trial.
Arg4 | Required | Boolean | a logical value that determines the form of the function. If cumulative is TRUE, then BinomDist returns the cumulative distribution function, which is the probability that there are at most number_s successes; if FALSE, it returns the probability mass function, which is the probability that there are number_s successes.

Return Value

Double

Remarks

Use BinomDist in problems with a fixed number of tests or trials, when the outcomes of any trial are only success or failure, when trials are independent, and when the probability of success is constant throughout the experiment. For example, BinomDist can calculate the probability that two of the next three babies born are male.

  • Number_s and trials are truncated to integers.

  • If number_s, trials, or probability_s is nonnumeric, BINOMDIST generates an error.

  • If number_s < 0 or number_s > trials, BinomDist generates an error.

  • If probability_s < 0 or probability_s > 1, BinomDist generates an error.

  • The binomial probability mass function is: where: is COMBIN(n,x). The cumulative binomial distribution is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bitand Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bitand Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 'Bitwise And' of two numbers

Version information

Version Added: Excel 2013

Syntax

expression .Bitand(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.
Arg2 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bitlshift Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bitlshift Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value number shifted left by shift_amount bits.

Version information

Version Added: Excel 2013

Syntax

expression .Bitlshift(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.
Arg2 | Required | DOUBLE | The number of bits that you want to shift Arg1 left by.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bitor Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bitor Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a bitwise OR of 2 numbers.

Version information

Version Added: Excel 2013

Syntax

expression .Bitor(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.
Arg2 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bitrshift Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bitrshift Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value number shifted right by shift_amount bits.

Version information

Version Added: Excel 2013

Syntax

expression .Bitrshift(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.
Arg2 | Required | DOUBLE | The number of bits that you want to shift Arg1 right by.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Bitxor Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Bitxor Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a bitwise 'Exclusive Or' of two numbers.

Version information

Version Added: Excel 2013

Syntax

expression .Bitxor(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.
Arg2 | Required | DOUBLE | The decimal representation of the binary number you want to evaluate.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ceiling Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ceiling Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns number rounded up, away from zero, to the nearest multiple of significance.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Ceiling_Precise method.

Syntax

expression .Ceiling(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the value you want to round.
Arg2 | Required | Double | Significance - the multiple to which you want to round.

Return Value

Double

Remarks

For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula Ceiling(4.42,0.05) to round prices up to the nearest nickel.

  • If either argument is nonnumeric, Ceiling generates an error.

  • Regardless of the sign of number, a value is rounded up when adjusted away from zero. If number is an exact multiple of significance, no rounding occurs.

  • If number and significance have different signs, Ceiling generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ceiling_Math Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ceiling_Math Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number up, to the nearest integer or to the nearest multiple of significance.

Version information

Version Added: Excel 2013

Syntax

expression .Ceiling_Math(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The value you want to round.
Arg2 | Optional | VARIANT | The multiple to which you want to round.
Arg3 | Optional | VARIANT | When given and nonzero, this function will round away from zero.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ceiling_Precise Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ceiling_Precise Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the specified number rounded to the nearest multiple of significance.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Ceiling_Precise method.

Version Information

Version Added: Excel 2010

Syntax

expression .Ceiling_Precise(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the value you want to round.
Arg2 | Optional | Variant | Significance - the multiple to which you want to round.

Return Value

Double

Remarks

For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula Ceiling(4.42,0.05) to round prices up to the nearest nickel.

Depending on the sign of the number and significance arguments, the Ceiling_Precise method rounds either away from or towards zero.

Sign (Arg1/Arg2) | Rounding
-/- | Rounds toward zero.
+/+ | Rounds away from zero.
-/+ | Rounds toward zero.
+/- | Rounds away from zero.

  • If either argument is nonnumeric, Ceiling_Precise generates an error.

  • If number is an exact multiple of significance, no rounding occurs.

Note Note

The CEILING.PRECISE algorithm is the same as the one used for the ISO.CEILING function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the one-tailed probability of the chi-squared distribution.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the ChiSq_Dist_RT and ChiSq_Dist methods.

Syntax

expression .ChiDist(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The value at which you want to evaluate the distribution.
Arg2 | Required | Double | The number of degrees of freedom.

Return Value

Double

Remarks

The χ 2 distribution is associated with a χ 2 test. Use the χ 2 test to compare observed and expected values.

For example, a genetic experiment might hypothesize that the next generation of plants will exhibit a certain set of colors. By comparing the observed results with the expected ones, you can decide whether your original hypothesis is valid.

  • If either argument is nonnumeric, ChiDist generates an error.

  • If x is negative, ChiDist generates an error.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1 or degrees_freedom > 10^10, ChiDist generates an error.

  • ChiDist is calculated as ChiDist = P(X>x), where X is a χ2 random variable.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the one-tailed probability of the chi-squared distribution.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the ChiSq_Inv_RT and ChiSq_Inv methods.

Syntax

expression .ChiInv(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A probability associated with the chi-squared distribution.
Arg2 | Required | Double | The number of degrees of freedom.

Return Value

Double

Remarks

If probability = ChiDist(x,...), then ChiInv(probability,...) = x. Use this function to compare observed results with expected ones in order to decide whether your original hypothesis is valid.

  • If either argument is nonnumeric, ChiInv generates an error.

  • If probability < 0 or probability > 1, ChiInv generates an error.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1 or degrees_freedom ≥ 10^10, ChiInv generates an error.

Given a value for probability, ChiInv seeks that value x such that ChiDist(x, degrees_freedom) = probability. Thus, precision of ChiInv depends on precision of ChiDist. ChiInv uses an iterative search technique. If the search has not converged after 64 iterations, the function generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiSq_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiSq_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the chi-squared distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .ChiSq_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The value at which you want to evaluate the distribution.
Arg2 | Required | Double | Deg_freedom - The number of degrees of freedom.
Arg3 | Optional | Variant | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, CHISQ_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If any argument is nonnumeric, CHISQ_DIST returns the #VALUE! error value.

  • If x is negative, CHISQ_DIST returns the #NUM! error value.

  • If deg_freedom is not an integer, it is truncated.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiSq_Dist_RT Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiSq_Dist_RT Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the right-tailed probability of the chi-squared distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .ChiSq_Dist_RT(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The value at which you want to evaluate the distribution.
Arg2 | Required | Double | The number of degrees of freedom.

Return Value

Double

Remarks

The χ 2 distribution is associated with a χ 2 test. Use the χ 2 test to compare observed and expected values.

For example, a genetic experiment might hypothesize that the next generation of plants will exhibit a certain set of colors. By comparing the observed results with the expected ones, you can decide whether your original hypothesis is valid:

  • If either argument is nonnumeric, ChiSq_Dist_RT generates an error.

  • If x is negative, ChiSq_Dist_RT generates an error.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1 or degrees_freedom > 10^10, ChiSq_Dist_RT generates an error.

  • ChiSq_Dist_RT is calculated as ChiSq_Dist_RT = P(X>x), where X is a χ2 random variable.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiSq_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiSq_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the left-tailed probability of the chi-squared distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .ChiSq_Inv(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - A probability associated with the chi-squared distribution.
Arg2 | Required | Double | Deg_freedom - The number of degrees of freedom.

Return Value

Double

Remarks

  • If any argument is nonnumeric, CHISQ_INV returns the #VALUE! error value.

  • If probability < 0 or probability > 1, CHISQ_INV returns the #NUM! error value.

  • If deg_freedom is not an integer, it is truncated.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiSq_Inv_RT Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiSq_Inv_RT Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the right-tailed probability of the chi-squared distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .ChiSq_Inv_RT(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A probability associated with the chi-squared distribution.
Arg2 | Required | Double | The number of degrees of freedom.

Return Value

Double

Remarks

If probability = ChiSq_Dist_RT(x,...), then ChiSq_Inv_RT(probability,...) = x. Use this function to compare observed results with expected ones in order to decide whether your original hypothesis is valid:

  • If either argument is nonnumeric, ChiSq_Inv_RT generates an error.

  • If probability < 0 or probability > 1, ChiSq_Inv_RT generates an error.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1 or degrees_freedom ≥ 10^10, ChiSq_Inv_RT generates an error.

Given a value for probability, ChiSq_Inv_RT seeks that value x such that ChiSq_Dist_RT(x, degrees_freedom) = probability. Thus, precision of ChiSq_Inv_RT depends on precision of ChiSq_Dist_RT. ChiSq_Inv_RT uses an iterative search technique. If the search has not converged after 64 iterations, the function generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiSq_Test Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiSq_Test Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the test for independence.

Version Information

Version Added: Excel 2010

Syntax

expression .ChiSq_Test(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The range of data that contains observations to test against expected values.
Arg2 | Required | Variant | The range of data that contains the ratio of the product of row totals and column totals to the grand total.

Return Value

Double

Remarks

ChiSq_Test returns the value from the chi-squared (χ 2 ) distribution for the statistic and the appropriate degrees of freedom. You can use χ 2 tests to determine whether hypothesized results are verified by an experiment:

  • If actual_range and expected_range have a different number of data points, ChiSq_Test returns the #N/A error value.

  • The χ2 test first calculates a χ2 statistic using the formula: where: A ij = actual frequency in the i-th row, j-th column E ij = expected frequency in the i-th row, j-th column r = number or rows c = number of columns

  • A low value of χ 2 is an indicator of independence. As can be seen from the formula, χ 2 is always positive or 0, and is 0 only if A ij = E ij for every i,j.

  • ChiSq_Test returns the probability that a value of the χ 2 statistic at least as high as the value calculated by the above formula could have happened by chance under the assumption of independence. In computing this probability, ChiSq_Test uses the χ 2 distribution with an appropriate number of degrees of freedom, df. If r > 1 and c > 1, then df = (r - 1)(c - 1). If r = 1 and c > 1, then df = c - 1 or if r > 1 and c = 1, then df = r - 1. r = c= 1 is not allowed and generates an error.

  • Use of ChiSq_Test is most appropriate when E ij 's are not too small. Some statisticians suggest that each E ij should be greater than or equal to 5.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ChiTest Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ChiTest Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the test for independence.

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the ChiSq_Test method.

Syntax

expression .ChiTest(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The range of data that contains observations to test against expected values.
Arg2 | Required | Variant | The range of data that contains the ratio of the product of row totals and column totals to the grand total.

Return Value

Double

Remarks

ChiTest returns the value from the chi-squared (χ 2 ) distribution for the statistic and the appropriate degrees of freedom. You can use χ 2 tests to determine whether hypothesized results are verified by an experiment.

  • If actual_range and expected_range have a different number of data points, ChiTest returns the #N/A error value.

  • The χ2 test first calculates a χ2 statistic using the formula: where: A ij = actual frequency in the i-th row, j-th column E ij = expected frequency in the i-th row, j-th column r = number or rows c = number of columns

  • A low value of χ 2 is an indicator of independence. As can be seen from the formula, χ 2 is always positive or 0, and is 0 only if A ij = E ij for every i,j.

  • ChiTest returns the probability that a value of the χ 2 statistic at least as high as the value calculated by the above formula could have happened by chance under the assumption of independence. In computing this probability, ChiTest uses the χ 2 distribution with an appropriate number of degrees of freedom, df. If r > 1 and c > 1, then df = (r - 1)(c - 1). If r = 1 and c > 1, then df = c - 1 or if r > 1 and c = 1, then df = r - 1. r = c= 1 is not allowed and generates an error.

  • Use of ChiTest is most appropriate when E ij 's are not too small. Some statisticians suggest that each E ij should be greater than or equal to 5.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Choose Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Choose Method (Excel)
See also Send feedback

Published: July 16, 2012

Uses Arg1 as the index to return a value from the list of value arguments.

Syntax

expression .Choose(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Specifies which value argument is selected. Arg1 must be a number between 1 and 29, or a formula or reference to a cell containing a number between 1 and 29.
Arg2 - Arg30 | Required | Variant | 1 to 29 value arguments from which Choose selects a value or an action to perform based on Arg1. The arguments can be numbers, cell references, defined names, formulas, functions, or text.

Return Value

Variant

Remarks

  • If Arg1 is 1, Choose returns value1; if it is 2, Choose returns value2; and so on.

  • If Arg1 is less than 1 or greater than the number of the last value in the list, Choose generates an error.

  • If Arg1 is a fraction, it is truncated to the lowest integer before being used.

  • If Arg1 is an array, every value is evaluated when Choose is evaluated.

  • The value arguments to Choose can be range references as well as single values. For example, the formula:=SUM(Choose(2,A1:A10,B1:B10,C1:C10))evaluates to:=SUM(B1:B10)which then returns a value based on the values in the range B1:B10.The Choose function is evaluated first, returning the reference B1:B10. The SUM function is then evaluated using B1:B10, the result of the Choose function, as its argument.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Clean Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Clean Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all nonprintable characters from text.

Syntax

expression .Clean(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Any worksheet information from which you want to remove nonprintable characters.

Return Value

String

Remarks

Use Clean on text imported from other applications that contains characters that may not print with your operating system. For example, you can use Clean to remove some low-level computer code that is frequently at the beginning and end of data files and cannot be printed.

Important note Important

The Clean function was designed to remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31) from text. In the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157). By itself, the Clean function does not remove these additional nonprinting characters.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Combin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Combin Method (Excel)
See also Send feedback

Returns the number of combinations for a given number of items. Use Combin to determine the total possible number of groups for a given number of items.

Syntax

expression .Combin(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The number of items.
Arg2 | Required | Double | The number of items in each combination.

Return Value

Double

Remarks

  • Numeric arguments are truncated to integers.

  • If either argument is nonnumeric, Combin generates an error.

  • If number < 0, number_chosen < 0, or number < number_chosen, Combin generates an error.

  • A combination is any set or subset of items, regardless of their internal order. Combinations are distinct from permutations, for which the internal order is significant.

  • The number of combinations is as follows, where number = n and number_chosen = k: where:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Combina Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Combina Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of combinations with repetitions for a given number of items.

Version information

Version Added: Excel 2013

Syntax

expression .Combina(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The total number of items.
Arg2 | Required | DOUBLE | The number of items in each combination.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Complex Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Complex Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj.

Syntax

expression .Complex(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The real coefficient of the complex number.
Arg2 | Required | Variant | The imaginary coefficient of the complex number.
Arg3 | Optional | Variant | The suffix for the imaginary component of the complex number. If omitted, suffix is assumed to be "i".

Return Value

String

Remarks

  • If Arg1 is nonnumeric, Complex generates an error.

  • If Arg2 is nonnumeric, Complex generates an error.

  • If Arg3 is neither "i" nor "j", Complex generates an error.

Note Note

All complex number functions accept "i" and "j" for suffix, but neither "I" nor "J". Using uppercase generates an error. All functions that accept two or more complex numbers require that all suffixes match.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Confidence Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Confidence Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that you can use to construct a confidence interval for a population mean.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Confidence_Norm and Confidence_T methods.

Syntax

expression .Confidence(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The significance level used to compute the confidence level. The confidence level equals 100*(1 - alpha)%, or in other words, an alpha of 0.05 indicates a 95 percent confidence level.
Arg2 | Required | Double | The population standard deviation for the data range and is assumed to be known.
Arg3 | Required | Double | The sample size.

Return Value

Double

Remarks

The confidence interval is a range of values. Your sample mean, x , is at the center of this range and the range is x ± Confidence. For example, if x is the sample mean of delivery times for products ordered through the mail, x ± Confidence is a range of population means. For any population mean, μ 0 , in this range, the probability of obtaining a sample mean further from μ 0 than x is greater than alpha; for any population mean, μ 0 , not in this range, the probability of obtaining a sample mean further from μ 0 than x is less than alpha. In other words, assume that we use x , standard_dev, and size to construct a two-tailed test at significance level alpha of the hypothesis that the population mean is μ 0 . Then we will not reject that hypothesis if μ 0 is in the confidence interval and will reject that hypothesis if μ 0 is not in the confidence interval. The confidence interval does not allow us to infer that there is probability 1 - alpha that our next package will take a delivery time that is in the confidence interval.

  • If any argument is nonnumeric, Confidence generates an error.

  • If alpha ≤ 0 or alpha ≥ 1, Confidence generates an error.

  • If standard_dev ≤ 0, Confidence generates an error.

  • If size is not an integer, it is truncated.

  • If size < 1, Confidence generates an error.

  • If we assume alpha equals 0.05, we need to calculate the area under the standard normal curve that equals (1 - alpha), or 95 percent. This value is ± 1.96. The confidence interval is therefore:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Confidence_Norm Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Confidence_Norm Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value that you can use to construct a confidence interval for a population mean.

Version Information

Version Added: Excel 2010

Syntax

expression .Confidence_Norm(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The significance level used to compute the confidence level. The confidence level equals 100*(1 - alpha)%, or in other words, an alpha of 0.05 indicates a 95 percent confidence level.
Arg2 | Required | Double | The population standard deviation for the data range and is assumed to be known.
Arg3 | Required | Double | The sample size.

Return Value

Double

Remarks

The confidence interval is a range of values. Your sample mean, x , is at the center of this range and the range is x ± Confidence_Norm. For example, if x is the sample mean of delivery times for products ordered through the mail, x ± Confidence_Norm is a range of population means. For any population mean, μ 0 , in this range, the probability of obtaining a sample mean further from μ 0 than x is greater than alpha; for any population mean, μ 0 , not in this range, the probability of obtaining a sample mean further from μ 0 than x is less than alpha. In other words, assume that x , standard_dev, and size is used to construct a two-tailed test at significance level alpha of the hypothesis that the population mean is μ 0 . Then we will not reject that hypothesis if μ 0 is in the confidence interval and will reject that hypothesis if μ 0 is not in the confidence interval. The confidence interval does not allow inference that there is probability 1 - alpha that the next package will take a delivery time that is in the confidence interval:

  • If any argument is nonnumeric, Confidence_Norm generates an error.

  • If alpha ≤ 0 or alpha ≥ 1, Confidence_Norm generates an error.

  • If standard_dev ≤ 0, Confidence_Norm generates an error.

  • If size is not an integer, it is truncated.

  • If size < 1, Confidence_Norm generates an error.

  • If it is assumed that alpha equals 0.05, calculate the area under the standard normal curve that equals (1 - alpha), or 95 percent. This value is ± 1.96. The confidence interval is therefore:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Confidence_T Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Confidence_T Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the confidence interval for a population mean, using a Student's t distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .Confidence_T(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Alpha - The significance level used to compute the confidence level. The confidence level equals 100*(1 - alpha)%, or in other words, an alpha of 0.05 indicates a 95 percent confidence level.
Arg2 | Required | Double | Standard_dev - The population standard deviation for the data range and is assumed to be known.
Arg3 | Required | Double | Size - The sample size.

Return Value

Double

Remarks

  • If any argument is nonnumeric, CONFIDENCE_T returns the #VALUE! error value.

  • If alpha ≤ 0 or alpha ≥ 1, CONFIDENCE_T returns the #NUM! error value.

  • If standard_dev ≤ 0, CONFIDENCE_T returns the #NUM! error value.

  • If size is not an integer, it is truncated.

  • If size equals 1, CONFIDENCE_T returns #DIV/0! error value.

  • If size equals 1, CONFIDENCE_T returns #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Convert Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Convert Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a number from one measurement system to another. For example, Convert can translate a table of distances in miles to a table of distances in kilometers.

Syntax

expression .Convert(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The value in from_units to convert.
Arg2 | Required | Variant | The units for number.
Arg3 | Required | Variant | The units for the result. Convert accepts the following text values (in quotation marks) for from_unit and to_unit which are listed in the Remarks section below.

Return Value

Double

Remarks

Weight and mass | From_unit or to_unit
Gram | "g"
Slug | "sg"
Pound mass (avoirdupois) | "lbm"
U (atomic mass unit) | "u"
Ounce mass (avoirdupois) | "ozm"
Distance | From_unit or to_unit
Meter | "m"
Statute mile | "mi"
Nautical mile | "Nmi"
Inch | "in"
Foot | "ft"
Yard | "yd"
Angstrom | "ang"
Pica (1/72 in.) | "Pica"
Time | From_unit or to_unit
Year | "yr"
Day | "day"
Hour | "hr"
Minute | "mn"
Second | "sec"
Pressure | From_unit or to_unit
Pascal | "Pa" (or "p")
Atmosphere | "atm" (or "at")
mm of Mercury | "mmHg"
Force | From_unit or to_unit
Newton | "N"
Dyne | "dyn" (or "dy")
Pound force | "lbf"
Energy | From_unit or to_unit
Joule | "J"
Erg | "e"
Thermodynamic calorie | "c"
IT calorie | "cal"
Electron volt | "eV" (or "ev")
Horsepower-hour | "HPh" (or "hh")
Watt-hour | "Wh" (or "wh")
Foot-pound | "flb"
BTU | "BTU" (or "btu")
Power | From_unit or to_unit
Horsepower | "HP" (or "h")
Watt | "W" (or "w")
Magnetism | From_unit or to_unit
Tesla | "T"
Gauss | "ga"
Temperature | From_unit or to_unit
Degree Celsius | "C" (or "cel")
Degree Fahrenheit | "F" (or "fah")
Kelvin | "K" (or "kel")
Liquid measure | From_unit or to_unit
Teaspoon | "tsp"
Tablespoon | "tbs"
Fluid ounce | "oz"
Cup | "cup"
U.S. pint | "pt" (or "us_pt")
U.K. pint | "uk_pt"
Quart | "qt"
Gallon | "gal"
Liter | "l" (or "lt")

The following abbreviated unit prefixes can be prepended to any metric from_unit or to_unit.

Prefix | Multiplier | Abbreviation
exa | 1E+18 | "E"
peta | 1E+15 | "P"
tera | 1E+12 | "T"
giga | 1E+09 | "G"
mega | 1E+06 | "M"
kilo | 1E+03 | "k"
hecto | 1E+02 | "h"
dekao | 1E+01 | "e"
deci | 1E-01 | "d"
centi | 1E-02 | "c"
milli | 1E-03 | "m"
micro | 1E-06 | "u"
nano | 1E-09 | "n"
pico | 1E-12 | "p"
femto | 1E-15 | "f"
atto | 1E-18 | "a"

  • If the input data types are incorrect, Convert generates an error.

  • If the unit does not exist, Convert generates an error.

  • If the unit does not support an abbreviated unit prefix, Convert generates an error.

  • If the units are in different groups, Convert generates an error.

  • Unit names and prefixes are case-sensitive.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Correl Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Correl Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the correlation coefficient of the Arg1 and Arg2 cell ranges.

Syntax

expression .Correl(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | A cell range of values.
Arg2 | Required | Variant | A second cell range of values.

Return Value

Double

Remarks

Use the correlation coefficient to determine the relationship between two properties. For example, you can examine the relationship between a location's average temperature and the use of air conditioners.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If Arg1 and Arg2 have a different number of data points, Correl generates an error.

  • If either Arg1 or Arg2 is empty, or if s (the standard deviation) of their values equals zero, Correl generates an error.

  • The equation for the correlation coefficient is: where x and y are the sample means Average(Arg1) and Average(Arg2).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Cosh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Cosh Method (Excel)
See also Send feedback

Returns the hyperbolic cosine of a number.

Syntax

expression .Cosh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Any real number for which you want to find the hyperbolic cosine.

Return Value

Double

Remarks

The formula for the hyperbolic cosine is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Cot Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Cot Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cotangent of an angle.

Version information

Version Added: Excel 2013

Syntax

expression .Cot(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The angle in radians for which you want the cotangent.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Coth Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Coth Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic cotangent of a number

Version information

Version Added: Excel 2013

Syntax

expression .Coth(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The angle in radians for which you want the hyperbolic cotangent.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Count Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Count Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the number of cells that contain numbers and counts numbers within the list of arguments.

Syntax

expression .Count(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | 1 to 30 arguments that can contain or refer to a variety of different types of data, but only numbers are counted.

Return Value

Double

Remarks

Use Count to get the number of entries in a number field that is in a range or array of numbers.

  • Arguments that are numbers, dates, or text representation of numbers are counted.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • Arguments that are error values or text that cannot be translated into numbers are ignored.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • If you want to count logical values, text, or error values, use the CountA function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CountA Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CountA Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the number of cells that are not empty and the values within the list of arguments.

Syntax

expression .CountA(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | 1 to 30 arguments representing the values you want to count.

Return Value

Double

Remarks

Use CountA to count the number of cells that contain data in a range or array.

  • A value is any type of information, including error values and empty text (""). A value does not include empty cells.

  • If an argument is an array or reference, only values in that array or reference are used. Empty cells and text values in the array or reference are ignored.

  • If you do not need to count logical values, text, or error values, use the Count function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CountBlank Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CountBlank Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts empty cells in a specified range of cells.

Syntax

expression .CountBlank(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | The range from which you want to count the blank cells.

Return Value

Double

Remarks

Cells with formulas that return "" (empty text) are also counted. Cells with zero values are not counted.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CountIf Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CountIf Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the number of cells within a range that meet the given criteria.

Syntax

expression .CountIf(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | The range of cells from which you want to count cells.
Arg2 | Required | Variant | The criteria in the form of a number, expression, cell reference, or text that defines which cells will be counted. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.

Return Value

Double

Remarks

  • You can use the wildcard characters, question mark (?) and asterisk (*), for the criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CountIfs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CountIfs Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the number of cells within a range that meet multiple criteria.

Syntax

expression .CountIfs(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | One or more ranges in which to evaluate the associated criteria.
Arg2 - Arg30 | Required | Variant | One or more criteria in the form of a number, expression, cell reference, or text that define which cells will be counted. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.

Return Value

Double

Remarks

  • Each cell in a range is counted only if all of the corresponding criteria specified are true for that cell.

  • If a cell in any argument is an empty cell, CountIfs treats it as a 0 value.

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupDayBs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupDayBs Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of days from the beginning of the coupon period to the settlement date.

Syntax

expression .CoupDayBs(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

The following table contains the list of values for Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, 30 years after the January 1, 2008, issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupDayBs generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupDayBs generates an error.

  • If basis < 0 or if basis > 4, CoupDayBs generates an error.

  • If settlement ≥ maturity, CoupDayBs generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupDays Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupDays Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of days in the coupon period that contains the settlement date.

Syntax

expression .CoupDays(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table contains the values used in Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date is January 1, 2038, 30 years after the January 1, 2008 issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupDays generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupDays generates an error.

  • If basis < 0 or if basis > 4, CoupDays generates an error.

  • If settlement ≥ maturity, CoupDays generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupDaysNc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupDaysNc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of days from the settlement date to the next coupon date.

Syntax

expression .CoupDaysNc(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table contains the values used in Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupDaysNc generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupDaysNc generates an error.

  • If basis < 0 or if basis > 4, CoupDaysNc generates an error.

  • If settlement ≥ maturity, CoupDaysNc generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupNcd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupNcd Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number that represents the next coupon date after the settlement date.

Syntax

expression .CoupNcd(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table contains the values used in Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupNcd generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupNcd generates an error.

  • If basis < 0 or if basis > 4, CoupNcd generates an error.

  • If settlement ≥ maturity, CoupNcd generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupNum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupNum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.

Syntax

expression .CoupNum(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table contains the values used in Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupNum generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupNum generates an error.

  • If basis < 0 or if basis > 4, CoupNum generates an error.

  • If settlement ≥ maturity, CoupNum generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CoupPcd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CoupPcd Method (Excel)
See also Send feedback

Published: July 16, 2012

Syntax

expression .CoupPcd(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | The security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg4 | Optional | Variant | The type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

The following table contains the values used in Arg4.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • All arguments are truncated to integers.

  • If settlement or maturity is not a valid date, CoupPcd generates an error.

  • If frequency is any number other than 1, 2, or 4, CoupPcd generates an error.

  • If basis < 0 or if basis > 4, CoupPcd generates an error.

  • If settlement ≥ maturity, CoupPcd generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Covar Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Covar Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns covariance, the average of the products of deviations for each data point pair.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Covariance_P and Covariance_S method.

Syntax

expression .Covar(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The first cell range of integers.
Arg2 | Required | Variant | The second cell range of integers.

Return Value

Double

Remarks

Use covariance to determine the relationship between two data sets. For example, you can examine whether greater income accompanies greater levels of education.

  • The arguments must either be numbers or be names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If Arg1 and Arg2 have different numbers of data points, COVAR generates an error.

  • If either Arg1 or Arg2 is empty, Covar generates an error.

  • The covariance is: where x and y are the sample means AVERAGE(array1) and AVERAGE(array2), and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Covariance_P Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Covariance_P Method (Excel)
See also Send feedback

Returns population covariance, the average of the products of deviations for each data point pair.

Version Information

Version Added: Excel 2010

Syntax

expression .Covariance_P(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The first cell range of integers.
Arg2 | Required | Variant | The second cell range of integers.

Return Value

Double

Remarks

Use Covariance_P to determine the relationship between two data sets. For example, you can examine whether greater income accompanies greater levels of education:

  • The arguments must either be numbers or be names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If Arg1 and Arg2 have different numbers of data points, Covariance_P generates an error.

  • If either Arg1 or Arg2 is empty, Covariance_P generates an error.

  • The covariance is: where x and y are the sample means AVERAGE(array1) and AVERAGE(array2), and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Covariance_S Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Covariance_S Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sample covariance, the average of the products of deviations for each data point pair in two data sets.

Version Information

Version Added: Excel 2010

Syntax

expression .Covariance_S(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - The first cell range of integers.
Arg2 | Required | Variant | Array2 - The second cell range of integers.

Return Value

Double

Remarks

  • The arguments must either be numbers or be names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If array1 and array2 have different numbers of data points, COVARIANCE_S returns the #N/A error value.

  • If either array1 or array2 is empty or contains only 1 data point each, COVARIANCE_S returns the #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CritBinom Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CritBinom Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.

Syntax

expression .CritBinom(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | The number of Bernoulli trials.
Arg2 | Required | Double | The probability of a success on each trial.
Arg3 | Required | Double | The criterion value.

Return Value

Double

Remarks

Use this function for quality assurance applications. For example, use CritBinom to determine the greatest number of defective parts that are allowed to come off an assembly line run without rejecting the entire lot.

  • If any argument is nonnumeric, CritBinom generates an error.

  • If trials is not an integer, it is truncated.

  • If trials < 0, CritBinom generates an error.

  • If probability_s is < 0 or probability_s > 1, CritBinom generates an error.

  • If alpha < 0 or alpha > 1, CritBinom generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Csc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Csc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cosecant of an angle.

Version information

Version Added: Excel 2013

Syntax

expression .Csc(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The angle in radians for which you want the cosecant.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Csch Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Csch Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic cosecant of an angle.

Version information

Version Added: Excel 2013

Syntax

expression .Csch(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The angle in radians for which you want the hyperbolic cosecant.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CumIPmt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CumIPmt Method (Excel)
See also Send feedback

Returns the cumulative interest paid on a loan between start_period and end_period.

Syntax

expression .CumIPmt(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The interest rate.
Arg2 | Required | Variant | The total number of payment periods.
Arg3 | Required | Variant | The present value.
Arg4 | Required | Variant | The first period in the calculation. Payment periods are numbered beginning with 1.
Arg5 | Required | Variant | The last period in the calculation.
Arg6 | Required | Variant | The timing of the payment.

Return Value

Double

Remarks

The following tables lists values used in Arg6.

Type | Timing
0 (zero) | Payment at the end of the period
1 | Payment at the beginning of the period

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for Arg2. If you make annual payments on the same loan, use 12% for rate and 4 for Arg2.

  • Arg2, Arg4, Arg5, and type are truncated to integers.

  • If rate ≤ 0, Arg2 ≤ 0, or Arg3 ≤ 0, CumIPmt generates an error.

  • If Arg4 < 1, Arg5 < 1, or Arg4 > Arg5, CumIPmt generates an error.

  • If Arg6 is any number other than 0 or 1, CumIPmt generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.CumPrinc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.CumPrinc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cumulative principal paid on a loan between start_period and end_period.

Syntax

expression .CumPrinc(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The interest rate.
Arg2 | Required | Variant | The total number of payment periods.
Arg3 | Required | Variant | The present value.
Arg4 | Required | Variant | The first period in the calculation. Payment periods are numbered beginning with 1.
Arg5 | Required | Variant | The last period in the calculation.
Arg6 | Required | Variant | The timing of the payment.

Return Value

Double

Remarks

The following tables lists values used in Arg6.

Type | Timing
0 (zero) | Payment at the end of the period
1 | Payment at the beginning of the period

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for Arg2. If you make annual payments on the same loan, use 12% for rate and 4 for Arg2.

  • Arg2, Arg4, Arg5, and type are truncated to integers.

  • If rate ≤ 0, Arg2 ≤ 0, or Arg3 ≤ 0, CumPrinc generates an error.

  • If Arg4 < 1, Arg5 < 1, or Arg4 > Arg5, CumPrinc generates an error.

  • If Arg6 is any number other than 0 or 1, CumPrinc generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DAverage Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DAverage Method (Excel)
See also Send feedback

Published: July 16, 2012

Averages the values in a column of a list or database that match conditions you specify.

Syntax

expression .DAverage(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | The range of cells that contains the conditions you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Days Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Days Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of days between the two dates.

Version information

Version Added: Excel 2013

Syntax

expression .Days(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | VARIANT | start_date(Arg2) and end_date (Arg1) are the two dates between which you want to know the number of days.
Arg2 | Required | VARIANT | start_date(Arg2) and end_date (Arg1) are the two dates between which you want to know the number of days.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Days360 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Days360 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.

Syntax

expression .Days360(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg2 | Required | Variant | The two dates between which you want to know the number of days. If start_date (Arg1) occurs after end_date (Arg2), Days360 returns a negative number. Dates should be entered by using the DATE function, or as results of other formulas or functions.
Arg3 | Optional | Variant | A boolean value that specifies whether to use the U.S. or European method in the calculation.

Return Value

Double

Remarks

Use this function to help compute payments if your accounting system is based on twelve 30-day months.

The following tables contains the values for Arg3.

Method | Defined
FALSE or omitted | U.S. (NASD) method. If the starting date is the 31st of a month, it becomes equal to the 30th of the same month. If the ending date is the 31st of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month.
TRUE | European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month.
Caution note Caution

When you use the DAYS360 function to calculate the number of days between two dates, an unexpected value is returned. For example, when you use the DAYS360 function with a start date of February 28 and with an end date of March 28, a value of 28 days is returned. You expect a value of 30 days to be returned for every full month.

To work around this behavior, use the following formula: =DAYS360(start_date,end_date,IF(method=TRUE,TRUE,IF(AND(method=FALSE,MONTH(start_date)=2,DAY(start_date)>=28,MONTH(end_date)=2,DAY(end_date)>=28),TRUE,FALSE)))

Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Note Note

Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Db Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Db Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the depreciation of an asset for a specified period using the fixed-declining balance method.

Syntax

expression .Db(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Cost - the initial cost of the asset.
Arg2 | Required | Double | Salvage - the value at the end of the depreciation (sometimes called the salvage value of the asset).
Arg3 | Required | Double | Life - the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
Arg4 | Required | Double | Period - the period for which you want to calculate the depreciation. Period must use the same units as life.
Arg5 | Optional | Variant | Month - the number of months in the first year. If month is omitted, it is assumed to be 12.

Return Value

Double

Remarks

  • The fixed-declining balance method computes depreciation at a fixed rate. DB uses the following formulas to calculate depreciation for a period: (cost - total depreciation from prior periods) * rate where: rate = 1 - ((salvage / cost) ^ (1 / life)), rounded to three decimal places

  • Depreciation for the first and last periods is a special case. For the first period, DB uses this formula: cost * rate * month / 12

  • For the last period, DB uses this formula: ((cost - total depreciation from prior periods) * rate * (12 - month)) / 12

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Dbcs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Dbcs Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts half-width (single-byte) letters within a character string to full-width (double-byte) characters. The name of the function (and the characters that it converts) depends upon the language settings. Read/write String.

Syntax

expression .Dbcs(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | The text or a reference to a cell that contains the text that you want to change.

Return Value

String

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DCount Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DCount Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the cells that contain numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DCount(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as the argument includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DCountA Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DCountA Method (Excel)
See also Send feedback

Published: July 16, 2012

Counts the nonblank cells in a column of a list or database that match conditions that you specify.

Syntax

expression .DCountA(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ddb Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ddb Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.

Syntax

expression .Ddb(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Cost - the initial cost of the asset.
Arg2 | Required | Double | Salvage - the value at the end of the depreciation (sometimes called the salvage value of the asset). This value can be 0.
Arg3 | Required | Double | Life - the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
Arg4 | Required | Double | Period - the period for which you want to calculate the depreciation. Period must use the same units as life.
Arg5 | Optional | Variant | Factor - the rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method).

Return Value

Double

Remarks

Important note Important

All five arguments must be positive numbers.

  • The double-declining balance method computes depreciation at an accelerated rate. Depreciation is highest in the first period and decreases in successive periods. DDB uses the following formula to calculate depreciation for a period: Min( (cost - total depreciation from prior periods) * (factor/life), (cost - salvage - total depreciation from prior periods) )

  • Change factor if you do not want to use the double-declining balance method.

  • Use the VDB function if you want to switch to the straight-line depreciation method when depreciation is greater than the declining balance calculation.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Dec2Bin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Dec2Bin Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a decimal number to binary.

Syntax

expression .Dec2Bin(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the decimal integer you want to convert. If number is negative, valid place values are ignored and DEC2BIN returns a 10-character (10-bit) binary number in which the most significant bit is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, DEC2BIN uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value.

  • If number is nonnumeric, DEC2BIN returns the #VALUE! error value.

  • If DEC2BIN requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, DEC2BIN returns the #VALUE! error value.

  • If places is zero or negative, DEC2BIN returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Dec2Hex Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Dec2Hex Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a decimal number to hexadecimal.

Syntax

expression .Dec2Hex(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the decimal integer you want to convert. If number is negative, places is ignored and DEC2HEX returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, DEC2HEX uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number < -549,755,813,888 or if number > 549,755,813,887, DEC2HEX returns the #NUM! error value.

  • If number is nonnumeric, DEC2HEX returns the #VALUE! error value.

  • If DEC2HEX requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, DEC2HEX returns the #VALUE! error value.

  • If places is negative, DEC2HEX returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Dec2Oct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Dec2Oct Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a decimal number to octal.

Syntax

expression .Dec2Oct(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the decimal integer you want to convert. If number is negative, places is ignored and DEC2OCT returns a 10-character (30-bit) octal number in which the most significant bit is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, DEC2OCT uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number < -536,870,912 or if number > 536,870,911, DEC2OCT returns the #NUM! error value.

  • If number is nonnumeric, DEC2OCT returns the #VALUE! error value.

  • If DEC2OCT requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, DEC2OCT returns the #VALUE! error value.

  • If places is negative, DEC2OCT returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Decimal Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Decimal Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a text representation of a number in a given base into a decimal number.

Version information

Version Added: Excel 2013

Syntax

expression .Decimal(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | The number that you want to convert.
Arg2 | Required | DOUBLE | The base Radix of the number you are converting.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Degrees Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Degrees Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts radians into degrees.

Syntax

expression .Degrees(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Angle - the angle in radians that you want to convert.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Delta Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Delta Method (Excel)
See also Send feedback

Published: July 16, 2012

Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise.

Syntax

expression .Delta(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number1 - the first number.
Arg2 | Optional | Variant | Number2 - the second number. If omitted, number2 is assumed to be zero.

Return Value

Double

Remarks

Use this function to filter a set of values. For example, by summing several DELTA functions you calculate the count of equal pairs. This function is also known as the Kronecker Delta function.

  • If number1 is nonnumeric, DELTA returns the #VALUE! error value.

  • If number2 is nonnumeric, DELTA returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DevSq Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DevSq Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of squares of deviations of data points from their sample mean.

Syntax

expression .DevSq(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - are 1 to 30 arguments for which you want to calculate the sum of squared deviations. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • The equation for the sum of squared deviations is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DGet Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DGet Method (Excel)
See also Send feedback

Published: July 16, 2012

Extracts a single value from a column of a list or database that matches conditions that you specify.

Syntax

expression .DGet(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Variant

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Disc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Disc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the discount rate for a security.

Syntax

expression .Disc(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Pr - the security's price per $100 face value.
Arg4 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg5 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, and basis are truncated to integers.

  • If settlement or maturity is not a valid serial date number, DISC returns the #VALUE! error value.

  • If pr ≤ 0 or if redemption ≤ 0, DISC returns the #NUM! error value.

  • If basis < 0 or if basis > 4, DISC returns the #NUM! error value.

  • If settlement ≥ maturity, DISC returns the #NUM! error value.

  • DISC is calculated as follows: where: B = number of days in a year, depending on the year basis. DSM = number of days between settlement and maturity.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DMax Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DMax Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the largest number in a column of a list or database that matches conditions you that specify.

Syntax

expression .DMax(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DMin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DMin Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the smallest number in a column of a list or database that matches conditions that you specify.

Syntax

expression .DMin(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Dollar Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Dollar Method (Excel)
See also Send feedback

Published: July 16, 2012

The function described in this Help topic converts a number to text format and applies a currency symbol. The name of the function (and the symbol that it applies) depends upon your language settings.

Syntax

expression .Dollar(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - a number, a reference to a cell containing a number, or a formula that evaluates to a number.
Arg2 | Optional | Variant | Decimals - the number of digits to the right of the decimal point. If decimals is negative, number is rounded to the left of the decimal point. If you omit decimals, it is assumed to be 2.

Return Value

String

Remarks

The major difference between formatting a cell that contains a number with the Cells command (Format menu) and formatting a number directly with the DOLLAR function is that DOLLAR converts its result to text. A number formatted with the Cells command is still a number. You can continue to use numbers formatted with DOLLAR in formulas, because Microsoft Excel converts numbers entered as text values to numbers when it calculates.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DollarDe Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DollarDe Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. Use DOLLARDE to convert fractional dollar numbers, such as securities prices, to decimal numbers.

Syntax

expression .DollarDe(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Fractional_dollar - is a number expressed as a fraction.
Arg2 | Required | Variant | Fraction - the integer to use in the denominator of the fraction.

Return Value

Double

Remarks

  • If fraction is not an integer, it is truncated.

  • If fraction is less than 0, DOLLARDE returns the #NUM! error value.

  • If fraction is 0, DOLLARDE returns the #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DollarFr Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DollarFr Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Use DOLLARFR to convert decimal numbers to fractional dollar numbers, such as securities prices.

Syntax

expression .DollarFr(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Decimal_dollar - is a decimal number.
Arg2 | Required | Variant | Fraction - the integer to use in the denominator of a fraction.

Return Value

Double

Remarks

  • If fraction is not an integer, it is truncated.

  • If fraction is less than 0, DOLLARFR returns the #NUM! error value.

  • If fraction is 0, DOLLARFR returns the #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DProduct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DProduct Method (Excel)
See also Send feedback

Published: July 16, 2012

Multiplies the values in a column of a list or database that match conditions that you specify.

Syntax

expression .DProduct(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database is the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria is the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DStDev Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DStDev Method (Excel)
See also Send feedback

Published: July 16, 2012

Estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DStDev(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DStDevP Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DStDevP Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DStDevP(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - is the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DSum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DSum Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds the numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DSum(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Duration Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Duration Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of the cash flows and is used as a measure of a bond price's response to changes in yield.

Syntax

expression .Duration(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Coupon - the security's annual coupon rate.
Arg4 | Required | Variant | Yld - the security's annual yield.
Arg5 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg6 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, frequency, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, DURATION returns the #VALUE! error value.

  • If coupon < 0 or if yld < 0, DURATION returns the #NUM! error value.

  • If frequency is any number other than 1, 2, or 4, DURATION returns the #NUM! error value.

  • If basis < 0 or if basis > 4, DURATION returns the #NUM! error value.

  • If settlement ≥ maturity, DURATION returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DVar Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DVar Method (Excel)
See also Send feedback

Published: July 16, 2012

Estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DVar(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.DVarP Method (Excel)

 Copy code hover
[image]

WorksheetFunction.DVarP Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the variance of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.

Syntax

expression .DVarP(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Database - the range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
Arg2 | Required | Variant | Field - indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
Arg3 | Required | Variant | Criteria - the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return Value

Double

Remarks

  • Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:=''=entry''Where entry is the text or value you want to find. For example:

    What you type in the cell

    What Excel evaluates and displays

    ="=Davolio"

    =Davolio

    ="=3000"

    =3000

  • When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.EDate Method (Excel)

 Copy code hover
[image]

WorksheetFunction.EDate Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the serial number that represents the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.

Syntax

expression .EDate(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Start_date - a date that represents the start date. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.
Arg2 | Required | Variant | Months - the number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.

Return Value

Double

Remarks

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • If start_date is not a valid date, EDATE returns the #VALUE! error value.

  • If months is not an integer, it is truncated.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Effect Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Effect Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year.

Syntax

expression .Effect(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Nominal_rate - the nominal interest rate.
Arg2 | Required | Variant | Npery - the number of compounding periods per year.

Return Value

Double

Remarks

  • Npery is truncated to an integer.

  • If either argument is nonnumeric, EFFECT returns the #VALUE! error value.

  • If nominal_rate ≤ 0 or if npery < 1, EFFECT returns the #NUM! error value.

  • EFFECT is calculated as follows:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.EncodeUrl Method (Excel)

 Copy code hover
[image]

WorksheetFunction.EncodeUrl Method (Excel)
See also Send feedback

Published: July 16, 2012

URL encodes the argument.

Version information

Version Added: Excel 2013

Syntax

expression .EncodeUrl(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Text to be encoded.

Return value

VARIANT

Remarks

This method enables the referencing of other cells as arguments into the Web Service URL, as this will ensure the data will be URL encoded.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.EoMonth Method (Excel)

 Copy code hover
[image]

WorksheetFunction.EoMonth Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.

Syntax

expression .EoMonth(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Start_date - a date that represents the starting date. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.
Arg2 | Required | Variant | Months - the number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.

Return Value

Double

Remarks

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • If start_date is not a valid date, EOMONTH returns the #NUM! error value.

  • If start_date plus months yields an invalid date, EOMONTH returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Erf Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Erf Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the error function integrated between lower_limit and upper_limit.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Erf_Precise method.

Syntax

expression .Erf(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lower_limit - the lower bound for integrating ERF.
Arg2 | Optional | Variant | Upper_limit - the upper bound for integrating ERF. If omitted, ERF integrates between zero and lower_limit.

Return Value

Double

Remarks

  • If lower_limit is nonnumeric, ERF returns the #VALUE! error value.

  • If lower_limit is negative, ERF returns the #NUM! error value.

  • If upper_limit is nonnumeric, ERF returns the #VALUE! error value.

  • If upper_limit is negative, ERF returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Erf_Precise Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Erf_Precise Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the error function integrated between zero and lower_limit.

Version Information

Version Added: Excel 2010

Syntax

expression .Erf_Precise(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lower_limit - the lower bound for integrating ERF.

Return Value

Double

Remarks

  • If lower_limit is nonnumeric, Erf_Precise generates an error.

  • If lower_limit is negative, Erf_Precise generates an error.

Note Note

If you previously used the Erf method, which provides an optional upper_limit parameter, using the Erf_Precise method is equivalent to calling Erf(lower_limit) or Erf(0, upper_limit)

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ErfC Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ErfC Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the complementary ERF function integrated between the specified parameter and infinity.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the ErfC_Precise method.

Syntax

expression .ErfC(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The first argument.
Arg2 | Optional | Variant | The second argument.

Return Value

Double

Remarks

If this function is not available, and returns the #NAME? error, you need to install and load the Analysis ToolPak add-in.

If the parameter is nonnumeric, ERFC returns the #VALUE! error value.

If the parameter is negative, ERFC returns the #NUM! error value.

Example

The following example displays the complementary ERF function of 1 (0.1573).

Copy code Copy code
=ERFC(1)

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ErfC_Precise Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ErfC_Precise Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the complementary error function integrated between the specified value and infinity.

Version Information

Version Added: Excel 2010

Syntax

expression .ErfC_Precise(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | The value to compute against.

Return Value

Double

Remarks

If the specified value is nonnumeric, ErfC_Precise generates an error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Even Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Even Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.

Syntax

expression .Even(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the value to round.

Return Value

Double

Remarks

  • If number is nonnumeric, EVEN returns the #VALUE! error value.

  • Regardless of the sign of number, a value is rounded up when adjusted away from zero. If number is an even integer, no rounding occurs.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Expon_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Expon_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the exponential distribution. Use EXPON_DIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPON_DIST to determine the probability that the process takes at most 1 minute.

Version Information

Version Added: Excel 2010

Syntax

expression .Expon_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value of the function.
Arg2 | Required | Double | Lambda - the parameter value.
Arg3 | Required | Boolean | Cumulative - a logical value that indicates which form of the exponential function to provide. If cumulative is TRUE, EXPONDIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If x or lambda is nonnumeric, EXPON_DIST returns the #VALUE! error value.

  • If x < 0, EXPON_DIST returns the #NUM! error value.

  • If lambda ≤ 0, EXPON_DIST returns the #NUM! error value.

  • The equation for the probability density function is:

  • The equation for the cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ExponDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ExponDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the exponential distribution. Use EXPONDIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPONDIST to determine the probability that the process takes at most 1 minute.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Expon_Dist method.

Syntax

expression .ExponDist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value of the function.
Arg2 | Required | Double | Lambda - the parameter value.
Arg3 | Required | Boolean | Cumulative - a logical value that indicates which form of the exponential function to provide. If cumulative is TRUE, EXPONDIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If x or lambda is nonnumeric, EXPONDIST returns the #VALUE! error value.

  • If x < 0, EXPONDIST returns the #NUM! error value.

  • If lambda ≤ 0, EXPONDIST returns the #NUM! error value.

  • The equation for the probability density function is:

  • The equation for the cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.F_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.F_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the F probability distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .F_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The value at which to evaluate the function.
Arg2 | Required | Double | Deg_freedom1 - The numerator degrees of freedom.
Arg3 | Required | Double | Deg_freedom2 - The denominator degrees of freedom.
Arg4 | Optional | Variant | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, F_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If any argument is nonnumeric, F_DIST returns the #VALUE! error value.

  • If x is negative, F_DIST returns the #NUM! error value.

  • If deg_freedom1 or deg_freedom2 is not an integer, it is truncated.

  • If deg_freedom1 < 1, F_DIST returns the #NUM! error value.

  • If deg_freedom < 1, F_DIST returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.F_Dist_RT Method (Excel)

 Copy code hover
[image]

WorksheetFunction.F_Dist_RT Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the right-tailed F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.

Version Information

Version Added: Excel 2010

Syntax

expression .F_Dist_RT(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which to evaluate the function.
Arg2 | Required | Double | Degrees_freedom1 - the numerator degrees of freedom.
Arg3 | Required | Double | Degrees_freedom2 - the denominator degrees of freedom.

Return Value

Double

Remarks

  • If any argument is nonnumeric, F_DIST_RT returns the #VALUE! error value.

  • If x is negative, F_DIST_RT returns the #NUM! error value.

  • If degrees_freedom1 or degrees_freedom2 is not an integer, it is truncated.

  • If degrees_freedom1 < 1 or degrees_freedom1 ≥ 10^10, F_DIST_RT returns the #NUM! error value.

  • If degrees_freedom2 < 1 or degrees_freedom2 ≥ 10^10, F_DIST_RT returns the #NUM! error value.

  • F_DIST_RT is calculated as F_DIST_RT=P( F>x ), where F is a random variable that has an F distribution with degrees_freedom1 and degrees_freedom2 degrees of freedom.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.F_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.F_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the F probability distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .F_Inv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - A probability associated with the F cumulative distribution.
Arg2 | Required | Double | Deg_freedom1 - The numerator degrees of freedom.
Arg3 | Required | Double | Deg_freedom2 - The denominator degrees of freedom.

Return Value

Double

Remarks

  • If any argument is nonnumeric, F_INV returns the #VALUE! error value.

  • If probability < 0 or probability > 1, F_INV returns the #NUM! error value.

  • If deg_freedom1 or deg_freedom2 is not an integer, it is truncated.

  • If deg_freedom1 < 1, or deg_freedom2 < 1, F_INV returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.F_Inv_RT Method (Excel)

 Copy code hover
[image]

WorksheetFunction.F_Inv_RT Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the right-tailed F probability distribution. If p = F_DIST_RT(x,...), then F_INV_RT(p,...) = x.

Version Information

Version Added: Excel 2010

Syntax

expression .F_Inv_RT(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - a probability associated with the F cumulative distribution.
Arg2 | Required | Double | Degrees_freedom1 - the numerator degrees of freedom.
Arg3 | Required | Double | Degrees_freedom2 - the denominator degrees of freedom.

Return Value

Double

Remarks

The F distribution can be used in an F-test that compares the degree of variability in two data sets. For example, you can analyze income distributions in the United States and Canada to determine whether the two countries have a similar degree of income diversity:

  • If any argument is nonnumeric, F_INV_RT returns the #VALUE! error value.

  • If probability < 0 or probability > 1, F_INV_RT returns the #NUM! error value.

  • If degrees_freedom1 or degrees_freedom2 is not an integer, it is truncated.

  • If degrees_freedom1 < 1 or degrees_freedom1 ≥ 10^10, F_INV_RT returns the #NUM! error value.

  • If degrees_freedom2 < 1 or degrees_freedom2 ≥ 10^10, F_INV_RT returns the #NUM! error value.

F_INV_RT can be used to return critical values from the F distribution. For example, the output of an ANOVA calculation often includes data for the F statistic, F probability, and F critical value at the 0.05 significance level. To return the critical value of F, use the significance level as the probability argument to F_INV_RT.

Given a value for probability, F_INV_RT seeks that value x such that F_DIST_RT(x, degrees_freedom1, degrees_freedom2) = probability. Thus, precision of F_INV_RT depends on precision of F_DIST_RT. F_INV_RT uses an iterative search technique. If the search has not converged after 64 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.F_Test Method (Excel)

 Copy code hover
[image]

WorksheetFunction.F_Test Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.

Version Information

Version Added: Excel 2010

Syntax

expression .F_Test(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - the first array or range of data.
Arg2 | Required | Variant | Array2 - the second array or range of data.

Return Value

Double

Remarks

  • The arguments must be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If the number of data points in array1 or array2 is less than 2, or if the variance of array1 or array2 is zero, F_TEST returns the #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Fact Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Fact Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.

Syntax

expression .Fact(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the nonnegative number you want the factorial of. If number is not an integer, it is truncated.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FactDouble Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FactDouble Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the double factorial of a number.

Syntax

expression .FactDouble(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the value for which to return the double factorial. If number is not an integer, it is truncated.

Return Value

Double

Remarks

  • If number is nonnumeric, FACTDOUBLE returns the #VALUE! error value.

  • If number is negative, FACTDOUBLE returns the #NUM! error value.

  • If number is even:

  • If number is odd:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the F_Dist_RT and F_Dist methods.

Syntax

expression .FDist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which to evaluate the function.
Arg2 | Required | Double | Degrees_freedom1 - the numerator degrees of freedom.
Arg3 | Required | Double | Degrees_freedom2 - the denominator degrees of freedom.

Return Value

Double

Remarks

  • If any argument is nonnumeric, FDIST returns the #VALUE! error value.

  • If x is negative, FDIST returns the #NUM! error value.

  • If degrees_freedom1 or degrees_freedom2 is not an integer, it is truncated.

  • If degrees_freedom1 < 1 or degrees_freedom1 ≥ 10^10, FDIST returns the #NUM! error value.

  • If degrees_freedom2 < 1 or degrees_freedom2 ≥ 10^10, FDIST returns the #NUM! error value.

  • FDIST is calculated as FDIST=P( F>x ), where F is a random variable that has an F distribution with degrees_freedom1 and degrees_freedom2 degrees of freedom.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FilterXML Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FilterXML Method (Excel)
See also Send feedback

Published: July 16, 2012

Get specific data from the returned XML, typically from a WebService function call.

Version information

Version Added: Excel 2013

Syntax

expression .FilterXML(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Members (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Valid xml string.
Arg2 | Required | STRING | XPath query string.

Remarks

The XPath parameter is limited to 1024 characters.

The FILTERXML function returns results that are parsed via the user specified data locale.

Return value

VARIANT

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Find Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Find Method (Excel)
See also Send feedback

Published: July 16, 2012

Finds specific information in a worksheet.

Syntax

expression .Find(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | The name of the worksheet.
Arg2 | Required | String | The name of the range.
Arg3 | Optional | Variant | The name of an argument to refine the search.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FindB Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FindB Method (Excel)
See also Send feedback

Published: July 16, 2012

FIND and FINDB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.

Syntax

expression .FindB(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Find_text - the text you want to find.
Arg2 | Required | String | Within_text - the text containing the text you want to find.
Arg3 | Optional | Variant | Start_num - specifies the character at which to start the search. The first character in within_text is character number 1. If you omit start_num, it is assumed to be 1.

Return Value

Double

Remarks

Important note Important

FIND is intended for use with languages that use the single-byte character set (SBCS), whereas FINDB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

  • FIND always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • FINDB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, FINDB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

  • FIND and FINDB are case sensitive and don't allow wildcard characters. If you don't want to do a case sensitive search or use wildcard characters, you can use SEARCH and SEARCHB.

  • If find_text is "" (empty text), FIND matches the first character in the search string (that is, the character numbered start_num or 1).

  • Find_text cannot contain any wildcard characters.

  • If find_text does not appear in within_text, FIND and FINDB return the #VALUE! error value.

  • If start_num is not greater than zero, FIND and FINDB return the #VALUE! error value.

  • If start_num is greater than the length of within_text, FIND and FINDB return the #VALUE! error value.

  • Use start_num to skip a specified number of characters. Using FIND as an example, suppose you are working with the text string "AYF0093.YoungMensApparel". To find the number of the first "Y" in the descriptive part of the text string, set start_num equal to 8 so that the serial-number portion of the text is not searched. FIND begins with character 8, finds find_text at the next character, and returns the number 9. FIND always returns the number of characters from the start of within_text, counting the characters you skip if start_num is greater than 1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the F_Inv_RT and F_Inv methods.

Syntax

expression .FInv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - a probability associated with the F cumulative distribution.
Arg2 | Required | Double | Degrees_freedom1 - the numerator degrees of freedom.
Arg3 | Required | Double | Degrees_freedom2 - is the denominator degrees of freedom.

Return Value

Double

Remarks

The F distribution can be used in an F-test that compares the degree of variability in two data sets. For example, you can analyze income distributions in the United States and Canada to determine whether the two countries have a similar degree of income diversity.

  • If any argument is nonnumeric, FINV returns the #VALUE! error value.

  • If probability < 0 or probability > 1, FINV returns the #NUM! error value.

  • If degrees_freedom1 or degrees_freedom2 is not an integer, it is truncated.

  • If degrees_freedom1 < 1 or degrees_freedom1 ≥ 10^10, FINV returns the #NUM! error value.

  • If degrees_freedom2 < 1 or degrees_freedom2 ≥ 10^10, FINV returns the #NUM! error value.

FINV can be used to return critical values from the F distribution. For example, the output of an ANOVA calculation often includes data for the F statistic, F probability, and F critical value at the 0.05 significance level. To return the critical value of F, use the significance level as the probability argument to FINV.

Given a value for probability, FINV seeks that value x such that FDIST(x, degrees_freedom1, degrees_freedom2) = probability. Thus, precision of FINV depends on precision of FDIST. FINV uses an iterative search technique. If the search has not converged after 64 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Fisher Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Fisher Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient.

Syntax

expression .Fisher(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | x - a numeric value for which you want the transformation.

Return Value

Double

Remarks

  • If x is nonnumeric, FISHER returns the #VALUE! error value.

  • If x ≤ -1 or if x ≥ 1, FISHER returns the #NUM! error value.

  • The equation for the Fisher transformation is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FisherInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FisherInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x.

Syntax

expression .FisherInv(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | y - the value for which you want to perform the inverse of the transformation.

Return Value

Double

Remarks

  • If y is nonnumeric, FISHERINV returns the #VALUE! error value.

  • The equation for the inverse of the Fisher transformation is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Fixed Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Fixed Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.

Syntax

expression .Fixed(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the number you want to round and convert to text.
Arg2 | Optional | Variant | Decimals - the number of digits to the right of the decimal point.
Arg3 | Optional | Variant | No_commas - a logical value that, if TRUE, prevents FIXED from including commas in the returned text.

Return Value

String

Remarks

  • Numbers in Microsoft Excel can never have more than 15 significant digits, but decimals can be as large as 127.

  • If decimals is negative, number is rounded to the left of the decimal point.

  • If you omit decimals, it is assumed to be 2.

  • If no_commas is FALSE or omitted, then the returned text includes commas as usual.

  • The major difference between formatting a cell containing a number with the Cells command ( Format menu) and formatting a number directly with the FIXED function is that FIXED converts its result to text. A number formatted with the Cells command is still a number.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Floor Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Floor Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds number down, toward zero, to the nearest multiple of significance.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Floor_Precise method.

Syntax

expression .Floor(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the numeric value you want to round.
Arg2 | Required | Double | Significance - the multiple to which you want to round.

Return Value

Double

Remarks

  • As long as the number and specified significance have the same sign, then FLOOR rounds TOWARDS zero to the nearest multiple of significance.

  • If either argument is nonnumeric, FLOOR returns the #VALUE! error value.

  • In Excel 2010 and Excel 2013, Excel allows positive and negative multiples of significance with negative numbers. In those cases, if the significance is positive FLOOR rounds away from zero. Otherwise,if significance is negative FLOOR rounds towards zero.

  • For positive numbers with negative multiples of significance, Excel 2010 and Excel 2013 returns the #NUM! error value.

  • If number is an exact multiple of significance, no rounding occurs.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Floor_Math Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Floor_Math Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number down, to the nearest integer or to the nearest multiple of significance.

Version information

Version Added: Excel 2013

Syntax

expression .Floor_Math(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The value you want to round.
Arg2 | Optional | VARIANT | The multiple to which you want to round.
Arg3 | Optional | VARIANT | When given a nonzero number, this function will round towards zero.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Floor_Precise Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Floor_Precise Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds the specified number to the nearest multiple of significance.

Version Information

Version Added: Excel 2010

Syntax

expression .Floor_Precise(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the numeric value you want to round.
Arg2 | Optional | Variant | Significance - the multiple to which you want to round.

Return Value

Double

Remarks

Depending on the sign of the number and significance arguments, the Floor_Precise method rounds either away from or towards zero.

Sign (Arg1/Arg2) | Rounding
-/- | Rounds away from zero.
+/+ | Rounds toward zero.
-/+ | Rounds away from zero.
+/- | Rounds toward zero.

  • If either argument is nonnumeric, the Floor_Precise method generates an error.

  • If number is an exact multiple of significance, no rounding occurs.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Forecast Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Forecast Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. You can use this function to predict future sales, inventory requirements, or consumer trends.

Syntax

expression .Forecast(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the data point for which you want to predict a value.
Arg2 | Required | Variant | Known_y's - the dependent array or range of data.
Arg3 | Required | Variant | Known_x's - the independent array or range of data.

Return Value

Double

Remarks

  • If x is nonnumeric, FORECAST returns the #VALUE! error value.

  • If known_y's and known_x's are empty or contain a different number of data points, FORECAST returns the #N/A error value.

  • If the variance of known_x's equals zero, then FORECAST returns the #DIV/0! error value.

  • The equation for FORECAST is a+bx, where: and: and where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known y's).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Frequency Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Frequency Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula.

Syntax

expression .Frequency(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Data_array - an array of or reference to a set of values for which you want to count frequencies. If data_array contains no values, FREQUENCY returns an array of zeros.
Arg2 | Required | Variant | Bins_array - an array of or reference to intervals into which you want to group the values in data_array. If bins_array contains no values, FREQUENCY returns the number of elements in data_array.

Return Value

Variant

Remarks

  • FREQUENCY is entered as an array formula after you select a range of adjacent cells into which you want the returned distribution to appear.

  • The number of elements in the returned array is one more than the number of elements in bins_array. The extra element in the returned array returns the count of any values above the highest interval. For example, when counting three ranges of values (intervals) that are entered into three cells, be sure to enter FREQUENCY into four cells for the results. The extra cell returns the number of values in data_array that are greater than the third interval value.

  • FREQUENCY ignores blank cells and text.

  • Formulas that return arrays must be entered as array formulas.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FTest Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FTest Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the F_Test method.

Syntax

expression .FTest(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - the first array or range of data.
Arg2 | Required | Variant | Array2 - the second array or range of data.

Return Value

Double

Remarks

  • The arguments must be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If the number of data points in array1 or array2 is less than 2, or if the variance of array1 or array2 is zero, FTEST returns the #DIV/0! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Fv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Fv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the future value of an investment based on periodic, constant payments and a constant interest rate.

Syntax

expression .Fv(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate per period.
Arg2 | Required | Double | Nper - the total number of payment periods in an annuity.
Arg3 | Required | Double | Pmt - the payment made each period; it cannot change over the life of the annuity. Typically, pmt contains principal and interest but no other fees or taxes. If pmt is omitted, you must include the pv argument.
Arg4 | Optional | Variant | Pv - the present value, or the lump-sum amount that a series of future payments is worth right now. If pv is omitted, it is assumed to be 0 (zero), and you must include the pmt argument.
Arg5 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0.

Return Value

Double

Remarks

For a more complete description of the arguments in FV and for more information on annuity functions, see PV.

Set type equal to | If payments are due
0 | At the end of the period
1 | At the beginning of the period

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.

  • For all the arguments, cash you pay out, such as deposits to savings, is represented by negative numbers; cash you receive, such as dividend checks, is represented by positive numbers.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.FVSchedule Method (Excel)

 Copy code hover
[image]

WorksheetFunction.FVSchedule Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the future value of an initial principal after applying a series of compound interest rates. Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.

Syntax

expression .FVSchedule(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Principal - the present value.
Arg2 | Required | Variant | Schedule - an array of interest rates to apply.

Return Value

Double

Remarks

The values in schedule can be numbers or blank cells; any other value produces the #VALUE! error value for FVSCHEDULE. Blank cells are taken as zeros (no interest).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Gamma Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Gamma Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Gamma function value.

Version information

Version Added: Excel 2013

Syntax

expression .Gamma(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The value for which you want to calculate Gamma.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Gamma_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Gamma_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.

Version Information

Version Added: Excel 2010

Syntax

expression .Gamma_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which you want to evaluate the distribution.
Arg2 | Required | Double | Alpha - a parameter to the distribution.
Arg3 | Required | Double | Beta - a parameter to the distribution. If beta = 1, GAMMA_DIST returns the standard gamma distribution.
Arg4 | Required | Boolean | Cumulative - a logical value that determines the form of the function. If cumulative is TRUE, GAMMA_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If x, alpha, or beta is nonnumeric, GAMMA_DIST returns the #VALUE! error value.

  • If x < 0, GAMMA_DIST returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, GAMMA_DIST returns the #NUM! error value.

  • The equation for the gamma probability density function is: The standard gamma probability density function is:

  • When alpha = 1, GAMMA_DIST returns the exponential distribution with:

  • For a positive integer n, when alpha = n/2, beta = 2, and cumulative = TRUE, GAMMA_DIST returns (1 - CHIDIST(x)) with n degrees of freedom.

  • When alpha is a positive integer, GAMMA_DIST is also known as the Erlang distribution.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Gamma_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Gamma_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the gamma cumulative distribution. If p = GAMMA_DIST(x,...), then GAMMA_INV(p,...) = x.

Version Information

Version Added: Excel 2010

Syntax

expression .Gamma_Inv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - the probability associated with the gamma distribution.
Arg2 | Required | Double | Alpha - a parameter to the distribution.
Arg3 | Required | Double | Beta - a parameter to the distribution. If beta = 1, GAMMA_INV returns the standard gamma distribution.

Return Value

Double

Remarks

You can use this function to study a variable whose distribution may be skewed:

  • If any argument is text, GAMMA_INV returns the #VALUE! error value.

  • If probability < 0 or probability > 1, GAMMA_INV returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, GAMMA_INV returns the #NUM! error value.

Given a value for probability, GAMMA_INV seeks that value x such that GAMMA_DIST(x, alpha, beta, TRUE) = probability. Thus, precision of GAMMA_INV depends on precision of GAMMA_DIST. GAMMA_INV uses an iterative search technique. If the search has not converged after 100 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GammaDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GammaDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Gamma_Dist method.

Syntax

expression .GammaDist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which you want to evaluate the distribution.
Arg2 | Required | Double | Alpha - a parameter to the distribution.
Arg3 | Required | Double | Beta - a parameter to the distribution. If beta = 1, GAMMADIST returns the standard gamma distribution.
Arg4 | Required | Boolean | Cumulative - a logical value that determines the form of the function. If cumulative is TRUE, GAMMADIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If x, alpha, or beta is nonnumeric, GAMMADIST returns the #VALUE! error value.

  • If x < 0, GAMMADIST returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, GAMMADIST returns the #NUM! error value.

  • The equation for the gamma probability density function is: The standard gamma probability density function is:

  • When alpha = 1, GAMMADIST returns the exponential distribution with:

  • For a positive integer n, when alpha = n/2, beta = 2, and cumulative = TRUE, GAMMADIST returns (1 - CHIDIST(x)) with n degrees of freedom.

  • When alpha is a positive integer, GAMMADIST is also known as the Erlang distribution.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GammaInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GammaInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the gamma cumulative distribution. If p = GAMMADIST(x,...), then GAMMAINV(p,...) = x.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Gamma_Inv method.

Syntax

expression .GammaInv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - the probability associated with the gamma distribution.
Arg2 | Required | Double | Alpha - a parameter to the distribution.
Arg3 | Required | Double | Beta - a parameter to the distribution. If beta = 1, GAMMAINV returns the standard gamma distribution.

Return Value

Double

Remarks

You can use this function to study a variable whose distribution may be skewed.

  • If any argument is text, GAMMAINV returns the #VALUE! error value.

  • If probability < 0 or probability > 1, GAMMAINV returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, GAMMAINV returns the #NUM! error value.

Given a value for probability, GAMMAINV seeks that value x such that GAMMADIST(x, alpha, beta, TRUE) = probability. Thus, precision of GAMMAINV depends on precision of GAMMADIST. GAMMAINV uses an iterative search technique. If the search has not converged after 64 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GammaLn Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GammaLn Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the natural logarithm of the gamma function, Γ(x).

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the GammaLn_Precise method.

Syntax

expression .GammaLn(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value for which you want to calculate GAMMALN.

Return Value

Double

Remarks

  • If x is nonnumeric, GAMMALN returns the #VALUE! error value.

  • If x ≤ 0, GAMMALN returns the #NUM! error value.

  • The number e raised to the GAMMALN(i) power, where i is an integer, returns the same result as (i - 1)!.

  • GAMMALN is calculated as follows: where:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GammaLn_Precise Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GammaLn_Precise Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the natural logarithm of the gamma function, Γ(x).

Version Information

Version Added: Excel 2010

Syntax

expression .GammaLn_Precise(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value for which you want to calculate GAMMALN.

Return Value

Double

Remarks

  • If x is nonnumeric, the GammaLn_Precise method generates an error.

  • If x ≤ 0, the GammaLn_Precise method generates an error.

  • The number e raised to the GAMMALN(i) power, where i is an integer, returns the same result as (i - 1)!.

  • GAMMALN is calculated as follows: where:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Gauss Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Gauss Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns 0.5 less than the standard normal cumulative distribution.

Version information

Version Added: Excel 2013

Syntax

expression .Gauss(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | The value for which you want the distribution.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Gcd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Gcd Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the greatest common divisor of two or more integers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

Syntax

expression .Gcd(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 29 values. If any value is not an integer, it is truncated.

Return Value

Double

Remarks

  • If any argument is nonnumeric, GCD returns the #VALUE! error value.

  • If any argument is less than zero, GCD returns the #NUM! error value.

  • One divides any value evenly.

  • A prime number has only itself and one as even divisors.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GeoMean Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GeoMean Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the geometric mean of an array or range of positive data. For example, you can use GEOMEAN to calculate average growth rate given compound interest with variable rates.

Syntax

expression .GeoMean(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want to calculate the mean. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If any data point ≤ 0, GEOMEAN returns the #NUM! error value.

  • The equation for the geometric mean is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.GeStep Method (Excel)

 Copy code hover
[image]

WorksheetFunction.GeStep Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns 1 if number ≥ step; returns 0 (zero) otherwise. Use this function to filter a set of values. For example, by summing several GESTEP functions you calculate the count of values that exceed a threshold.

Syntax

expression .GeStep(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the value to test against step.
Arg2 | Optional | Variant | Step - the threshold value. If you omit a value for step, GESTEP uses zero.

Return Value

Double

Remarks

If any argument is nonnumeric, GESTEP returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Growth Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Growth Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates predicted exponential growth by using existing data. GROWTH returns the y-values for a series of new x-values that you specify by using existing x-values and y-values. You can also use the GROWTH worksheet function to fit an exponential curve to existing x-values and y-values.

Syntax

expression .Growth(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - the set of y-values you already know in the relationship y = b*m^x.
Arg2 | Optional | Variant | Known_x's - an optional set of x-values that you may already know in the relationship y = b*m^x.
Arg3 | Optional | Variant | New_x's - new x-values for which you want GROWTH to return corresponding y-values.
Arg4 | Optional | Variant | Const - a logical value specifying whether to force the constant b to equal 1.

Return Value

Variant

Remarks

  • If the array known_y's is in a single column, then each column of known_x's is interpreted as a separate variable.

  • If the array known_y's is in a single row, then each row of known_x's is interpreted as a separate variable.

  • If any of the numbers in known_y's is 0 or negative, GROWTH returns the #NUM! error value.

  • The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a vector (that is, a range with a height of one row or a width of one column).

  • If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

  • New_x's must include a column (or row) for each independent variable, just as known_x's does. So, if known_y's is in a single column, known_x's and new_x's must have the same number of columns. If known_y's is in a single row, known_x's and new_x's must have the same number of rows.

  • If new_x's is omitted, it is assumed to be the same as known_x's.

  • If both known_x's and new_x's are omitted, they are assumed to be the array {1,2,3,...} that is the same size as known_y's.

  • If const is TRUE or omitted, b is calculated normally.

  • If const is FALSE, b is set equal to 1 and the m-values are adjusted so that y = m^x.

  • Formulas that return arrays must be entered as array formulas after selecting the correct number of cells.

  • When entering an array constant for an argument such as known_x's, use commas to separate values in the same row and semicolons to separate rows.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.HarMean Method (Excel)

 Copy code hover
[image]

WorksheetFunction.HarMean Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals.

Syntax

expression .HarMean(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want to calculate the mean. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • The harmonic mean is always less than the geometric mean, which is always less than the arithmetic mean.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If any data point ≤ 0, HARMEAN returns the #NUM! error value.

  • The equation for the harmonic mean is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Hex2Bin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Hex2Bin Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a hexadecimal number to binary.

Syntax

expression .Hex2Bin(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the hexadecimal number you want to convert. Number cannot contain more than 10 characters. The most significant bit of number is the sign bit (40th bit from the right). The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, HEX2BIN uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is negative, HEX2BIN ignores places and returns a 10-character binary number.

  • If number is negative, it cannot be less than FFFFFFFE00, and if number is positive, it cannot be greater than 1FF.

  • If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value.

  • If HEX2BIN requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, HEX2BIN returns the #VALUE! error value.

  • If places is negative, HEX2BIN returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Hex2Dec Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Hex2Dec Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a hexadecimal number to decimal.

Syntax

expression .Hex2Dec(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the hexadecimal number you want to convert. Number cannot contain more than 10 characters (40 bits). The most significant bit of number is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation.

Return Value

String

Remarks

If number is not a valid hexadecimal number, HEX2DEC returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Hex2Oct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Hex2Oct Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a hexadecimal number to octal.

Syntax

expression .Hex2Oct(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the hexadecimal number you want to convert. Number cannot contain more than 10 characters. The most significant bit of number is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, HEX2OCT uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is negative, HEX2OCT ignores places and returns a 10-character octal number.

  • If number is negative, it cannot be less than FFE0000000, and if number is positive, it cannot be greater than 1FFFFFFF.

  • If number is not a valid hexadecimal number, HEX2OCT returns the #NUM! error value.

  • If HEX2OCT requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, HEX2OCT returns the #VALUE! error value.

  • If places is negative, HEX2OCT returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.HLookup Method (Excel)

 Copy code hover
[image]

WorksheetFunction.HLookup Method (Excel)
See also Send feedback

Published: July 16, 2012

Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find.

Syntax

expression .HLookup(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lookup_value - the value to be found in the first row of the table. Lookup_value can be a value, a reference, or a text string.
Arg2 | Required | Variant | Table_array - a table of information in which data is looked up. Use a reference to a range or a range name.
Arg3 | Required | Variant | Row_index_num - the row number in table_array from which the matching value will be returned. A row_index_num of 1 returns the first row value in table_array, a row_index_num of 2 returns the second row value in table_array, and so on. If row_index_num is less than 1, HLOOKUP returns the #VALUE! error value; if row_index_num is greater than the number of rows on table_array, HLOOKUP returns the #REF! error value.
Arg4 | Optional | Variant | Range_lookup - a logical value that specifies whether you want HLOOKUP to find an exact match or an approximate match. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, HLOOKUP will find an exact match. If one is not found, the error value #N/A is returned.

Return Value

Variant

Remarks

  • If HLOOKUP can't find lookup_value, and range_lookup is TRUE, it uses the largest value that is less than lookup_value.

  • If lookup_value is smaller than the smallest value in the first row of table_array, HLOOKUP returns the #N/A error value.

  • If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.HypGeom_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.HypGeom_Dist Method (Excel)
See also Send feedback

Returns the hypergeometric distribution. HYPGEOM_DIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOM_DIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.

Version Information

Version Added: Excel 2010

Syntax

expression .HypGeom_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Sample_s - the number of successes in the sample.
Arg2 | Required | Double | Number_sample - the size of the sample.
Arg3 | Required | Double | Population_s - the number of successes in the population.
Arg4 | Required | Double | Number_population - the population size.
Arg5 | Optional | Variant | Cumulative - a logical value that determines the form of the function. If cumulative is TRUE, then HYPGEOM_DIST returns the cumulative distribution function; if FALSE, it returns the probability mass function.

Return Value

Double

Remarks

  • All arguments are truncated to integers.

  • If any argument is nonnumeric, HYPGEOM_DIST returns the #VALUE! error value.

  • If sample_s < 0 or sample_s is greater than the lesser of number_sample or population_s, HYPGEOM_DIST returns the #NUM! error value.

  • If sample_s is less than the larger of 0 or (number_sample - number_population + population_s), HYPGEOM_DIST returns the #NUM! error value.

  • If number_sample ≤ 0 or number_sample > number_population, HYPGEOM_DIST returns the #NUM! error value.

  • If population_s ≤ 0 or population_s > number_population, HYPGEOM_DIST returns the #NUM! error value.

  • If number_population ≤ 0, HYPGEOM_DIST returns the #NUM! error value.

  • The equation for the hypergeometric distribution is: where: x = sample_s n = number_sample M = population_s N = number_population HYPGEOM_DIST is used in sampling without replacement from a finite population.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.HypGeomDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.HypGeomDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOMDIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the HypGeom_Dist method.

Syntax

expression .HypGeomDist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Sample_s - the number of successes in the sample.
Arg2 | Required | Double | Number_sample - the size of the sample.
Arg3 | Required | Double | Population_s - the number of successes in the population.
Arg4 | Required | Double | Number_population - the population size.

Return Value

Double

Remarks

  • All arguments are truncated to integers.

  • If any argument is nonnumeric, HYPGEOMDIST returns the #VALUE! error value.

  • If sample_s < 0 or sample_s is greater than the lesser of number_sample or population_s, HYPGEOMDIST returns the #NUM! error value.

  • If sample_s is less than the larger of 0 or (number_sample - number_population + population_s), HYPGEOMDIST returns the #NUM! error value.

  • If number_sample ≤ 0 or number_sample > number_population, HYPGEOMDIST returns the #NUM! error value.

  • If population_s ≤ 0 or population_s > number_population, HYPGEOMDIST returns the #NUM! error value.

  • If number_population ≤ 0, HYPGEOMDIST returns the #NUM! error value.

  • The equation for the hypergeometric distribution is: where: x = sample_s n = number_sample M = population_s N = number_population HYPGEOMDIST is used in sampling without replacement from a finite population.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IfError Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IfError Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula.

Syntax

expression .IfError(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the argument that is checked for an error.
Arg2 | Required | Variant | Value_if_error - the value to return if the formula evaluates to an error. The following error types are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.

Return Value

Variant

Remarks

  • If value or value_if_error is an empty cell, IFERROR treats it as an empty string value ("").

  • If value is an array formula, IFERROR returns an array of results for each cell in the range specified in value. See the second example below.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IfNa Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IfNa Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression.

Version information

Version Added: Excel 2013

Syntax

expression .IfNa(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | VARIANT | value: Any value or expression or reference.
Arg2 | Required | VARIANT | value_if_na: Any value or expression or reference.

Return value

VARIANT

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImAbs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImAbs Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.

Syntax

expression .ImAbs(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the absolute value.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The absolute value of a complex number is: where: z = x + yi

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Imaginary Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Imaginary Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the imaginary coefficient of a complex number in x + yi or x + yj text format.

Syntax

expression .Imaginary(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the imaginary coefficient.

Return Value

Double

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImArgument Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImArgument Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the argument [image] (theta), an angle expressed in radians, such that:

Syntax

expression .ImArgument(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber is a complex number for which you want the argument theta.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • IMARGUMENT is calculated as follows: where: and z = x + yi

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImConjugate Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImConjugate Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the complex conjugate of a complex number in x + yi or x + yj text format.

Syntax

expression .ImConjugate(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the conjugate.

Return Value

String

Remarks

  • 2Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The conjugate of a complex number is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImCos Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImCos Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cosine of a complex number in x + yi or x + yj text format.

Syntax

expression .ImCos(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the cosine.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • If inumber is a logical value, IMCOS returns the #VALUE! error value.

  • The cosine of a complex number is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImCosh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImCosh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic cosine of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImCosh(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the hyperbolic cosine.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImCot Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImCot Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cotangent of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImCot(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the cotangent.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImCsc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImCsc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cosecant of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImCsc(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the cosecant.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImCsch Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImCsch Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic cosecant of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImCsch(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the hyperbolic cosecant.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImDiv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImDiv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the quotient of two complex numbers in x + yi or x + yj text format.

Syntax

expression .ImDiv(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber1 - the complex numerator or dividend.
Arg2 | Required | Variant | Inumber2 - the complex denominator or divisor.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The quotient of two complex numbers is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImExp Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImExp Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the exponential of a complex number in x + yi or x + yj text format.

Syntax

expression .ImExp(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the exponential.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The exponential of a complex number is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImLn Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImLn Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the natural logarithm of a complex number in x + yi or x + yj text format.

Syntax

expression .ImLn(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the natural logarithm.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The natural logarithm of a complex number is: where:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImLog10 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImLog10 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.

Syntax

expression .ImLog10(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the common logarithm.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The common logarithm of a complex number can be calculated from the natural logarithm as follows:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImLog2 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImLog2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.

Syntax

expression .ImLog2(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the base-2 logarithm.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The base-2 logarithm of a complex number can be calculated from the natural logarithm as follows:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImPower Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImPower Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a complex number in x + yi or x + yj text format raised to a power.

Syntax

expression .ImPower(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number you want to raise to a power.
Arg2 | Required | Variant | Number - the power to which you want to raise the complex number.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • If number is nonnumeric, IMPOWER returns the #VALUE! error value.

  • Number can be an integer, fractional, or negative.

  • A complex number raised to a power is calculated as follows: where: and: and:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImProduct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImProduct Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the product of 2 to 29 complex numbers in x + yi or x + yj text format.

Syntax

expression .ImProduct(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Inumber1, inumber2,… - 1 to 29 complex numbers to multiply.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The product of two complex numbers is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImReal Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImReal Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the real coefficient of a complex number in x + yi or x + yj text format.

Syntax

expression .ImReal(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the real coefficient.

Return Value

Double

Remarks

Use COMPLEX to convert real and imaginary coefficients into a complex number.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSec Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSec Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic cosecant of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImSec(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the hyperbolic cosecant.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSech Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSech Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the secant of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImSech(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the hyperbolic secant.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSin Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sine of a complex number in x + yi or x + yj text format.

Syntax

expression .ImSin(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the sine.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The sine of a complex number is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSinh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSinh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic sine of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImSinh(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the hyperbolic sine.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSqrt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSqrt Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the square root of a complex number in x + yi or x + yj text format.

Syntax

expression .ImSqrt(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber - a complex number for which you want the square root.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The square root of a complex number is: where: and: and:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSub Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSub Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the difference of two complex numbers in x + yi or x + yj text format.

Syntax

expression .ImSub(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Inumber1 - the complex number from which to subtract inumber2.
Arg2 | Required | Variant | Inumber2 - the complex number to subtract from inumber1.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The difference of two complex numbers is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImSum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImSum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of two or more complex numbers in x + yi or x + yj text format.

Syntax

expression .ImSum(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Inumber1,inumber2,... - 1 to 29 complex numbers to add.

Return Value

String

Remarks

  • Use COMPLEX to convert real and imaginary coefficients into a complex number.

  • The sum of two complex numbers is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ImTan Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ImTan Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the tangent of a complex number.

Version information

Version Added: Excel 2013

Syntax

expression .ImTan(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Complex number for which you want the tangent.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Index Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Index Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value or the reference to a value from within a table or range. There are two forms of the INDEX function: the array form and the reference form.

Syntax

expression .Index(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array or Reference - a range of cells or an array constant. For references, it is the reference to one or more cell ranges.
Arg2 | Required | Double | Row_num - selects the row in array from which to return a value. If row_num is omitted, column_num is required. For references, the number of the row in reference from which to return a reference
Arg3 | Optional | Variant | Column_num - selects the column in array from which to return a value. If column_num is omitted, row_num is required. For reference, the number of the column in reference from which to return a reference.
Arg4 | Optional | Variant | Area_num - only used when returning references. Selects a range in reference from which to return the intersection of row_num and column_num. The first area selected or entered is numbered 1, the second is 2, and so on. If area_num is omitted, INDEX uses area 1.

Return Value

Variant

Remarks

Array form

Returns the value of an element in a table or an array, selected by the row and column number indexes.

Use the array form if the first argument to INDEX is an array constant.

  • If both the row_num and column_num arguments are used, INDEX returns the value in the cell at the intersection of row_num and column_num.

  • If you set row_num or column_num to 0 (zero), INDEX returns the array of values for the entire column or row, respectively. To use values returned as an array, enter the INDEX function as an array formula in a horizontal range of cells for a row, and in a vertical range of cells for a column. To enter an array formula, press CTRL+SHIFT+ENTER.

  • Row_num and column_num must point to a cell within array; otherwise, INDEX returns the #REF! error value.

Reference form

Returns the reference of the cell at the intersection of a particular row and column. If the reference is made up of nonadjacent selections, you can pick the selection to look in. If each area in reference contains only one row or column, the row_num or column_num argument, respectively, is optional. For example, for a single row reference, use INDEX(reference,,column_num).

  • After reference and area_num have selected a particular range, row_num and column_num select a particular cell: row_num 1 is the first row in the range, column_num 1 is the first column, and so on. The reference returned by INDEX is the intersection of row_num and column_num.

  • If you set row_num or column_num to 0 (zero), INDEX returns the reference for the entire column or row, respectively.

  • Row_num, column_num, and area_num must point to a cell within reference; otherwise, INDEX returns the #REF! error value. If row_num and column_num are omitted, INDEX returns the area in reference specified by area_num.

  • The result of the INDEX function is a reference and is interpreted as such by other formulas. Depending on the formula, the return value of INDEX may be used as a reference or as a value. For example, the formula CELL("width",INDEX(A1:B2,1,2)) is equivalent to CELL("width",B1). The CELL function uses the return value of INDEX as a cell reference. On the other hand, a formula such as 2*INDEX(A1:B2,1,2) translates the return value of INDEX into the number in cell B1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Intercept Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Intercept Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. The intercept point is based on a best-fit regression line plotted through the known x-values and known y-values. Use the INTERCEPT function when you want to determine the value of the dependent variable when the independent variable is 0 (zero). For example, you can use the INTERCEPT function to predict a metal's electrical resistance at 0°C when your data points were taken at room temperature and higher.

Syntax

expression .Intercept(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - the dependent set of observations or data.
Arg2 | Required | Variant | Known_x's - the independent set of observations or data.

Return Value

Double

Remarks

  • The arguments should be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If known_y's and known_x's contain a different number of data points or contain no data points, INTERCEPT returns the #N/A error value.

  • The equation for the intercept of the regression line, a, is: where the slope, b, is calculated as: and where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known_y's).

  • The underlying algorithm used in the INTERCEPT and SLOPE functions is different than the underlying algorithm used in the LINEST function. The difference between these algorithms can lead to different results when data is undetermined and collinear. For example, if the data points of the known_y's argument are 0 and the data points of the known_x's argument are 1:

    • INTERCEPT and SLOPE return a #DIV/0! error. The INTERCEPT and SLOPE algorithm is designed to look for one and only one answer, and in this case there can be more than one answer.

    • LINEST returns a value of 0. The LINEST algorithm is designed to return reasonable results for collinear data, and in this case at least one answer can be found.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IntRate Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IntRate Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the interest rate for a fully invested security.

Syntax

expression .IntRate(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Investment - the amount invested in the security.
Arg4 | Required | Variant | Redemption - the amount to be received at maturity.
Arg5 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, INTRATE returns the #VALUE! error value.

  • If investment ≤ 0 or if redemption ≤ 0, INTRATE returns the #NUM! error value.

  • If basis < 0 or if basis > 4, INTRATE returns the #NUM! error value.

  • If settlement ≥ maturity, INTRATE returns the #NUM! error value.

  • INTRATE is calculated as follows: where: B = number of days in a year, depending on the year basis. DIM = number of days from settlement to maturity.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ipmt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ipmt Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.

Syntax

expression .Ipmt(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate per period.
Arg2 | Required | Double | Per - the period for which you want to find the interest and must be in the range 1 to nper.
Arg3 | Required | Double | Nper - the total number of payment periods in an annuity.
Arg4 | Required | Double | Pv - the present value, or the lump-sum amount that a series of future payments is worth right now.
Arg5 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Arg6 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0.

Return Value

Double

Remarks

Set type equal to | If payments are due
0 | At the end of the period
1 | At the beginning of the period

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.

  • For all the arguments, cash you pay out, such as deposits to savings, is represented by negative numbers; cash you receive, such as dividend checks, is represented by positive numbers.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Irr Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Irr Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the internal rate of return for a series of cash flows represented by the numbers in values. These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods.

Syntax

expression .Irr(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Values - an array or a reference to cells that contain numbers for which you want to calculate the internal rate of return.
Arg2 | Optional | Variant | Guess - a number that you guess is close to the result of IRR.

Return Value

Double

Remarks

  • Values must contain at least one positive value and one negative value to calculate the internal rate of return.

  • IRR uses the order of values to interpret the order of cash flows. Be sure to enter your payment and income values in the sequence you want.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored.

  • Microsoft Excel uses an iterative technique for calculating IRR. Starting with guess, IRR cycles through the calculation until the result is accurate within 0.00001 percent. If IRR can't find a result that works after 20 tries, the #NUM! error value is returned.

  • In most cases you do not need to provide guess for the IRR calculation. If guess is omitted, it is assumed to be 0.1 (10 percent).

  • If IRR gives the #NUM! error value, or if the result is not close to what you expected, try again with a different value for guess.

IRR is closely related to NPV, the net present value function. The rate of return calculated by IRR is the interest rate corresponding to a 0 (zero) net present value. The following formula demonstrates how NPV and IRR are related:

NPV(IRR(B1:B6),B1:B6) equals 3.60E-08 [Within the accuracy of the IRR calculation, the value 3.60E-08 is effectively 0 (zero).]

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsErr Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsErr Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value except #N/A.

Syntax

expression .IsErr(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsError Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsError Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!).

Syntax

expression .IsError(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsEven Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsEven Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value is even.

Syntax

expression .IsEven(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsFormula Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsFormula Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks whether a reference is to a cell containing a formula, and returns TRUE or FALSE.

Version information

Version Added: Excel 2013

Syntax

expression .IsFormula(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | RANGE | Reference to the cell you want to test. Reference can be a cell reference, a formula, or name that refers to a cell.

Return value

BOOL

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsLogical Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsLogical Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to a logical value.

Syntax

expression .IsLogical(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsNA Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsNA Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to the #N/A (value not available) error value.

Syntax

expression .IsNA(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsNonText Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsNonText Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to any item that is not text. (Note that this function returns TRUE if value refers to a blank cell.)

Syntax

expression .IsNonText(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsNumber Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsNumber Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to a number.

Syntax

expression .IsNumber(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ISO_Ceiling Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ISO_Ceiling Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance.

Version Information

Version Added: Excel 2010

Syntax

expression .ISO_Ceiling(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Double

Number - The value to be rounded.

Arg2

Optional

Variant

Significance - The optional multiple to which number is to be rounded. If significance is omitted, its default value is 1.

Note Note

The absolute value of the multiple is used, so that the ISO_CEILING function returns the mathematical ceiling irrespective of the signs of number and significance.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsOdd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsOdd Method (Excel)
See also Send feedback

Checks the type of value and returns TRUE or FALSE depending if the value is odd.

Syntax

expression .IsOdd(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsoWeekNum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsoWeekNum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ISO week number of the year for a given date. .

Version information

Version Added: Excel 2013

Syntax

expression .IsoWeekNum(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Date-time code used by Microsoft Excel for date and time calculation.
Arg2 | Optional | VARIANT | This argument is not available in the function.

Return value

DOUBLE

Remarks

Returns the ordinal number of the [ISO8601] calendar week in the year for the given date. ISO 8601 defines the calendar week as a time interval of seven calendar days starting with a Monday, and the first calendar week of a year as the one that includes the first Thursday of that year.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ispmt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ispmt Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the interest paid during a specific period of an investment. This function is provided for compatibility with Lotus 1-2-3.

Syntax

expression .Ispmt(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate for the investment.
Arg2 | Required | Double | Per - the period for which you want to find the interest, and must be between 1 and nper.
Arg3 | Required | Double | Nper - the total number of payment periods for the investment.
Arg4 | Required | Double | Pv - the present value of the investment. For a loan, pv is the loan amount.

Return Value

Double

Remarks

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.

  • For all the arguments, the cash you pay out, such as deposits to savings or other withdrawals, is represented by negative numbers; the cash you receive, such as dividend checks and other deposits, is represented by positive numbers.

  • For additional information about financial functions, see the PV function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.IsText Method (Excel)

 Copy code hover
[image]

WorksheetFunction.IsText Method (Excel)
See also Send feedback

Published: July 16, 2012

Checks the type of value and returns TRUE or FALSE depending if the value refers to text.

Syntax

expression .IsText(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Value - the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return Value

Boolean

Remarks

  • The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula ISNUMBER("19"), "19" is not converted from a text value, and the ISNUMBER function returns FALSE.

  • The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas (see the following examples).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Kurt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Kurt Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution.

Syntax

expression .Kurt(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want to calculate kurtosis. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If there are fewer than four data points, or if the standard deviation of the sample equals zero, KURT returns the #DIV/0! error value.

  • Kurtosis is defined as: where s is the sample standard deviation.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Large Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Large Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the k-th largest value in a data set. You can use this function to select a value based on its relative standing. For example, you can use LARGE to return the highest, runner-up, or third-place score.

Syntax

expression .Large(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or range of data for which you want to determine the k-th largest value.
Arg2 | Required | Double | K - the position (from the largest) in the array or cell range of data to return.

Return Value

Double

Remarks

  • If array is empty, LARGE returns the #NUM! error value.

  • If k ≤ 0 or if k is greater than the number of data points, LARGE returns the #NUM! error value.

If n is the number of data points in a range, then LARGE(array,1) returns the largest value, and LARGE(array,n) returns the smallest value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Lcm Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Lcm Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.

Syntax

expression .Lcm(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number1, number2,... - 1 to 29 values for which you want the least common multiple. If value is not an integer, it is truncated.

Return Value

Double

Remarks

  • If any argument is nonnumeric, LCM returns the #VALUE! error value.

  • If any argument is less than zero, LCM returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LinEst Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LinEst Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, and returns an array that describes the line. Because this function returns an array of values, it must be entered as an array formula.

Syntax

expression .LinEst(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - the set of y-values you already know in the relationship y = mx + b.
Arg2 | Optional | Variant | Known_x's - an optional set of x-values that you may already know in the relationship y = mx + b.
Arg3 | Optional | Variant | Const - a logical value specifying whether to force the constant b to equal 0.
Arg4 | Optional | Variant | Stats - a logical value specifying whether to return additional regression statistics.

Return Value

Variant

Remarks

The equation for the line is:

y = mx + b or

y = m1x1 + m2x2 + ... + b (if there are multiple ranges of x-values)

where the dependent y-value is a function of the independent x-values. The m-values are coefficients corresponding to each x-value, and b is a constant value. Note that y, x, and m can be vectors. The array that LINEST returns is {mn,mn-1,...,m1,b}. LINEST can also return additional regression statistics.

  • If the array known_y's is in a single column, then each column of known_x's is interpreted as a separate variable.

  • If the array known_y's is in a single row, then each row of known_x's is interpreted as a separate variable.

  • The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a vector (that is, a range with a height of one row or a width of one column).

  • If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

  • If const is TRUE or omitted, b is calculated normally.

  • If const is FALSE, b is set equal to 0 and the m-values are adjusted to fit y = mx.

  • If stats is TRUE, LINEST returns the additional regression statistics, so the returned array is {mn,mn-1,...,m1,b;sen,sen-1,...,se1,seb;r2,sey;F,df;ssreg,ssresid}.

  • If stats is FALSE or omitted, LINEST returns only the m-coefficients and the constant b.

The additional regression statistics are as follows.

Statistic | Description
se1,se2,...,sen | The standard error values for the coefficients m1,m2,...,mn.
seb | The standard error value for the constant b (seb = #N/A when const is FALSE).
r2 | The coefficient of determination. Compares estimated and actual y-values, and ranges in value from 0 to 1. If it is 1, there is a perfect correlation in the sample — there is no difference between the estimated y-value and the actual y-value. At the other extreme, if the coefficient of determination is 0, the regression equation is not helpful in predicting a y-value. For information about how r2 is calculated, see "Remarks" later in this topic.
sey | The standard error for the y estimate.
F | The F statistic, or the F-observed value. Use the F statistic to determine whether the observed relationship between the dependent and independent variables occurs by chance.
df | The degrees of freedom. Use the degrees of freedom to help you find F-critical values in a statistical table. Compare the values you find in the table to the F statistic returned by LINEST to determine a confidence level for the model.
ssreg | The regression sum of squares.
ssresid | The residual sum of squares. For information about how ssreg and ssresid are calculated, see "Remarks" later in this topic.

The following illustration shows the order in which the additional regression statistics are returned.

  • You can describe any straight line with the slope and the y-intercept: Slope (m):
    To find the slope of a line, often written as m, take two points on the line, (x1,y1) and (x2,y2); the slope is equal to (y2 - y1)/(x2 - x1). Y-intercept (b):
    The y-intercept of a line, often written as b, is the value of y at the point where the line crosses the y-axis. The equation of a straight line is y = mx + b. Once you know the values of m and b, you can calculate any point on the line by plugging the y- or x-value into that equation. You can also use the TREND function.

  • When you have only one independent x-variable, you can obtain the slope and y-intercept values directly by using the following formulas: Slope:
    =INDEX(LINEST(known_y's,known_x's),1) Y-intercept:
    =INDEX(LINEST(known_y's,known_x's),2)

  • The accuracy of the line calculated by LINEST depends on the degree of scatter in your data. The more linear the data, the more accurate the LINEST model. LINEST uses the method of least squares for determining the best fit for the data. When you have only one independent x-variable, the calculations for m and b are based on the following formulas: where x and y are sample means, i.e., x = AVERAGE(known x's) and y = AVERAGE(known_y's).

  • The line- and curve-fitting functions LINEST and LOGEST can calculate the best straight line or exponential curve that fits your data. However, you have to decide which of the two results best fits your data. You can calculate TREND(known_y's,known_x's) for a straight line, or GROWTH(known_y's, known_x's) for an exponential curve. These functions, without the new_x's argument, return an array of y-values predicted along that line or curve at your actual data points. You can then compare the predicted values with the actual values. You may want to chart them both for a visual comparison.

  • In regression analysis, Microsoft Excel calculates for each point the squared difference between the y-value estimated for that point and its actual y-value. The sum of these squared differences is called the residual sum of squares, ssresid. Microsoft Excel then calculates the total sum of squares, sstotal. When const = TRUE, or omitted, the total sum of squares is the sum of the squared differences between the actual y-values and the average of the y-values. When const = FALSE, the total sum of squares is the sum of the squares of the actual y-values (without subtracting the average y-value from each individual y-value). Then regression sum of squares, ssreg, can be found from: ssreg = sstotal - ssresid. The smaller the residual sum of squares is, compared with the total sum of squares, the larger the value of the coefficient of determination, r2, which is an indicator of how well the equation resulting from the regression analysis explains the relationship among the variables. r2 equals ssreg/sstotal.

  • In some cases, one or more of the X columns (assume that Y's and X's are in columns) may have no additional predictive value in the presence of the other X columns. In other words, eliminating one or more X columns might lead to predicted Y values that are equally accurate. In that case these redundant X columns should be omitted from the regression model. This phenomenon is called "collinearity" because any redundant X column can be expressed as a sum of multiples of the non-redundant X columns. LINEST checks for collinearity and removes any redundant X columns from the regression model when it identifies them. Removed X columns can be recognized in LINEST output as having 0 coefficients as well as 0 se's. If one or more columns are removed as redundant, then df is affected because df depends on the number of X columns actually used for predictive purposes. If df is changed because redundant X columns are removed, values of sey and F are also affected. Collinearity should be relatively rare in practice. However, one case where it is more likely to arise is when some X columns contain only 0's and 1's as indicators of whether a subject in an experiment is or is not a member of a particular group. If const = TRUE or omitted, LINEST effectively inserts an additional X column of all 1's to model the intercept. If you have a column with a 1 for each subject if male, or 0 if not, and you also have a column with a 1 for each subject if female, or 0 if not, this latter column is redundant because entries in it can be obtained from subtracting the entry in the "male indicator" column from the entry in the additional column of all 1's added by LINEST.

  • df is calculated as follows when no X columns are removed from the model due to collinearity: if there are k columns of known_x's and const = TRUE or omitted, then df = n - k - 1. If const = FALSE, then df = n - k. In both cases, each X column removed due to collinearity increases df by 1.

  • Formulas that return arrays must be entered as array formulas.

  • When entering an array constant such as known_x's as an argument, use commas to separate values in the same row and semicolons to separate rows. Separator characters may be different depending on your locale setting in Regional and Language Options in Control Panel.

  • Note that the y-values predicted by the regression equation may not be valid if they are outside the range of the y-values you used to determine the equation.

  • The underlying algorithm used in the LINEST function is different than the underlying algorithm used in the SLOPE and INTERCEPT functions. The difference between these algorithms can lead to different results when data is undetermined and collinear. For example, if the data points of the known_y's argument are 0 and the data points of the known_x's argument are 1:

    • LINEST returns a value of 0. The LINEST algorithm is designed to return reasonable results for collinear data, and in this case at least one answer can be found.

    • SLOPE and INTERCEPT return a #DIV/0! error. The SLOPE and INTERCEPT algorithm is designed to look for one and only one answer, and in this case there can be more than one answer.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ln Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ln Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904).

Syntax

expression .Ln(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the positive real number for which you want the natural logarithm.

Return Value

Double

Remarks

LN is the inverse of the EXP function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Log Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Log Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the logarithm of a number to the base you specify.

Syntax

expression .Log(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the positive real number for which you want the logarithm.
Arg2 | Optional | Variant | Base - the base of the logarithm. If base is omitted, it is assumed to be 10.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Log10 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Log10 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the base-10 logarithm of a number.

Syntax

expression .Log10(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the positive real number for which you want the base-10 logarithm.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LogEst Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LogEst Method (Excel)
See also Send feedback

Published: July 16, 2012

In regression analysis, calculates an exponential curve that fits your data and returns an array of values that describes the curve. Because this function returns an array of values, it must be entered as an array formula.

Syntax

expression .LogEst(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - the set of y-values you already know in the relationship y = b*m^x.
Arg2 | Optional | Variant | Known_x's - an optional set of x-values that you may already know in the relationship y = b*m^x.
Arg3 | Optional | Variant | Const - a logical value specifying whether to force the constant b to equal 1.
Arg4 | Optional | Variant | Stats - a logical value specifying whether to return additional regression statistics.

Return Value

Variant

Remarks

The equation for the curve is:

y = b*m^x or

y = (b*(m1^x1)*(m2^x2)*_) (if there are multiple x-values)

where the dependent y-value is a function of the independent x-values. The m-values are bases corresponding to each exponent x-value, and b is a constant value. Note that y, x, and m can be vectors. The array that LOGEST returns is {mn,mn-1,...,m1,b}.

  • If the array known_y's is in a single column, then each column of known_x's is interpreted as a separate variable.

  • If the array known_y's is in a single row, then each row of known_x's is interpreted as a separate variable.

  • The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a range of cells with a height of one row or a width of one column (which is also known as a vector).

  • If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

    • If const is TRUE or omitted, b is calculated normally.

    • If const is FALSE, b is set equal to 1, and the m-values are fitted to y = m^x.

  • If stats is TRUE, LOGEST returns the additional regression statistics, so the returned array is {mn,mn-1,...,m1,b;sen,sen-1,...,se1,seb;r 2,sey; F,df;ssreg,ssresid}.

  • If stats is FALSE or omitted, LOGEST returns only the m-coefficients and the constant b.

For more information about additional regression statistics, see LINEST.

  • The more a plot of your data resembles an exponential curve, the better the calculated line will fit your data. Like LINEST, LOGEST returns an array of values that describes a relationship among the values, but LINEST fits a straight line to your data; LOGEST fits an exponential curve. For more information, see LINEST.

  • When you have only one independent x-variable, you can obtain y-intercept (b) values directly by using the following formula: Y-intercept (b):
    INDEX(LOGEST(known_y's,known_x's),2) You can use the y = b*m^x equation to predict future values of y, but Microsoft Excel provides the GROWTH function to do this for you. For more information, see GROWTH.

  • Formulas that return arrays must be entered as array formulas.

  • When entering an array constant such as known_x's as an argument, use commas to separate values in the same row and semicolons to separate rows. Separator characters may be different depending on your locale setting in Regional and Language Options in Control Panel.

  • You should note that the y-values predicted by the regression equation may not be valid if they are outside the range of y-values you used to determine the equation.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LogInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LogInv Method (Excel)
See also Send feedback

Use the lognormal distribution to analyze logarithmically transformed data.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the LogNorm_Inv method.

Syntax

expression .LogInv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - a probability associated with the lognormal distribution.
Arg2 | Required | Double | Mean - the mean of ln(x).
Arg3 | Required | Double | Standard_dev - the standard deviation of ln(x).

Return Value

Double

Remarks

  • If any argument is nonnumeric, LOGINV returns the #VALUE! error value.

  • If probability <= 0 or probability >= 1, LOGINV returns the #NUM! error value.

  • If standard_dev <= 0, LOGINV returns the #NUM! error value.

  • The inverse of the lognormal distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LogNorm_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LogNorm_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.

Version Information

Version Added: Excel 2010

Syntax

expression .LogNorm_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The value at which to evaluate the function.
Arg2 | Required | Double | Mean - The mean of ln(x).
Arg3 | Required | Double | Standard_dev - The standard deviation of ln(x).
Arg4 | Optional | Variant | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, LOGNORM_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If any argument is nonnumeric, LOGNORM_DIST returns the #VALUE! error value.

  • If x ≤ 0 or if standard_dev ≤ 0, LOGNORM_DIST returns the #NUM! error value.

  • The equation for the lognormal cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LogNorm_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LogNorm_Inv Method (Excel)
See also Send feedback

Returns the inverse of the lognormal cumulative distribution function. Use the lognormal distribution to analyze logarithmically transformed data.

Version Information

Version Added: Excel 2010

Syntax

expression .LogNorm_Inv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - A probability associated with the lognormal distribution.
Arg2 | Required | Double | Mean - The mean of ln(x).
Arg3 | Required | Double | Standard_dev - The standard deviation of ln(x).

Return Value

Double

Remarks

  • If any argument is nonnumeric, LOGNORM_INV returns the #VALUE! error value.

  • If probability <= 0 or probability >= 1, LOGNORM_INV returns the #NUM! error value.

  • If standard_dev <= 0, LOGNORM_INV returns the #NUM! error value.

  • The inverse of the lognormal distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.LogNormDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.LogNormDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the LogNorm_Dist method.

Syntax

expression .LogNormDist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which to evaluate the function.
Arg2 | Required | Double | Mean - the mean of ln(x).
Arg3 | Required | Double | Standard_dev - the standard deviation of ln(x).

Return Value

Double

Remarks

  • If any argument is nonnumeric, LOGNORMDIST returns the #VALUE! error value.

  • If x ≤ 0 or if standard_dev ≤ 0, LOGNORMDIST returns the #NUM! error value.

  • The equation for the lognormal cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Lookup Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Lookup Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a value either from a one-row or one-column range or from an array. The LOOKUP function has two syntax forms: the vector form and the array form.

Syntax

expression .Lookup(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lookup_value - A value that LOOKUP searches for in the first vector. Lookup_value can be a number, text, a logical value, or a name or reference that refers to a value.
Arg2 | Required | Variant | Lookup_vector or Array - In Vector form, a range that contains only one row or one column. The values in lookup_vector can be text, numbers, or logical values. In array form, a range of cells that contains text, numbers, or logical values that you want to compare with lookup_value.
Arg3 | Optional | Variant | Result_vector - Only used with the Vector form. A range that contains only one row or column. It must be the same size as lookup_vector.

Return Value

Variant

Remarks

If you want to | Then see | Usage
Look in a one-row or one-column range (known as a vector) for a value and return a value from the same position in a second one-row or one-column range | Vector form | Use the vector form when you have a large list of values to look up or when the values may change over time.
Look in the first row or column of an array for the specified value and return a value from the same position in the last row or column of the array | Array form | Use the array form when you have a small list of values and the values remain constant over time.

Vector form

A vector is a range of only one row or one column. The vector form of LOOKUP looks in a one-row or one-column range (known as a vector) for a value and returns a value from the same position in a second one-row or one-column range. Use this form of the LOOKUP function when you want to specify the range that contains the values that you want to match. The other form of LOOKUP automatically looks in the first column or row.

  • Important note Important

    The values in lookup_vector must be placed in ascending order: ...,-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise, LOOKUP may not give the correct value. Uppercase and lowercase text are equivalent.

  • If LOOKUP can't find the lookup_value, it matches the largest value in lookup_vector that is less than or equal to lookup_value.

  • If lookup_value is smaller than the smallest value in lookup_vector, LOOKUP gives the #N/A error value.

Array form

The array form of LOOKUP looks in the first row or column of an array for the specified value and returns a value from the same position in the last row or column of the array. Use this form of LOOKUP when the values that you want to match are in the first row or column of the array. Use the other form of LOOKUP when you want to specify the location of the column or row.

Tip In general, it's best to use the HLOOKUP or VLOOKUP function instead of the array form of LOOKUP. This form of LOOKUP is provided for compatibility with other spreadsheet programs.

  • If LOOKUP can't find the lookup_value, it uses the largest value in the array that is less than or equal to lookup_value.

  • If lookup_value is smaller than the smallest value in the first row or column (depending on the array dimensions), LOOKUP returns the #N/A error value.

The array form of LOOKUP is very similar to the HLOOKUP and VLOOKUP functions. The difference is that HLOOKUP searches for lookup_value in the first row, VLOOKUP searches in the first column, and LOOKUP searches according to the dimensions of array.

  • If array covers an area that is wider than it is tall (more columns than rows), LOOKUP searches for lookup_value in the first row.

  • If array is square or is taller than it is wide (more rows than columns), LOOKUP searches in the first column.

  • With HLOOKUP and VLOOKUP, you can index down or across, but LOOKUP always selects the last value in the row or column.

Important note Important

The values in array must be placed in ascending order: ...,-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise, LOOKUP may not give the correct value. Uppercase and lowercase text are equivalent.

Note Note

You can also use the LOOKUP function as an alternative the IF function for elaborate tests or tests for more than seven conditions. See the examples in the array form.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Match Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Match Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.

Syntax

expression .Match(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lookup_value - the value you use to find the value you want in a table.
Arg2 | Required | Variant | Lookup_array - a contiguous range of cells containing possible lookup values. Lookup_array must be an array or an array reference.
Arg3 | Optional | Variant | Match_type - the number -1, 0, or 1. Match_type specifies how Microsoft Excel matches lookup_value with values in lookup_array.

Return Value

Double

Remarks

  • Lookup_value is the value you want to match in lookup_array. For example, when you look up a number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want.

  • Lookup_value can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value.

  • If match_type is 1, MATCH finds the largest value that is less than or equal to lookup_value. Lookup_array must be placed in ascending order: ...-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE.

  • If match_type is 0, MATCH finds the first value that is exactly equal to lookup_value. Lookup_array can be in any order.

  • If match_type is -1, MATCH finds the smallest value that is greater than or equal to lookup_value. Lookup_array must be placed in descending order: TRUE, FALSE, Z-A, ...2, 1, 0, -1, -2, ..., and so on.

  • If match_type is omitted, it is assumed to be 1.

  • MATCH returns the position of the matched value within lookup_array, not the value itself. For example, MATCH("b",{"a","b","c"},0) returns 2, the relative position of "b" within the array {"a","b","c"}.

  • MATCH does not distinguish between uppercase and lowercase letters when matching text values.

  • If MATCH is unsuccessful in finding a match, it returns the #N/A error value.

  • If match_type is 0 and lookup_value is text, you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

Example

Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples | About the Contributor

For each value in the first column of the first worksheet, this example searches through the entire workbook for a matching value. If the macro finds a matching value, it sets the original value on the first worksheet to be bold.

VBA Copy code Copy code
Sub HighlightMatches()
    Application.ScreenUpdating = False

    'Declare variables
    Dim var As Variant, iSheet As Integer, iRow As Long, iRowL As Long, bln As Boolean

       'Set up the count as the number of filled rows in the first column of Sheet1.
       iRowL = Cells(Rows.Count, 1).End(xlUp).Row

       'Cycle through all the cells in that column:
       For iRow = 1 To iRowL
          'For every cell that is not empty, search through the first column in each worksheet in the
          'workbook for a value that matches that cell value.

          If Not IsEmpty(Cells(iRow, 1)) Then
             For iSheet = ActiveSheet.Index + 1 To Worksheets.Count
                bln = False
                var = Application.Match(Cells(iRow, 1).Value, Worksheets(iSheet).Columns(1), 0)

                'If you find a matching value, indicate success by setting bln to true and exit the loop;
                'otherwise, continue searching until you reach the end of the workbook.
                If Not IsError(var) Then
                   bln = True
                   Exit For
                End If
             Next iSheet
          End If

          'If you do not find a matching value, do not bold the value in the original list;
          'if you do find a value, bold it.
          If bln = False Then
             Cells(iRow, 1).Font.Bold = False
             Else
             Cells(iRow, 1).Font.Bold = True
          End If
       Next iRow
    Application.ScreenUpdating = True
End SubSub HighlightMatches()

Application.ScreenUpdating = False

'Declare variables
Dim var As Variant, iSheet As Integer, iRow As Long, iRowL As Long, bln As Boolean

   'Set up the count as the number of filled rows in the first column of Sheet1.
   iRowL = Cells(Rows.Count, 1).End(xlUp).Row

   'Cycle through all the cells in that column:
   For iRow = 1 To iRowL
      'For every cell that is not empty, search through all the columns in all the worksheets in the
      'workbook for a value that matches that cell value.
      If Not IsEmpty(Cells(iRow, 1)) Then
         For iSheet = ActiveSheet.Index + 1 To Worksheets.Count
            bln = False
            var = Application.Match(Cells(iRow, 1).Value, Worksheets(iSheet).Columns(1), 0)

            'If you find a matching value, indicate success by setting bln to true and exit the loop;
            'otherwise, continue searching until you reach the end of the workbook.
            If Not IsError(var) Then
               bln = True
               Exit For
            End If
         Next iSheet
      End If

      'If you do not find a matching value, do not bold the value in the original list;
      'if you do find a value, bold it.
      If bln = False Then
         Cells(iRow, 1).Font.Bold = False
         Else
         Cells(iRow, 1).Font.Bold = True
      End If
   Next iRow
Application.ScreenUpdating = True
End Sub

About the Contributor

Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Max Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Max Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the largest value in a set of values.

Syntax

expression .Max(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 numbers for which you want to find the maximum value.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are used. Empty cells, logical values, or text in the array or reference are ignored.

  • If the arguments contain no numbers, MAX returns 0 (zero).

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If you want to include logical values and text representations of numbers in a reference as part of the calculation, use the MAXA function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MDeterm Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MDeterm Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the matrix determinant of an array.

Syntax

expression .MDeterm(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - a numeric array with an equal number of rows and columns.

Return Value

Double

Remarks

  • Array can be given as a cell range, for example, A1:C3; as an array constant, such as {1,2,3;4,5,6;7,8,9}; or as a name to either of these.

  • MDTERM returns the #VALUE! error when:

    • Any cells in array are empty or contain text.

    • Array does not have an equal number of rows and columns.

    • The size of array exceeds 73 columns by 73 rows.

  • The matrix determinant is a number derived from the values in array. For a three-row, three-column array, A1:C3, the determinant is defined as: MDETERM(A1:C3) equals
    A1*(B2*C3-B3*C2) + A2*(B3*C1-B1*C3) + A3*(B1*C2-B2*C1)

  • Matrix determinants are generally used for solving systems of mathematical equations that involve several variables.

  • MDETERM is calculated with an accuracy of approximately 16 digits, which may lead to a small numeric error when the calculation is not complete. For example, the determinant of a singular matrix may differ from zero by 1E-16.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MDuration Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MDuration Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the modified Macauley duration for a security with an assumed par value of $100.

Syntax

expression .MDuration(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Coupon - the security's annual coupon rate.
Arg4 | Required | Variant | Yld - the security's annual yield.
Arg5 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg6 | Optional | Variant | Basis - the type of day count basis to use

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date is January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, frequency, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, MDURATION returns the #VALUE! error value.

  • If yld < 0 or if coupon < 0, MDURATION returns the #NUM! error value.

  • If frequency is any number other than 1, 2, or 4, MDURATION returns the #NUM! error value.

  • If basis < 0 or if basis > 4, MDURATION returns the #NUM! error value.

  • If settlement ≥ maturity, MDURATION returns the #NUM! error value.

  • Modified duration is defined as follows:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Median Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Median Method (Excel)
See also Send feedback

Returns the median of the given numbers. The median is the number in the middle of a set of numbers.

Syntax

expression .Median(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 numbers for which you want the median.

Return Value

Double

Remarks

  • If there is an even number of numbers in the set, then MEDIAN calculates the average of the two numbers in the middle. See the second formula in the example.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

Note Note

The MEDIAN function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Min Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Min Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the smallest number in a set of values.

Syntax

expression .Min(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 numbers for which you want to find the minimum value.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are used. Empty cells, logical values, or text in the array or reference are ignored.

  • If the arguments contain no numbers, MIN returns 0.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If you want to include logical values and text representations of numbers in a reference as part of the calculation, use the MINA function.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MInverse Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MInverse Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse matrix for the matrix stored in an array.

Syntax

expression .MInverse(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - a numeric array with an equal number of rows and columns.

Return Value

Variant

Remarks

  • The size of the array must not exceed 52 columns by 52 rows. If it does, the function returns a #VALUE! error.

  • Array can be given as a cell range, such as A1:C3; as an array constant, such as {1,2,3;4,5,6;7,8,9}; or as a name for either of these.

  • If any cells in array are empty or contain text, MINVERSE returns the #VALUE! error value.

  • MINVERSE also returns the #VALUE! error value if array does not have an equal number of rows and columns.

  • Formulas that return arrays must be entered as array formulas.

  • Inverse matrices, like determinants, are generally used for solving systems of mathematical equations involving several variables. The product of a matrix and its inverse is the identity matrix — the square array in which the diagonal values equal 1, and all other values equal 0.

  • As an example of how a two-row, two-column matrix is calculated, suppose that the range A1:B2 contains the letters a, b, c, and d that represent any four numbers. The following table shows the inverse of the matrix A1:B2.

    Column A

    Column B

    Row 1

    d/(a*d-b*c)

    b/(b*c-a*d)

    Row 2

    c/(b*c-a*d)

    a/(a*d-b*c)

  • MINVERSE is calculated with an accuracy of approximately 16 digits, which may lead to a small numeric error when the cancellation is not complete.

  • Some square matrices cannot be inverted and will return the #NUM! error value with MINVERSE. The determinant for a noninvertable matrix is 0.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MIrr Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MIrr Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash.

Syntax

expression .MIrr(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Values - an array or a reference to cells that contain numbers. These numbers represent a series of payments (negative values) and income (positive values) occurring at regular periods.
Arg2 | Required | Double | Finance_rate - the interest rate you pay on the money used in the cash flows.
Arg3 | Required | Double | Reinvest_rate - the interest rate you receive on the cash flows as you reinvest them.

Return Value

Double

Remarks

  • Values must contain at least one positive value and one negative value to calculate the modified internal rate of return. Otherwise, MIRR returns the #DIV/0! error value.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • MIRR uses the order of values to interpret the order of cash flows. Be sure to enter your payment and income values in the sequence you want and with the correct signs (positive values for cash received, negative values for cash paid).

  • If n is the number of cash flows in values, frate is the finance_rate, and rrate is the reinvest_rate, then the formula for MIRR is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MMult Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MMult Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2.

Syntax

expression .MMult(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg2 | Required | Variant | Array1, array2 - the arrays you want to multiply.

Return Value

Variant

Remarks

  • The number of columns in array1 must be the same as the number of rows in array2, and both arrays must contain only numbers.

  • Array1 and array2 can be given as cell ranges, array constants, or references.

  • MMULT returns the #VALUE! error when:

    • Any cells are empty or contain text.

    • The number of columns in array1 is different from the number of rows in array2.

    • The size of the resulting array is equal to or greater than a total of 5,461 cells.

  • The matrix product array a of two arrays b and c is: where i is the row number, and j is the column number.

  • Formulas that return arrays must be entered as array formulas.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Mode Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Mode Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the most frequently occurring, or repetitive, value in an array or range of data.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Mode_Sngl and Mode_Mult methods.

Syntax

expression .Mode(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want to calculate the mode. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If the data set contains no duplicate data points, MODE returns the #N/A error value.

Note Note

The MODE function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Mode_Mult Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Mode_Mult Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a vertical array of the most frequently occurring, or repetitive, values in an array or range of data.

Version Information

Version Added: Excel 2010

Syntax

expression .Mode_Mult(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number1 - The first number argument for which you want to calculate the mode.
Arg2 - Arg30 | Optional | Variant | Number2 - Number30 - Number arguments from 2 to 30 for which you want to calculate the mode. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Variant

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If the data set contains no duplicate data points, MODE_MULT returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Mode_Sngl Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Mode_Sngl Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the most frequently occurring, or repetitive, value in an array or range of data.

Version Information

Version Added: Excel 2010

Syntax

expression .Mode_Sngl(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want to calculate the mode. You can also use a single array or a reference to an array instead of arguments separated by commas (,).

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If the data set contains no duplicate data points, MODE_SNGL returns the #N/A error value.

Note Note

The MODE_SNGL function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average The arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.

  • Median The middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.

  • Mode The most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MRound Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MRound Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number rounded to the desired multiple.

Syntax

expression .MRound(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the value to round.
Arg2 | Required | Variant | Multiple - the multiple to which you want to round number.

Return Value

Double

Remarks

MROUND rounds up, away from zero, if the remainder of dividing number by multiple is greater than or equal to half the value of multiple.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.MultiNomial Method (Excel)

 Copy code hover
[image]

WorksheetFunction.MultiNomial Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the ratio of the factorial of a sum of values to the product of factorials.

Syntax

expression .MultiNomial(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1,number2, ... - 1 to 29 values for which you want the multinomial.

Return Value

Double

Remarks

  • If any argument is nonnumeric, MULTINOMIAL returns the #VALUE! error value.

  • If any argument is less than zero, MULTINOMIAL returns the #NUM! error value.

  • The multinomial is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Munit Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Munit Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the unit matrix for the specified dimension.

Version information

Version Added: Excel 2013

Syntax

expression .Munit(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Integer specifying the dimension of the unit matrix that you want to return.

Return value

VARIANT

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NegBinom_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NegBinom_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the negative binomial distribution. NEGBINOM_DIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.

Version Information

Version Added: Excel 2010

Syntax

expression .NegBinom_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number_f - the number of failures.
Arg2 | Required | Double | Number_s - the threshold number of successes.
Arg3 | Required | Double | Probability_s - the probability of a success.
Arg4 | Optional | Variant | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, NEGBINOM_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

For example, you need to find 10 people with excellent reflexes, and you know the probability that a candidate has these qualifications is 0.3. NEGBINOM_DIST calculates the probability that you will interview a certain number of unqualified candidates before finding all 10 qualified candidates:

  • Number_f and number_s are truncated to integers.

  • If any argument is nonnumeric, NEGBINOM_DIST returns the #VALUE! error value.

  • If probability_s < 0 or if probability > 1, NEGBINOM_DIST returns the #NUM! error value.

  • If number_f < 0 or number_s < 1, NEGBINOM_DIST returns the #NUM! error value.

  • The equation for the negative binomial distribution is: where: x is number_f, r is number_s, and p is probability_s.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NegBinomDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NegBinomDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the NegBinom_Dist method.

Syntax

expression .NegBinomDist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number_f - the number of failures.
Arg2 | Required | Double | Number_s - the threshold number of successes.
Arg3 | Required | Double | Probability_s - the probability of a success.

Return Value

Double

Remarks

For example, you need to find 10 people with excellent reflexes, and you know the probability that a candidate has these qualifications is 0.3. NEGBINOMDIST calculates the probability that you will interview a certain number of unqualified candidates before finding all 10 qualified candidates.

  • Number_f and number_s are truncated to integers.

  • If any argument is nonnumeric, NEGBINOMDIST returns the #VALUE! error value.

  • If probability_s < 0 or if probability > 1, NEGBINOMDIST returns the #NUM! error value.

  • If number_f < 0 or number_s < 1, NEGBINOMDIST returns the #NUM! error value.

  • The equation for the negative binomial distribution is: where: x is number_f, r is number_s, and p is probability_s.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NetworkDays Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NetworkDays Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.

Syntax

expression .NetworkDays(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Start_date - a date that represents the start date.
Arg2 | Required | Variant | End_date - a date that represents the end date.
Arg3 | Optional | Variant | Holidays - an optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. The list can be either a range of cells that contains the dates or an array constant of the serial numbers that represent the dates.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • If any argument is not a valid date, NETWORKDAYS returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NetworkDays_Intl Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NetworkDays_Intl Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.

Version Information

Version Added: Excel 2010

Syntax

expression .NetworkDays_Intl(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Variant

Start_date - The start date for which the difference is to be computed. The start_date can be earlier than, the same as, or later than the end_date.

Arg2

Required

Variant

End_date - The end date for which the difference is to be computed. The start_date can be earlier than, the same as, or later than the end_date.

Arg3

Optional

Variant

Weekend - Indicates the days of the week that are weekend days and are not included in the number of whole working days between start_date and end_date. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the weekend days listed in the following table.

Weekend number | Weekend days
1 or omitted | Saturday, Sunday
2 | Sunday, Monday
3 | Monday, Tuesday
4 | Tuesday, Wednesday
5 | Wednesday, Thursday
6 | Thursday, Friday
7 | Friday, Saturday
11 | Sunday only
12 | Monday only
13 | Tuesday only
14 | Wednesday only
15 | Thursday only
16 | Friday only
17 | Saturday only

Arg4

Optional

Variant

Holidays - An optional set of one or more dates that are to be excluded from the working day calendar. Holidays is a range of cells that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.

Return Value

Double

Remarks

  • If start_date is later than end_date, the return value will be negative, and the magnitude will be the number of whole workdays.

  • If start_date is out of range for the current date base value, NETWORKDAYS_INTL returns the #NUM! error value.

  • If end_date is out of range for the current date base value, NETWORKDAYS_INTL returns the #NUM! error value.

  • If a weekend string is of invalid length or contains invalid characters, NETWORKDAYS_INTL returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Nominal Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Nominal Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year.

Syntax

expression .Nominal(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Effect_rate - the effective interest rate.
Arg2 | Required | Variant | Npery - the number of compounding periods per year.

Return Value

Double

Remarks

  • Npery is truncated to an integer.

  • If either argument is nonnumeric, NOMINAL returns the #VALUE! error value.

  • If effect_rate ≤ 0 or if npery < 1, NOMINAL returns the #NUM! error value.

  • NOMINAL is related to EFFECT as shown in the following equation:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Norm_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Norm_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the normal distribution for the specified mean and standard deviation. This function has a wide range of applications in statistics, including hypothesis testing.

Version Information

Version Added: Excel 2010

Syntax

expression .Norm_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The value for which you want the distribution.
Arg2 | Required | Double | Mean - The arithmetic mean of the distribution.
Arg3 | Required | Double | Standard_dev - The standard deviation of the distribution.
Arg4 | Required | Boolean | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, NORM_DIST returns the cumulative distribution function; if FALSE, it returns the probability mass function.

Return Value

Double

Remarks

  • If mean or standard_dev is nonnumeric, NORM_DIST returns the #VALUE! error value.

  • If standard_dev ≤ 0, NORM_DIST returns the #NUM! error value.

  • If mean = 0, standard_dev = 1, and cumulative = TRUE, NORM_DIST returns the standard normal distribution, NORM_S_DIST.

  • The equation for the normal density function (cumulative = FALSE) is:

  • When cumulative = TRUE, the formula is the integral from negative infinity to x of the given formula.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Norm_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Norm_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.

Version Information

Version Added: Excel 2010

Syntax

expression .Norm_Inv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - A probability corresponding to the normal distribution.
Arg2 | Required | Double | Mean - The arithmetic mean of the distribution.
Arg3 | Required | Double | Standard_dev - The standard deviation of the distribution.

Return Value

Double

Remarks

  • If any argument is non-numeric, NORM_INV returns the #VALUE! error value.

  • If probability <= 0 or if probability >= 1, NORM_INV returns the #NUM! error value.

  • If standard_dev ≤ 0, NORM_INV returns the #NUM! error value.

  • If mean = 0 and standard_dev = 1, NORM_INV uses the standard normal distribution (see NORM_S_INV).

Given a value for probability, NORM_INV seeks that value x such that NORM_DIST(x, mean, standard_dev, TRUE) = probability. Thus, precision of NORM_INV depends on precision of NORM_DIST.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Norm_S_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Norm_S_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.

Version Information

Version Added: Excel 2010

Syntax

expression .Norm_S_Dist(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Z - The value for which you want the distribution.
Arg2 | Optional | Variant | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, NORM_S_DIST returns the cumulative distribution function; if FALSE, it returns the probability mass function.

Return Value

Double

Remarks

  • If z is non-numeric, NORM_S_DIST returns the #VALUE! error value.

  • The equation for the standard normal cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Norm_S_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Norm_S_Inv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of 0 (zero) and a standard deviation of one.

Version Information

Version Added: Excel 2010

Syntax

expression .Norm_S_Inv(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - A probability corresponding to the normal distribution.

Return Value

Double

Remarks

  • If probability is non-numeric, NORM_S_INV returns the #VALUE! error value.

  • If probability < 0 or if probability > 1, NORM_S_INV returns the #NUM! error value.

Given a value for probability, NORM_S_INV seeks that value z such that NORM_S_DIST(z) = probability. Thus, precision of NORM_S_INV depends on precision of NORM_S_DIST. NORM_S_INV uses an iterative search technique. If the search has not converged after 100 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NormDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NormDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the normal distribution for the specified mean and standard deviation. This function has a very wide range of applications in statistics, including hypothesis testing.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Norm_Dist method.

Syntax

expression .NormDist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value for which you want the distribution.
Arg2 | Required | Double | Mean - the arithmetic mean of the distribution.
Arg3 | Required | Double | Standard_dev - the standard deviation of the distribution.
Arg4 | Required | Boolean | Cumulative - a logical value that determines the form of the function. If cumulative is TRUE, NORMDIST returns the cumulative distribution function; if FALSE, it returns the probability mass function.

Return Value

Double

Remarks

  • If mean or standard_dev is nonnumeric, NORMDIST returns the #VALUE! error value.

  • If standard_dev ≤ 0, NORMDIST returns the #NUM! error value.

  • If mean = 0, standard_dev = 1, and cumulative = TRUE, NORMDIST returns the standard normal distribution, NORMSDIST.

  • The equation for the normal density function (cumulative = FALSE) is:

  • When cumulative = TRUE, the formula is the integral from negative infinity to x of the given formula.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NormInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NormInv Method (Excel)
See also Send feedback

Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Norm_Inv method.

Syntax

expression .NormInv(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - a probability corresponding to the normal distribution.
Arg2 | Required | Double | Mean - the arithmetic mean of the distribution.
Arg3 | Required | Double | Standard_dev - the standard deviation of the distribution.

Return Value

Double

Remarks

  • If any argument is nonnumeric, NORMINV returns the #VALUE! error value.

  • If probability < 0 or if probability > 1, NORMINV returns the #NUM! error value.

  • If standard_dev ≤ 0, NORMINV returns the #NUM! error value.

  • If mean = 0 and standard_dev = 1, NORMINV uses the standard normal distribution (see NORMSINV).

Given a value for probability, NORMINV seeks that value x such that NORMDIST(x, mean, standard_dev, TRUE) = probability. Thus, precision of NORMINV depends on precision of NORMDIST. NORMINV uses an iterative search technique. If the search has not converged after 100 iterations, the function returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NormSDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NormSDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Norm_S_Dist method.

Syntax

expression .NormSDist(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Z - the value for which you want the distribution.

Return Value

Double

Remarks

  • If z is nonnumeric, NORMSDIST returns the #VALUE! error value.

  • The equation for the standard normal cumulative distribution function is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NormSInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NormSInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Norm_S_Inv method.

Syntax

expression .NormSInv(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - a probability corresponding to the normal distribution.

Return Value

Double

Remarks

  • If probability is nonnumeric, NORMSINV returns the #VALUE! error value.

  • If probability <= 0 or if probability >= 1, NORMSINV returns the #NUM! error value.

Given a value for probability, NORMSINV seeks that value z such that NORMSDIST(z) = probability. Thus, precision of NORMSINV depends on precision of NORMSDIST.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NPer Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NPer Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate.

Syntax

expression .NPer(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate per period.
Arg2 | Required | Double | Pmt - the payment made each period; it cannot change over the life of the annuity. Typically, pmt contains principal and interest but no other fees or taxes.
Arg3 | Required | Double | Pv - the present value, or the lump-sum amount that a series of future payments is worth right now.
Arg4 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Arg5 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due.

Return Value

Double

Remarks

Set type equal to | If payments are due
0 or omitted | At the end of the period
1 | At the beginning of the period

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Npv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Npv Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the net present value of an investment by using a discount rate and a series of future payments (negative values) and income (positive values).

Syntax

expression .Npv(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the rate of discount over the length of one period.
Arg2 - Arg30 | Required | Variant | Value1, value2, ... - 1 to 29 arguments representing the payments and income.

Return Value

Double

Remarks

  • Value1, value2, ... must be equally spaced in time and occur at the end of each period.

  • NPV uses the order of value1, value2, ... to interpret the order of cash flows. Be sure to enter your payment and income values in the correct sequence.

  • Arguments that are numbers, empty cells, logical values, or text representations of numbers are counted; arguments that are error values or text that cannot be translated into numbers are ignored.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • The NPV investment begins one period before the date of the value1 cash flow and ends with the last cash flow in the list. The NPV calculation is based on future cash flows. If your first cash flow occurs at the beginning of the first period, the first value must be added to the NPV result, not included in the values arguments. For more information, see the examples below.

  • If n is the number of cash flows in the list of values, the formula for NPV is:

  • NPV is similar to the PV function (present value). The primary difference between PV and NPV is that PV allows cash flows to begin either at the end or at the beginning of the period. Unlike the variable NPV cash flow values, PV cash flows must be constant throughout the investment. For information about annuities and financial functions, see PV.

  • NPV is also related to the IRR function (internal rate of return). IRR is the rate for which NPV equals zero: NPV(IRR(...), ...) = 0.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.NumberValue Method (Excel)

 Copy code hover
[image]

WorksheetFunction.NumberValue Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts text to number in a locale-independent manner.

Version information

Version Added: Excel 2013

Syntax

expression .NumberValue(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | String representing the number you want to convert.
Arg2 | Required | STRING | Character used as the decimal separator in the string.
Arg3 | Required | STRING | Character used as the group separator in the string.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Oct2Bin Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Oct2Bin Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts an octal number to binary.

Syntax

expression .Oct2Bin(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the octal number you want to convert. Number may not contain more than 10 characters. The most significant bit of number is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, OCT2BIN uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is negative, OCT2BIN ignores places and returns a 10-character binary number.

  • If number is negative, it cannot be less than 7777777000, and if number is positive, it cannot be greater than 777.

  • If number is not a valid octal number, OCT2BIN returns the #NUM! error value.

  • If OCT2BIN requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, OCT2BIN returns the #VALUE! error value.

  • If places is negative, OCT2BIN returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Oct2Dec Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Oct2Dec Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts an octal number to decimal.

Syntax

expression .Oct2Dec(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the octal number you want to convert. Number may not contain more than 10 octal characters (30 bits). The most significant bit of number is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation.

Return Value

String

Remarks

If number is not a valid octal number, OCT2DEC returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Oct2Hex Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Oct2Hex Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts an octal number to hexadecimal.

Syntax

expression .Oct2Hex(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the octal number you want to convert. Number may not contain more than 10 octal characters (30 bits). The most significant bit of number is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation.
Arg2 | Optional | Variant | Places - the number of characters to use. If places is omitted, OCT2HEX uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Return Value

String

Remarks

  • If number is negative, OCT2HEX ignores places and returns a 10-character hexadecimal number.

  • If number is not a valid octal number, OCT2HEX returns the #NUM! error value.

  • If OCT2HEX requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, OCT2HEX returns the #VALUE! error value.

  • If places is negative, OCT2HEX returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Odd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Odd Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns number rounded up to the nearest odd integer.

Syntax

expression .Odd(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the value to round.

Return Value

Double

Remarks

  • If number is nonnumeric, ODD returns the #VALUE! error value.

  • Regardless of the sign of number, a value is rounded up when adjusted away from zero. If number is an odd integer, no rounding occurs.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.OddFPrice Method (Excel)

 Copy code hover
[image]

WorksheetFunction.OddFPrice Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the price per $100 face value of a security having an odd (short or long) first period.

Syntax

expression .OddFPrice(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Issue - the security's issue date.
Arg4 | Required | Variant | First_coupon - the security's first coupon date.
Arg5 | Required | Variant | Rate - the security's interest rate.
Arg6 | Required | Variant | Yld - the security's annual yield.
Arg7 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg8 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg9 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, issue, first_coupon, and basis are truncated to integers.

  • If settlement, maturity, issue, or first_coupon is not a valid date, ODDFPRICE returns the #VALUE! error value.

  • If rate < 0 or if yld < 0, ODDFPRICE returns the #NUM! error value.

  • If basis < 0 or if basis > 4, ODDFPRICE returns the #NUM! error value.

  • The following date condition must be satisfied; otherwise, ODDFPRICE returns the #NUM! error value: maturity > first_coupon > settlement > issue

  • ODDFPRICE is calculated as follows: Odd short first coupon: where: A = number of days from the beginning of the coupon period to the settlement date (accrued days). DSC = number of days from the settlement to the next coupon date. DFC = number of days from the beginning of the odd first coupon to the first coupon date. E = number of days in the coupon period. N = number of coupons payable between the settlement date and the redemption date. (If this number contains a fraction, it is raised to the next whole number.) Odd long first coupon: where: Ai = number of days from the beginning of the ith, or last, quasi-coupon period within odd period. DCi = number of days from dated date (or issue date) to first quasi-coupon (i = 1) or number of days in quasi-coupon (i = 2,..., i = NC). DSC = number of days from settlement to next coupon date. E = number of days in coupon period. N = number of coupons payable between the first real coupon date and redemption date. (If this number contains a fraction, it is raised to the next whole number.) NC = number of quasi-coupon periods that fit in odd period. (If this number contains a fraction, it is raised to the next whole number.) NLi = normal length in days of the full ith, or last, quasi-coupon period within odd period. Nq = number of whole quasi-coupon periods between settlement date and first coupon.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.OddFYield Method (Excel)

 Copy code hover
[image]

WorksheetFunction.OddFYield Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the yield of a security that has an odd (short or long) first period.

Syntax

expression .OddFYield(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Issue - the security's issue date.
Arg4 | Required | Variant | First_coupon - the security's first coupon date.
Arg5 | Required | Variant | Rate - the security's interest rate.
Arg6 | Required | Variant | Pr - the security's price.
Arg7 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg8 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg9 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, issue, first_coupon, and basis are truncated to integers.

  • If settlement, maturity, issue, or first_coupon is not a valid date, ODDFYIELD returns the #VALUE! error value.

  • If rate < 0 or if pr ≤ 0, ODDFYIELD returns the #NUM! error value.

  • If basis < 0 or if basis > 4, ODDFYIELD returns the #NUM! error value.

  • The following date condition must be satisfied; otherwise, ODDFYIELD returns the #NUM! error value: maturity > first_coupon > settlement > issue

  • Excel uses an iterative technique to calculate ODDFYIELD. This function uses the Newton method based on the formula used for the function ODDFPRICE. The yield is changed through 100 iterations until the estimated price with the given yield is close to the price. See ODDFPRICE for the formula that ODDFYIELD uses.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.OddLPrice Method (Excel)

 Copy code hover
[image]

WorksheetFunction.OddLPrice Method (Excel)
See also Send feedback

Returns the price per $100 face value of a security having an odd (short or long) last coupon period.

Syntax

expression .OddLPrice(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Last_interest - the security's last coupon date.
Arg4 | Required | Variant | Rate - the security's interest rate.
Arg5 | Required | Variant | Yld - the security's annual yield.
Arg6 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg7 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg8 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, last_interest, and basis are truncated to integers.

  • If settlement, maturity, or last_interest is not a valid date, ODDLPRICE returns the #VALUE! error value.

  • If rate < 0 or if yld < 0, ODDLPRICE returns the #NUM! error value.

  • If basis < 0 or if basis > 4, ODDLPRICE returns the #NUM! error value.

  • The following date condition must be satisfied; otherwise, ODDLPRICE returns the #NUM! error value: maturity > settlement > last_interest

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.OddLYield Method (Excel)

 Copy code hover
[image]

WorksheetFunction.OddLYield Method (Excel)
See also Send feedback

Returns the yield of a security that has an odd (short or long) last period.

Syntax

expression .OddLYield(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Last_interest - the security's last coupon date.
Arg4 | Required | Variant | Rate - the security's interest rate.
Arg5 | Required | Variant | Pr - the security's price.
Arg6 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg7 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg8 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, last_interest, and basis are truncated to integers.

  • If settlement, maturity, or last_interest is not a valid date, ODDLYIELD returns the #VALUE! error value.

  • If rate < 0 or if pr ≤ 0, ODDLYIELD returns the #NUM! error value.

  • If basis < 0 or if basis > 4, ODDLYIELD returns the #NUM! error value.

  • The following date condition must be satisfied; otherwise, ODDLYIELD returns the #NUM! error value: maturity > settlement > last_interest

  • ODDLYIELD is calculated as follows: where: Ai = number of accrued days for the ith, or last, quasi-coupon period within odd period counting forward from last interest date before redemption. DCi = number of days counted in the ith, or last, quasi-coupon period as delimited by the length of the actual coupon period. NC = number of quasi-coupon periods that fit in odd period; if this number contains a fraction it will be raised to the next whole number. NLi = normal length in days of the ith, or last, quasi-coupon period within odd coupon period.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Or Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Or Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.

Syntax

expression .Or(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Logical1,logical2,... - 1 to 30 conditions you want to test that can be either TRUE or FALSE.

Return Value

Boolean

Remarks

  • The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays or references that contain logical values.

  • If an array or reference argument contains text or empty cells, those values are ignored.

  • If the specified range contains no logical values, OR returns the #VALUE! error value.

  • You can use an OR array formula to see if a value occurs in an array. To enter an array formula, press CTRL+SHIFT+ENTER.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PDuration Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PDuration Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of periods required by an investment to reach a specified value.

Version information

Version Added: Excel 2013

Syntax

expression .PDuration(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Interest rate per period.
Arg2 | Required | DOUBLE | Present value of the investment.
Arg3 | Required | DOUBLE | Desired future value of the investment.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Pearson Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Pearson Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Pearson product moment correlation coefficient, r, a dimensionless index that ranges from -1.0 to 1.0 inclusive and reflects the extent of a linear relationship between two data sets.

Syntax

expression .Pearson(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - a set of independent values.
Arg2 | Required | Variant | Array2 - a set of dependent values.

Return Value

Double

Remarks

  • The arguments must be either numbers or names, array constants, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If array1 and array2 are empty or have a different number of data points, PEARSON returns the #N/A error value.

  • The formula for the Pearson product moment correlation coefficient, r, is: where x and y are the sample means AVERAGE(array1) and AVERAGE(array2).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Percentile Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Percentile Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Percentile_Inc and Percentile_Exc method.

Syntax

expression .Percentile(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or range of data that defines relative standing.
Arg2 | Required | Double | K - the percentile value in the range 0..1, inclusive.

Return Value

Double

Remarks

  • If array is empty, PERCENTILE returns the #NUM! error value.

  • If k is nonnumeric, PERCENTILE returns the #VALUE! error value.

  • If k is < 0 or if k > 1, PERCENTILE returns the #NUM! error value.

  • If k is not a multiple of 1/(n - 1), PERCENTILE interpolates to determine the value at the k-th percentile.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Percentile_Exc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Percentile_Exc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive.

Version Information

Version Added: Excel 2010

Syntax

expression .Percentile_Exc(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - The array or range of data that defines relative standing.
Arg2 | Required | Double | K - The percentile value in the range 0..1, exclusive.

Return Value

Double

Remarks

  • If array is empty, PERCENTILE_EXC returns the #NUM! error value

  • If k is nonnumeric, PERCENTILE_EXC returns the #VALUE! error value.

  • If k is ≤ 0 or if k ≥ 1, PERCENTILE_EXC returns the #NUM! error value.

  • If k is not a multiple of 1/(n - 1), PERCENTILE_EXC interpolates to determine the value at the k-th percentile.

  • PERCENTILE_EXC will interpolate when the value for the specified percentile lies between two values in the array. If it cannot interpolate for the percentile, k specified, Excel will return #NUM! error.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Percentile_Inc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Percentile_Inc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can examine candidates who score above the 90th percentile.

Version Information

Version Added: Excel 2010

Syntax

expression .Percentile_Inc(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - The array or range of data that defines relative standing.
Arg2 | Required | Double | K - The percentile value in the range 0..1, inclusive.

Return Value

Double

Remarks

  • If array is empty, PERCENTILE_INC returns the #NUM! error value.

  • If k is nonnumeric, PERCENTILE_INC returns the #VALUE! error value.

  • If k is < 0 or if k > 1, PERCENTILE_INC returns the #NUM! error value.

  • If k is not a multiple of 1/(n - 1), PERCENTILE_INC interpolates to determine the value at the k-th percentile.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PercentRank Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PercentRank Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a value in a data set as a percentage of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK to evaluate the standing of an aptitude test score among all scores for the test.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Percentile_Inc and Percentile_Exc method.

Syntax

expression .PercentRank(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or range of data with numeric values that defines relative standing.
Arg2 | Required | Double | X - the value for which you want to know the rank.
Arg3 | Optional | Variant | Significance - an optional value that identifies the number of significant digits for the returned percentage value. If omitted, PERCENTRANK uses three digits (0.xxx).

Return Value

Double

Remarks

  • If array is empty, PERCENTRANK returns the #NUM! error value.

  • If significance < 1, PERCENTRANK returns the #NUM! error value.

  • If x does not match one of the values in array, PERCENTRANK interpolates to return the correct percentage rank.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PercentRank_Exc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PercentRank_Exc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a value in a data set as a percentage (0..1, exclusive) of the data set.

Version Information

Version Added: Excel 2010

Syntax

expression .PercentRank_Exc(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - The array or range of data with numeric values that defines relative standing.
Arg2 | Required | Double | X - The value for which you want to know the rank.
Arg3 | Optional | Variant | Significance - A value that identifies the number of significant digits for the returned percentage value. If omitted, PERCENTRANK.EXC uses three digits (0.xxx).

Return Value

Double

Remarks

  • If array is empty, PERCENTRANK_EXC returns the #NUM! error value.

  • If significance < 1, PERCENTRANK_EXC returns the #NUM! error value.

  • If x does not match one of the values in array, PERCENTRANK_EXC interpolates to return the correct percentage rank.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PercentRank_Inc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PercentRank_Inc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a value in a data set as a percentage (0..1, inclusive) of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK_INC to evaluate the standing of an aptitude test score among all scores for the test.

Version Information

Version Added: Excel 2010

Syntax

expression .PercentRank_Inc(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - The array or range of data with numeric values that defines relative standing.
Arg2 | Required | Double | X - The value for which you want to know the rank.
Arg3 | Optional | Variant | Significance - An optional value that identifies the number of significant digits for the returned percentage value. If omitted, PERCENTRANK_INC uses three digits (0.xxx).

Return Value

Double

Remarks

  • If array is empty, PERCENTRANK_INC returns the #NUM! error value.

  • If significance < 1, PERCENTRANK_INC returns the #NUM! error value.

  • If x does not match one of the values in array, PERCENTRANK_INC interpolates to return the correct percentage rank.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Permut Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Permut Method (Excel)
See also Send feedback

Returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations.

Syntax

expression .Permut(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - an integer that describes the number of objects.
Arg2 | Required | Double | Number_chosen - an integer that describes the number of objects in each permutation.

Return Value

Double

Remarks

  • Both arguments are truncated to integers.

  • If number or number_chosen is nonnumeric, PERMUT returns the #VALUE! error value.

  • If number ≤ 0 or if number_chosen < 0, PERMUT returns the #NUM! error value.

  • If number < number_chosen, PERMUT returns the #NUM! error value.

  • The equation for the number of permutations is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Permutationa Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Permutationa Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects.

Version information

Version Added: Excel 2013

Syntax

expression .Permutationa(Arg1,Arg2)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Total number of objects.
Arg2 | Required | DOUBLE | Number of objects in each permutation.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Phi Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Phi Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the value of the density function for a standard normal distribution.

Version information

Version Added: Excel 2013

Syntax

expression .Phi(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Number for which you want the density of the standard normal distribution.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Phonetic Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Phonetic Method (Excel)
See also Send feedback

Extracts the phonetic (furigana) characters from a text string.

Syntax

expression .Phonetic(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Reference - a text string or a reference to a single cell or a range of cells that contain a furigana text string.

Return Value

String

Remarks

  • If reference is a range of cells, the furigana text string in the upper-left corner cell of the range is returned.

  • If the reference is a range of nonadjacent cells, the #N/A error value is returned.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Pi Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Pi Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15 digits.

Syntax

expression .Pi

expression A variable that represents a WorksheetFunction object.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Pmt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Pmt Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the payment for a loan based on constant payments and a constant interest rate.

Syntax

expression .Pmt(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate for the loan.
Arg2 | Required | Double | Nper - the total number of payments for the loan.
Arg3 | Required | Double | Pv - the present value, or the total amount that a series of future payments is worth now; also known as the principal.
Arg4 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
Arg5 | Optional | Variant | Type - the number 0 (zero) or 1 and indicates when payments are due.

Return Value

Double

Remarks

For a more complete description of the arguments in PMT, see the PV function.

Set type equal to | If payments are due
0 or omitted | At the end of the period
1 | At the beginning of the period

  • The payment returned by PMT includes principal and interest but no taxes, reserve payments, or fees sometimes associated with loans.

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12 percent for rate and 4 for nper.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Poisson Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Poisson Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Poisson_Dist method.

Syntax

expression .Poisson(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the number of events.
Arg2 | Required | Double | Mean - the expected numeric value.
Arg3 | Required | Boolean | Cumulative - a logical value that determines the form of the probability distribution returned. If cumulative is TRUE, POISSON returns the cumulative Poisson probability that the number of random events occurring will be between zero and x inclusive; if FALSE, it returns the Poisson probability mass function that the number of events occurring will be exactly x.

Return Value

Double

Remarks

  • If x is not an integer, it is truncated.

  • If x or mean is nonnumeric, POISSON returns the #VALUE! error value.

  • If x < 0, POISSON returns the #NUM! error value.

  • If mean ≤ 0, POISSON returns the #NUM! error value.

  • POISSON is calculated as follows. For cumulative = FALSE: For cumulative = TRUE:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Poisson_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Poisson_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in one minute.

Version Information

Version Added: Excel 2010

Syntax

expression .Poisson_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The number of events.
Arg2 | Required | Double | Mean - The expected numeric value.
Arg3 | Required | Boolean | Cumulative - A logical value that determines the form of the probability distribution returned. If cumulative is TRUE, POISSON_DIST returns the cumulative Poisson probability that the number of random events occurring will be between 0 (zero) and x inclusive; if FALSE, it returns the Poisson probability mass function that the number of events occurring will be exactly x.

Return Value

Double

Remarks

  • If x is not an integer, it is truncated.

  • If x or mean is nonnumeric, POISSON_DIST returns the #VALUE! error value.

  • If x < 0, POISSON_DIST returns the #NUM! error value.

  • If mean ≤ 0, POISSON_DIST returns the #NUM! error value.

  • POISSON_DIST is calculated as follows. For cumulative = FALSE: For cumulative = TRUE:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Power Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Power Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the result of a number raised to a power.

Syntax

expression .Power(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the base number. It can be any real number.
Arg2 | Required | Double | Power - the exponent to which the base number is raised.

Return Value

Double

Remarks

The "^" operator can be used instead of POWER to indicate to what power the base number is to be raised, such as in 5^2.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Ppmt Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Ppmt Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.

Syntax

expression .Ppmt(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate per period.
Arg2 | Required | Double | Per - the period and must be in the range 1 to nper.
Arg3 | Required | Double | Nper - the total number of payment periods in an annuity.
Arg4 | Required | Double | Pv - the present value — the total amount that a series of future payments is worth now.
Arg5 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
Arg6 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due.

Return Value

Double

Remarks

For a more complete description of the arguments in PPMT, see PV.

Set type equal to | If payments are due
0 or omitted | At the end of the period
1 | At the beginning of the period

Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Price Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Price Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the price per $100 face value of a security that pays periodic interest.

Syntax

expression .Price(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Rate - the security's annual coupon rate.
Arg4 | Required | Variant | Yld - the security's annual yield.
Arg5 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg6 | Required | Variant | Frequency - the number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
Arg7 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, frequency, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, PRICE returns the #VALUE! error value.

  • If yld < 0 or if rate < 0, PRICE returns the #NUM! error value.

  • If redemption ≤ 0, PRICE returns the #NUM! error value.

  • If frequency is any number other than 1, 2, or 4, PRICE returns the #NUM! error value.

  • If basis < 0 or if basis > 4, PRICE returns the #NUM! error value.

  • If settlement ≥ maturity, PRICE returns the #NUM! error value.

  • PRICE is calculated as follows: where: DSC = number of days from settlement to next coupon date. E = number of days in coupon period in which the settlement date falls. N = number of coupons payable between settlement date and redemption date. A = number of days from beginning of coupon period to settlement date.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PriceDisc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PriceDisc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the price per $100 face value of a discounted security.

Syntax

expression .PriceDisc(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Discount - the security's discount rate.
Arg4 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg5 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, PRICEDISC returns the #VALUE! error value.

  • If discount ≤ 0 or if redemption ≤ 0, PRICEDISC returns the #NUM! error value.

  • If basis < 0 or if basis > 4, PRICEDISC returns the #NUM! error value.

  • If settlement ≥ maturity, PRICEDISC returns the #NUM! error value.

  • PRICEDISC is calculated as follows: where: B = number of days in year, depending on year basis. DSM = number of days from settlement to maturity.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.PriceMat Method (Excel)

 Copy code hover
[image]

WorksheetFunction.PriceMat Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the price per $100 face value of a security that pays interest at maturity.

Syntax

expression .PriceMat(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Issue - the security's issue date, expressed as a serial date number.
Arg4 | Required | Variant | Rate - the security's interest rate at date of issue.
Arg5 | Required | Variant | Yld - the security's annual yield.
Arg6 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 (zero) or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, issue, and basis are truncated to integers.

  • If settlement, maturity, or issue is not a valid date, PRICEMAT returns the #VALUE! error value.

  • If rate < 0 or if yld < 0, PRICEMAT returns the #NUM! error value.

  • If basis < 0 or if basis > 4, PRICEMAT returns the #NUM! error value.

  • If settlement ≥ maturity, PRICEMAT returns the #NUM! error value.

  • PRICEMAT is calculated as follows: where: B = number of days in year, depending on year basis. DSM = number of days from settlement to maturity. DIM = number of days from issue to maturity. A = number of days from issue to settlement.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Prob Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Prob Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the probability that values in a range are between two limits. If upper_limit is not supplied, returns the probability that values in x_range are equal to lower_limit.

Syntax

expression .Prob(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | X_range - the range of numeric values of x with which there are associated probabilities.
Arg2 | Required | Variant | Prob_range - a set of probabilities associated with values in x_range.
Arg3 | Required | Double | Lower_limit - the lower bound on the value for which you want a probability.
Arg4 | Optional | Variant | Upper_limit - the optional upper bound on the value for which you want a probability.

Return Value

Double

Remarks

  • If any value in prob_range ≤ 0 or if any value in prob_range > 1, PROB returns the #NUM! error value.

  • If the sum of the values in prob_range ¹ 1, PROB returns the #NUM! error value.

  • If upper_limit is omitted, PROB returns the probability of being equal to lower_limit.

  • If x_range and prob_range contain a different number of data points, PROB returns the #N/A error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Product Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Product Method (Excel)
See also Send feedback

Published: July 16, 2012

Multiplies all the numbers given as arguments and returns the product.

Syntax

expression .Product(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 numbers that you want to multiply.

Return Value

Double

Remarks

  • Arguments that are numbers, logical values, or text representations of numbers are counted; arguments that are error values or text that cannot be translated into numbers cause errors.

  • If an argument is an array or reference, only numbers in the array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Proper Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Proper Method (Excel)
See also Send feedback

Published: July 16, 2012

Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters.

Syntax

expression .Proper(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Text - text enclosed in quotation marks, a formula that returns text, or a reference to a cell containing the text you want to partially capitalize.

Return Value

String

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Pv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Pv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now. For example, when you borrow money, the loan amount is the present value to the lender.

Syntax

expression .Pv(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Rate - the interest rate per period. For example, if you obtain an automobile loan at a 10 percent annual interest rate and make monthly payments, your interest rate per month is 10%/12, or 0.83%. You would enter 10%/12, or 0.83%, or 0.0083, into the formula as the rate.
Arg2 | Required | Double | Nper - the total number of payment periods in an annuity. For example, if you get a four-year car loan and make monthly payments, your loan has 4*12 (or 48) periods. You would enter 48 into the formula for nper.
Arg3 | Required | Double | Pmt - the payment made each period and cannot change over the life of the annuity. Typically, pmt includes principal and interest but no other fees or taxes. For example, the monthly payments on a $10,000, four-year car loan at 12 percent are $263.33. You would enter -263.33 into the formula as the pmt. If pmt is omitted, you must include the fv argument.
Arg4 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0). For example, if you want to save $50,000 to pay for a special project in 18 years, then $50,000 is the future value. You could then make a conservative guess at an interest rate and determine how much you must save each month. If fv is omitted, you must include the pmt argument.
Arg5 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due.

Return Value

Double

Remarks

Set type equal to | If payments are due
0 or omitted | At the end of the period
1 | At the beginning of the period

  • Make sure that you are consistent about the units you use for specifying rate and nper. If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.

  • The following functions apply to annuities: An annuity is a series of constant cash payments made over a continuous period. For example, a car loan or a mortgage is an annuity. For more information, see the description for each annuity function.

    CUMIPMT

    PPMT

    CUMPRINC

    PV

    FV

    RATE

    FVSCHEDULE

    XIRR

    IPMT

    XNPV

    PMT

  • In annuity functions, cash you pay out, such as a deposit to savings, is represented by a negative number; cash you receive, such as a dividend check, is represented by a positive number. For example, a $1,000 deposit to the bank would be represented by the argument -1000 if you are the depositor and by the argument 1000 if you are the bank.

  • Microsoft Excel solves for one financial argument in terms of the others. If rate is not 0, then: If rate is 0, then: (pmt * nper) + pv + fv = 0

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Quartile Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Quartile Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the quartile of a data set. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE to find the top 25 percent of incomes in a population.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Quartile_Inc and Quartile_Exc methods.

Syntax

expression .Quartile(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or cell range of numeric values for which you want the quartile value.
Arg2 | Required | Double | Quart - indicates which value to return.

Return Value

Double

Remarks

If quart equals | QUARTILE returns
0 | Minimum value
1 | First quartile (25th percentile)
2 | Median value (50th percentile)
3 | Third quartile (75th percentile)
4 | Maximum value

  • If array is empty, QUARTILE returns the #NUM! error value.

  • If quart is not an integer, it is truncated.

  • If quart < 0 or if quart > 4, QUARTILE returns the #NUM! error value.

  • MIN, MEDIAN, and MAX return the same value as QUARTILE when quart is equal to 0 (zero), 2, and 4, respectively.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Quartile_Exc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Quartile_Exc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the quartile of the data set, based on percentile values from 0..1, exclusive.

Version Information

Version Added: Excel 2010

Syntax

expression .Quartile_Exc(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - The array or cell range of numeric values for which you want the quartile value.
Arg2 | Required | Double | Quart - The value to return.

Return Value

Double

Remarks

  • If array is empty, QUARTILE_EXC returns the #NUM! error value.

  • If quart is not an integer, it is truncated.

  • If quart ≤ 0 or if quart ≥ 4, QUARTILE_EXC returns the #NUM! error value.

  • MIN, MEDIAN, and MAX return the same value as QUARTILE_EXC when quart is equal to 0 (zero), 2, and 4, respectively.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Quartile_Inc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Quartile_Inc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the quartile of a data set based on percentile values from 0..1, inclusive. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE_INC to find the top 25 percent of incomes in a population.

Version Information

Version Added: Excel 2010

Syntax

expression .Quartile_Inc(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or cell range of numeric values for which you want the quartile value.
Arg2 | Required | Double | Quart - The value to return.

Return Value

Double

Remarks

If quart equals | QUARTILE returns
0 | Minimum value
1 | First quartile (25th percentile)
2 | Median value (50th percentile)
3 | Third quartile (75th percentile)
4 | Maximum value

  • If array is empty, QUARTILE_INC returns the #NUM! error value.

  • If quart is not an integer, it is truncated.

  • If quart < 0 or if quart > 4, QUARTILE_INC returns the #NUM! error value.

  • MIN, MEDIAN, and MAX return the same value as QUARTILE_INC when quart is equal to 0 (zero), 2, and 4, respectively.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Quotient Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Quotient Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the integer portion of a division. Use this function when you want to discard the remainder of a division.

Syntax

expression .Quotient(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Numerator - the dividend.
Arg2 | Required | Variant | Denominator - the divisor.

Return Value

Double

Remarks

If either argument is nonnumeric, QUOTIENT returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Radians Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Radians Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts degrees to radians.

Syntax

expression .Radians(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Angle - an angle in degrees that you want to convert.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.RandBetween Method (Excel)

 Copy code hover
[image]

WorksheetFunction.RandBetween Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.

Syntax

expression .RandBetween(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Bottom - the smallest integer RANDBETWEEN will return.
Arg2 | Required | Variant | Top - the largest integer RANDBETWEEN will return.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rank Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rank Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Rank_Eq and Rank_Avg methods.

Syntax

expression .Rank(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the number whose rank you want to find.
Arg2 | Required | Range | Ref - an array of, or a reference to, a list of numbers. Nonnumeric values in ref are ignored.
Arg3 | Optional | Variant | Order - a number specifying how to rank number.

Return Value

Double

Remarks

  • If order is 0 (zero) or omitted, Microsoft Excel ranks number as if ref were a list sorted in descending order.

  • If order is any nonzero value, Microsoft Excel ranks number as if ref were a list sorted in ascending order.

  • RANK gives duplicate numbers the same rank. However, the presence of duplicate numbers affects the ranks of subsequent numbers. For example, in a list of integers sorted in ascending order, if the number 10 appears twice and has a rank of 5, then 11 would have a rank of 7 (no number would have a rank of 6).

  • For some purposes one might want to use a definition of rank that takes ties into account. In the previous example, one would want a revised rank of 5.5 for the number 10. This can be done by adding the following correction factor to the value returned by RANK. This correction factor is appropriate both for the case where rank is computed in descending order (order = 0 or omitted) or ascending order (order = nonzero value). Correction factor for tied ranks=[COUNT(ref) + 1 - RANK(number, ref, 0) - RANK(number, ref, 1)]/2. In the following example, RANK(A2,A1:A5,1) equals 3. The correction factor is (5 + 1 - 2 - 3)/2 = 0.5 and the revised rank that takes ties into account is 3 + 0.5 = 3.5. If number occurs only once in ref, the correction factor will be 0, since RANK would not have to be adjusted for a tie.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rank_Avg Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rank_Avg Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a number in a list of numbers; that is its size relative to other values in the list. If more than one value has the same rank, the average rank is returned.

Version Information

Version Added: Excel 2010

Syntax

expression .Rank_Avg(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - The number whose rank you want to find.
Arg2 | Required | Range | Ref - An array of, or a reference to, a list of numbers. Non-numeric values in reference are ignored.
Arg3 | Optional | Variant | Order - A number that specifies how to rank number. If the order is 0 (zero) or omitted, Microsoft Excel ranks the number as if the reference was a list sorted in descending order. If the order is any non-zero value, Microsoft Excel ranks number as if the reference were a list sorted in ascending order.

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rank_Eq Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rank_Eq Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)

Version Information

Version Added: Excel 2010

Syntax

expression .Rank_Eq(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - The number whose rank you want to find.
Arg2 | Required | Range | Ref - An array of, or a reference to, a list of numbers. Non-numeric values in reference are ignored.
Arg3 | Optional | Variant | Order - A number that specifies how to rank the number.

Return Value

Double

Remarks

  • If the order is 0 (zero) or omitted, Microsoft Excel ranks the number as if the reference was a list sorted in descending order.

  • If the order is any non-zero value, Microsoft Excel ranks the number as if the reference was a list sorted in ascending order.

  • RANK_EQ gives duplicate numbers the same rank. However, the presence of duplicate numbers affects the ranks of subsequent numbers. For example, in a list of integers sorted in ascending order, if the number 10 appears twice and has a rank of 5, then 11 would have a rank of 7 (no number would have a rank of 6).

  • For some purposes you might want to use a definition of rank that takes ties into account. In the previous example, you would want a revised rank of 5.5 for the number 10. To do this, add the following correction factor to the value returned by RANK_EQ. This correction factor is appropriate both for the case where rank is computed in descending order (order = 0 or omitted) or ascending order (order = nonzero value). Correction factor for tied ranks=[COUNT(ref) + 1 - RANK_EQ(number, ref, 0) - RANK_EQ(number, ref, 1)]/2. In the following example, RANK_EQ(A2,A1:A5,1) equals 3. The correction factor is (5 + 1 - 2 - 3)/2 = 0.5 and the revised rank that takes ties into account is 3 + 0.5 = 3.5. If number occurs only once in ref, the correction factor will be 0, since RANK_EQ would not have to be adjusted for a tie.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rate Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rate Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value.

Syntax

expression .Rate(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Nper - the total number of payment periods in an annuity.
Arg2 | Required | Double | Pmt - the payment made each period and cannot change over the life of the annuity. Typically, pmt includes principal and interest but no other fees or taxes. If pmt is omitted, you must include the fv argument.
Arg3 | Required | Double | Pv - the present value — the total amount that a series of future payments is worth now.
Arg4 | Optional | Variant | Fv - the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Arg5 | Optional | Variant | Type - the number 0 or 1 and indicates when payments are due.
Arg6 | Optional | Variant | Guess - your guess for what the rate will be.

Return Value

Double

Remarks

For a complete description of the arguments nper, pmt, pv, fv, and type, see PV.

Set type equal to | If payments are due
0 or omitted | At the end of the period
1 | At the beginning of the period

  • If you omit guess, it is assumed to be 10 percent.

  • If RATE does not converge, try different values for guess. RATE usually converges if guess is between 0 and 1.

Make sure that you are consistent about the units you use for specifying guess and nper. If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for guess and 4*12 for nper. If you make annual payments on the same loan, use 12% for guess and 4 for nper.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Received Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Received Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the amount received at maturity for a fully invested security.

Syntax

expression .Received(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Investment - the amount invested in the security.
Arg4 | Required | Variant | Discount - the security's discount rate.
Arg5 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, RECEIVED returns the #VALUE! error value.

  • If investment ≤ 0 or if discount ≤ 0, RECEIVED returns the #NUM! error value.

  • If basis < 0 or if basis > 4, RECEIVED returns the #NUM! error value.

  • If settlement ≥ maturity, RECEIVED returns the #NUM! error value.

  • RECEIVED is calculated as follows: where: B = number of days in a year, depending on the day count basis. DSM = number of days from settlement to maturity.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Replace Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Replace Method (Excel)
See also Send feedback

Published: July 16, 2012

Replaces part of a text string, based on the number of characters you specify, with a different text string.

Syntax

expression .Replace(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Text in which you want to replace some characters.
Arg2 | Required | Double | The position of the character in Arg1 that you want to replace with Arg4.
Arg3 | Required | Double | The number of characters in Arg1 that you want the Replace method to replace with Arg4.
Arg4 | Required | String | Text that will replace characters in Arg1.

Return Value

A String value that represents the new string, after replacement.

Example

This example replaces abcdef with ac-ef and notifies the user during this process.

VBA Copy code Copy code
Sub UseReplace()

 Dim strCurrent As String
 Dim strReplaced As String

 strCurrent = "abcdef"

 ' Notify user and display current string.
 MsgBox "The current string is: " & strCurrent

 ' Replace "cd" with "-".
 strReplaced = Application.WorksheetFunction.Replace _
 (Arg1:=strCurrent, Arg2:=3, _
 Arg3:=2, Arg4:="-")

 ' Notify user and display replaced string.
 MsgBox "The replaced string is: " & strReplaced

End Sub

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ReplaceB Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ReplaceB Method (Excel)
See also Send feedback

Published: July 16, 2012

REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string.

Syntax

expression .ReplaceB(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Old_text - text in which you want to replace some characters.
Arg2 | Required | Double | Start_num - the position of the character in old_text that you want to replace with new_text.
Arg3 | Required | Double | Num_chars - the number of characters in old_text that you want REPLACE to replace with new_text.
Arg4 | Required | String | New_text - the text that will replace characters in old_text.

Return Value

String

Remarks

Important note Important

REPLACE is intended for use with languages that use the single-byte character set (SBCS), whereas REPLACEB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

  • REPLACE always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • REPLACEB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, REPLACEB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rept Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rept Method (Excel)
See also Send feedback

Published: July 16, 2012

Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.

Syntax

expression .Rept(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Text - the text you want to repeat.
Arg2 | Required | Double | Number_times - a positive number specifying the number of times to repeat text.

Return Value

String

Remarks

  • If number_times is 0 (zero), REPT returns "" (empty text).

  • If number_times is not an integer, it is truncated.

  • The result of the REPT function cannot be longer than 32,767 characters, or REPT returns #VALUE!.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Roman Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Roman Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts an arabic numeral to roman, as text.

Syntax

expression .Roman(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the Arabic numeral you want converted.
Arg2 | Optional | Variant | Form - a number specifying the type of roman numeral you want. The roman numeral style ranges from Classic to Simplified, becoming more concise as the value of form increases.

Return Value

String

Remarks

Form | Type
0 or omitted | Classic.
1 | More concise. See example below.
2 | More concise. See example below.
3 | More concise. See example below.
4 | Simplified.
TRUE | Classic.
FALSE | Simplified.

  • If number is negative, the #VALUE! error value is returned.

  • If number is greater than 3999, the #VALUE! error value is returned.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Round Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Round Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number to a specified number of digits.

Syntax

expression .Round(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - the number you want to round.
Arg2 | Required | Double | Num_digits - specifies the number of digits to which you want to round number.

Return Value

Double

Remarks

  • If num_digits is greater than 0 (zero), then number is rounded to the specified number of decimal places.

  • If num_digits is 0, then number is rounded to the nearest integer.

  • If num_digits is less than 0, then number is rounded to the left of the decimal point.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.RoundDown Method (Excel)

 Copy code hover
[image]

WorksheetFunction.RoundDown Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number down, toward zero.

Syntax

expression .RoundDown(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - any real number that you want rounded down.
Arg2 | Required | Double | Num_digits - the number of digits to which you want to round number.

Return Value

Double

Remarks

  • ROUNDDOWN behaves like ROUND, except that it always rounds a number down.

  • If num_digits is greater than 0 (zero), then number is rounded down to the specified number of decimal places.

  • If num_digits is 0, then number is rounded down to the nearest integer.

  • If num_digits is less than 0, then number is rounded down to the left of the decimal point.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.RoundUp Method (Excel)

 Copy code hover
[image]

WorksheetFunction.RoundUp Method (Excel)
See also Send feedback

Published: July 16, 2012

Rounds a number up, away from 0 (zero).

Syntax

expression .RoundUp(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - any real number that you want rounded up.
Arg2 | Required | Double | Num_digits - the number of digits to which you want to round number.

Return Value

Double

Remarks

  • ROUNDUP behaves like ROUND, except that it always rounds a number up.

  • If num_digits is greater than 0 (zero), then number is rounded up to the specified number of decimal places.

  • If num_digits is 0, then number is rounded up to the nearest integer.

  • If num_digits is less than 0, then number is rounded up to the left of the decimal point.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Rri Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Rri Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns an equivalent interest rate for the growth of an investment.

Version information

Version Added: Excel 2013

Syntax

expression .Rri(Arg1,Arg2,Arg3)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Number of periods for the investment.
Arg2 | Required | DOUBLE | Present value of the investment.
Arg3 | Required | DOUBLE | Future value of the investment.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.RSq Method (Excel)

 Copy code hover
[image]

WorksheetFunction.RSq Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. For more information, see PEARSON. The r-squared value can be interpreted as the proportion of the variance in y attributable to the variance in x.

Syntax

expression .RSq(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - an array or range of data points.
Arg2 | Required | Variant | Known_x's - an array or range of data points.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If known_y's and known_x's are empty or have a different number of data points, RSQ returns the #N/A error value.

  • If known_y's and known_x's contain only 1 data point, RSQ returns the #DIV/0! error value.

  • The equation for the Pearson product moment correlation coefficient, r, is: where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known_y's). RSQ returns r 2 , which is the square of this correlation coefficient.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.RTD Method (Excel)

 Copy code hover
[image]

WorksheetFunction.RTD Method (Excel)
See also Send feedback

Published: July 16, 2012

This method connects to a source to receive real-time data.

Syntax

expression .RTD(progID, server, topic1, topic2, topic3, topic4, topic5, topic6, topic7, topic8, topic9, topic10, topic11, topic12, topic13, topic14, topic15, topic16, topic17, topic18, topic19, topic20, topic21, topic22, topic23, topic24, topic25, topic26, topic27, topic28)

expression An expression that returns a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
progID | Required | Variant | A string representing the real-time server programmatic identifier.
server | Required | Variant | A server name, Null string or vbNullString constant.
topic1 | Required | Variant | A String representing a topic.
topic2 | Optional | Variant | A String representing a topic.
topic3 | Optional | Variant | A String representing a topic.
topic4 | Optional | Variant | A String representing a topic.
topic5 | Optional | Variant | A String representing a topic.
topic6 | Optional | Variant | A String representing a topic.
topic7 | Optional | Variant | A String representing a topic.
topic8 | Optional | Variant | A String representing a topic.
topic9 | Optional | Variant | A String representing a topic.
topic10 | Optional | Variant | A String representing a topic.
topic11 | Optional | Variant | A String representing a topic.
topic12 | Optional | Variant | A String representing a topic.
topic13 | Optional | Variant | A String representing a topic.
topic14 | Optional | Variant | A String representing a topic.
topic15 | Optional | Variant | A String representing a topic.
topic16 | Optional | Variant | A String representing a topic.
topic17 | Optional | Variant | A String representing a topic.
topic18 | Optional | Variant | A String representing a topic.
topic19 | Optional | Variant | A String representing a topic.
topic20 | Optional | Variant | A String representing a topic.
topic21 | Optional | Variant | A String representing a topic.
topic22 | Optional | Variant | A String representing a topic.
topic23 | Optional | Variant | A String representing a topic.
topic24 | Optional | Variant | A String representing a topic.
topic25 | Optional | Variant | A String representing a topic.
topic26 | Optional | Variant | A String representing a topic.
topic27 | Optional | Variant | A String representing a topic.
topic28 | Optional | Variant | A String representing a topic.

Return Value

Variant

Remarks

The server argument is required in Visual Basic for Applications (VBA), even though it can be omitted within a worksheet.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Search Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Search Method (Excel)
See also Send feedback

Published: July 16, 2012

SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.

Syntax

expression .Search(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Find_text - the text you want to find.
Arg2 | Required | String | Within_text - the text in which you want to search for find_text.
Arg3 | Optional | Variant | Start_num - the character number in within_text at which you want to start searching.

Return Value

Double

Remarks

Important note Important

SEARCH is intended for use with languages that use the single-byte character set (SBCS), whereas SEARCHB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

  • SEARCH always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • SEARCHB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, SEARCHB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

  • Use SEARCH and SEARCHB to determine the location of a character or text string within another text string so that you can use the MID and MIDB or REPLACE and REPLACEB functions to change the text.

  • SEARCH and SEARCHB are not case sensitive. If you want to do a case sensitive search, you can use FIND and FINDB.

  • You can use the wildcard characters, question mark (?) and asterisk (*), in find_text. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • If find_text is not found, the #VALUE! error value is returned.

  • If start_num is omitted, it is assumed to be 1.

  • If start_num is not greater than 0 (zero) or is greater than the length of within_text, the #VALUE! error value is returned.

  • Use start_num to skip a specified number of characters. Using SEARCH as an example, suppose you are working with the text string "AYF0093.YoungMensApparel". To find the number of the first "Y" in the descriptive part of the text string, set start_num equal to 8 so that the serial-number portion of the text is not searched. SEARCH begins with character 8, finds find_text at the next character, and returns the number 9. SEARCH always returns the number of characters from the start of within_text, counting the characters you skip if start_num is greater than 1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SearchB Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SearchB Method (Excel)
See also Send feedback

Published: July 16, 2012

SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.

Syntax

expression .SearchB(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Find_text - the text you want to find.
Arg2 | Required | String | Within_text - the text in which you want to search for find_text.
Arg3 | Optional | Variant | Start_num - the character number in within_text at which you want to start searching.

Return Value

Double

Remarks

Important note Important

SEARCH is intended for use with languages that use the single-byte character set (SBCS), whereas SEARCHB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

  • SEARCH always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • SEARCHB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, SEARCHB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

  • Use SEARCH and SEARCHB to determine the location of a character or text string within another text string so that you can use the MID and MIDB or REPLACE and REPLACEB functions to change the text.

  • SEARCH and SEARCHB are not case sensitive. If you want to do a case sensitive search, you can use FIND and FINDB.

  • You can use the wildcard characters, question mark (?) and asterisk (*), in find_text. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • If find_text is not found, the #VALUE! error value is returned.

  • If start_num is omitted, it is assumed to be 1.

  • If start_num is not greater than 0 (zero) or is greater than the length of within_text, the #VALUE! error value is returned.

  • Use start_num to skip a specified number of characters. Using SEARCH as an example, suppose you are working with the text string "AYF0093.YoungMensApparel". To find the number of the first "Y" in the descriptive part of the text string, set start_num equal to 8 so that the serial-number portion of the text is not searched. SEARCH begins with character 8, finds find_text at the next character, and returns the number 9. SEARCH always returns the number of characters from the start of within_text, counting the characters you skip if start_num is greater than 1.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Sec Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Sec Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the secant of an angle.

Version information

Version Added: Excel 2013

Syntax

expression .Sec(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Angle in radians for which you want the secant.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Sech Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Sech Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic secant of an angle.

Version information

Version Added: Excel 2013

Syntax

expression .Sech(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Angle in radians for which you want the hyperbolic secant.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SeriesSum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SeriesSum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of a power series based on the formula:

Syntax

expression .SeriesSum(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | X - the input value to the power series.
Arg2 | Required | Variant | N - the initial power to which you want to raise x.
Arg3 | Required | Variant | M - the step by which to increase n for each term in the series.
Arg4 | Required | Variant | Coefficients - a set of coefficients by which each successive power of x is multiplied. The number of values in coefficients determines the number of terms in the power series. For example, if there are three values in coefficients, then there will be three terms in the power series.

Return Value

Double

Remarks

If any argument is nonnumeric, SERIESSUM returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Sinh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Sinh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic sine of a number.

Syntax

expression .Sinh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number is any real number.

Return Value

Double

Remarks

The formula for the hyperbolic sine is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Skew Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Skew Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.

Syntax

expression .Skew(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2 ... - 1 to 30 arguments for which you want to calculate skewness. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If there are fewer than three data points, or the sample standard deviation is zero, SKEW returns the #DIV/0! error value.

  • The equation for skewness is defined as:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Skew_p Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Skew_p Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean.

Version information

Version Added: Excel 2013

Syntax

expression .Skew_p(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11,Arg12,Arg13,Arg14,Arg15,Arg16,Arg17,Arg18,Arg19,Arg20,Arg21,Arg22,Arg23,Arg24,Arg25,Arg26,Arg27,Arg28,Arg29,Arg30)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg2 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg3 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg4 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg5 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg6 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg7 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg8 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg9 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg10 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg11 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg12 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg13 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg14 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg15 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg16 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg17 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg18 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg19 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg20 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg21 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg22 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg23 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg24 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg25 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg26 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg27 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg28 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg29 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.
Arg30 | Optional | VARIANT | 1 to 254 numbers or names, arrays, or references that contain numbers for which you want the population skewness.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Sln Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Sln Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the straight-line depreciation of an asset for one period.

Syntax

expression .Sln(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Cost - the initial cost of the asset.
Arg2 | Required | Double | Salvage - the value at the end of the depreciation (sometimes called the salvage value of the asset).
Arg3 | Required | Double | Life - the number of periods over which the asset is depreciated (sometimes called the useful life of the asset).

Return Value

Double

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Slope Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Slope Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the slope of the linear regression line through data points in known_y's and known_x's. The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line.

Syntax

expression .Slope(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - an array or cell range of numeric dependent data points.
Arg2 | Required | Variant | Known_x's - the set of independent data points.

Return Value

Double

Remarks

  • The arguments must be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If known_y's and known_x's are empty or have a different number of data points, SLOPE returns the #N/A error value.

  • The equation for the slope of the regression line is: where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known_y's).

  • The underlying algorithm used in the SLOPE and INTERCEPT functions is different than the underlying algorithm used in the LINEST function. The difference between these algorithms can lead to different results when data is undetermined and collinear. For example, if the data points of the known_y's argument are 0 and the data points of the known_x's argument are 1:

    • SLOPE and INTERCEPT return a #DIV/0! error. The SLOPE and INTERCEPT algorithm is designed to look for one and only one answer, and in this case there can be more than one answer.

    • LINEST returns a value of 0. The LINEST algorithm is designed to return reasonable results for collinear data, and in this case at least one answer can be found.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Small Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Small Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set.

Syntax

expression .Small(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - an array or range of numerical data for which you want to determine the k-th smallest value.
Arg2 | Required | Double | K - the position (from the smallest) in the array or range of data to return.

Return Value

Double

Remarks

  • If array is empty, SMALL returns the #NUM! error value.

  • If k ≤ 0 or if k exceeds the number of data points, SMALL returns the #NUM! error value.

  • If n is the number of data points in array, SMALL(array,1) equals the smallest value, and SMALL(array,n) equals the largest value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SqrtPi Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SqrtPi Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the square root of (number * pi).

Syntax

expression .SqrtPi(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number - the number by which pi is multiplied.

Return Value

Double

Remarks

If number < 0, SQRTPI returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Standardize Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Standardize Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a normalized value from a distribution characterized by mean and standard_dev.

Syntax

expression .Standardize(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value you want to normalize.
Arg2 | Required | Double | Mean - the arithmetic mean of the distribution.
Arg3 | Required | Double | Standard_dev - the standard deviation of the distribution.

Return Value

Double

Remarks

  • If standard_dev ≤ 0, STANDARDIZE returns the #NUM! error value.

  • The equation for the normalized value is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.StDev Method (Excel)

 Copy code hover
[image]

WorksheetFunction.StDev Method (Excel)
See also Send feedback

Published: July 16, 2012

Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the StDev_S method.

Syntax

expression .StDev(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a sample of a population. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • STDEV assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the standard deviation using STDEVP.

  • The standard deviation is calculated using the "unbiased" or "n-1" method.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • STDEV uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.StDev_P Method (Excel)

 Copy code hover
[image]

WorksheetFunction.StDev_P Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

Version Information

Version Added: Excel 2010

Syntax

expression .StDev_P(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a population. You can also use a single array or a reference to an array instead of arguments separated by commas (,).

Return Value

Double

Remarks

  • STDEV_P assumes that its arguments are the entire population. If your data represents a sample of the population, then compute the standard deviation using STDEV_S.

  • For large sample sizes, STDEV_S and STDEV_P return approximately equal values.

  • The standard deviation is calculated using the "biased" or "n" method.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • STDEV_P uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.StDev_S Method (Excel)

 Copy code hover
[image]

WorksheetFunction.StDev_S Method (Excel)
See also Send feedback

Published: July 16, 2012

Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

Version Information

Version Added: Excel 2010

Syntax

expression .StDev_S(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a sample of a population. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • STDEV_S assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the standard deviation using STDEV_P.

  • The standard deviation is calculated using the "unbiased" or "n-1" method.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • STDEV_S uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.StDevP Method (Excel)

 Copy code hover
[image]

WorksheetFunction.StDevP Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the StDev_P method.

Syntax

expression .StDevP(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a population. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • STDEVP assumes that its arguments are the entire population. If your data represents a sample of the population, then compute the standard deviation using STDEV.

  • For large sample sizes, STDEV and STDEVP return approximately equal values.

  • The standard deviation is calculated using the "biased" or "n" method.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • STDEVP uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.StEyx Method (Excel)

 Copy code hover
[image]

WorksheetFunction.StEyx Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the standard error of the predicted y-value for each x in the regression. The standard error is a measure of the amount of error in the prediction of y for an individual x.

Syntax

expression .StEyx(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - an array or range of dependent data points.
Arg2 | Required | Variant | Known_x's - an array or range of independent data points.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • If known_y's and known_x's have a different number of data points, STEYX returns the #N/A error value.

  • If known_y's and known_x's are empty or have less than three data points, STEYX returns the #DIV/0! error value.

  • The equation for the standard error of the predicted y is: where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known_y's), and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Substitute Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Substitute Method (Excel)
See also Send feedback

Published: July 16, 2012

Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.

Syntax

expression .Substitute(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Text - the text or the reference to a cell containing text for which you want to substitute characters.
Arg2 | Required | String | Old_text - the text you want to replace.
Arg3 | Required | String | New_text - the text you want to replace old_text with.
Arg4 | Optional | Variant | Instance_num - specifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.

Return Value

String

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Subtotal Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Subtotal Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates subtotals.

Syntax

expression .Subtotal(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A number indicating the aggregation function to be used by the method.
Arg2 | Required | Range | The first Range object for which a subtotal is to be calculated.
Arg3-Arg30 | Optional | Variant | Subsequent Range objects for which a subtotal is to be calculated.

Return Value

A Double value that represents the subtotal.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Sum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Sum Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds all the numbers in a range of cells.

Syntax

expression .Sum(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want the total value or sum.

Return Value

Double

Remarks

  • Numbers, logical values, and text representations of numbers that you type directly into the list of arguments are counted. See the first and second examples following.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, or text in the array or reference are ignored. See the third example following.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumIf Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumIf Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds the cells specified by a given criteria.

Syntax

expression .SumIf(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Range - the range of cells that you want evaluated by criteria.
Arg2 | Required | Variant | Criteria - the criteria in the form of a number, expression, or text that defines which cells will be added. For example, criteria can be expressed as 32, "32", ">32", or "apples".
Arg3 | Optional | Variant | Sum_range - the actual cells to add if their corresponding cells in range match criteria. If sum_range is omitted, the cells in range are both evaluated by criteria and added if they match criteria.

Return Value

Double

Remarks

  • Sum_range does not have to be the same size and shape as range. The actual cells that are added are determined by using the top, left cell in sum_range as the beginning cell, and then including cells that correspond in size and shape to range. For example:

    If range is

    And sum_range is

    Then the actual cells are

    A1:A5

    B1:B5

    B1:B5

    A1:A5

    B1:B3

    B1:B5

    A1:B4

    C1:D4

    C1:D4

    A1:B4

    C1:C2

    C1:D4

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumIfs Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumIfs Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds the cells in a range that meet multiple criteria.

Syntax

expression .SumIfs(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Range | Sum_range - the range to sum.
Arg2 | Required | Range | Criteria_range1, criteria_range2, … - one or more ranges in which to evaluate the associated criteria.
Arg3 - Arg30 | Required | Variant | Criteria1, criteria2, … - one or more criteria in the form of a number, expression, cell reference, or text that define which cells will be added. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.

Return Value

Double

Remarks

  • Each cell in sum_range is summed only if all of the corresponding criteria specified are true for that cell.

  • Cells in sum_range that contain TRUE evaluate as 1; cells in sum_range that contain FALSE evaluate as 0 (zero).

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • Each criteria_range does not have to be the same size and shape as sum_range. The actual cells that are added are determined by using the top, left cell in that criteria_range as the beginning cell, and then including cells that correspond in size and shape to sum_range. For example:

    If sum_range is

    And a criteria_range is

    Then the actual cells evaluated are

    A1:A5

    B1:B5

    B1:B5

    A1:A5

    B1:B3

    B1:B5

    A1:B4

    C1:D4

    C1:D4

    A1:B4

    C1:C2

    C1:D4

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumProduct Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumProduct Method (Excel)
See also Send feedback

Published: July 16, 2012

Multiplies corresponding components in the given arrays, and returns the sum of those products.

Syntax

expression .SumProduct(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Array1, array2, array3, ... - 2 to 30 arrays whose components you want to multiply and then add.

Return Value

Double

Remarks

  • The array arguments must have the same dimensions. If they do not, SUMPRODUCT returns the #VALUE! error value.

  • SUMPRODUCT treats array entries that are not numeric as if they were zeros.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumSq Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumSq Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of the squares of the arguments.

Syntax

expression .SumSq(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Number1, number2, ... - 1 to 30 arguments for which you want the sum of the squares. You can also use a single array or a reference to an array instead of arguments separated by commas.

Return Value

Double

Remarks

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Numbers, logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumX2MY2 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumX2MY2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of the difference of squares of corresponding values in two arrays.

Syntax

expression .SumX2MY2(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array_x - the first array or range of values.
Arg2 | Required | Variant | Array_y - the second array or range of values.

Return Value

Double

Remarks

  • The arguments should be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If array_x and array_y have a different number of dimensions, SUMX2MY2 returns the #N/A error value.

  • The equation for the sum of the difference of squares is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumX2PY2 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumX2PY2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of the sum of squares of corresponding values in two arrays. The sum of the sum of squares is a common term in many statistical calculations.

Syntax

expression .SumX2PY2(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array_x - the first array or range of values.
Arg2 | Required | Variant | Array_y - the second array or range of values.

Return Value

Double

Remarks

  • The arguments should be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If array_x and array_y have a different number of dimensions, SUMX2PY2 returns the #N/A error value.

  • The equation for the sum of the sum of squares is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.SumXMY2 Method (Excel)

 Copy code hover
[image]

WorksheetFunction.SumXMY2 Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum of squares of differences of corresponding values in two arrays.

Syntax

expression .SumXMY2(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array_x - the first array or range of values.
Arg2 | Required | Variant | Array_y - the second array or range of values.

Return Value

Double

Remarks

  • The arguments should be either numbers or names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

  • If array_x and array_y have a different number of dimensions, SUMXMY2 returns the #N/A error value.

  • The equation for the sum of squared differences is:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Syd Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Syd Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sum-of-years' digits depreciation of an asset for a specified period.

Syntax

expression .Syd(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Cost - the initial cost of the asset.
Arg2 | Required | Double | Salvage - the value at the end of the depreciation (sometimes called the salvage value of the asset).
Arg3 | Required | Double | Life - the number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
Arg4 | Required | Double | Per - the period and must use the same units as life.

Return Value

Double

Remarks

  • SYD is calculated as follows:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are computed.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Dist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The numeric value at which to evaluate the distribution.
Arg2 | Required | Double | Deg_freedom - An integer that indicates the number of degrees of freedom.
Arg3 | Required | Boolean | Cumulative - A logical value that determines the form of the function. If cumulative is TRUE, T_DIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

Return Value

Double

Remarks

  • If any argument is nonnumeric, T_DIST returns the #VALUE! error value.

  • If deg_freedom < 1, T_DIST returns the #NUM! error value.

  • If x < 0, then T_DIST returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Dist_2T Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Dist_2T Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the two-tailed Student t-distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Dist_2T(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The numeric value at which to evaluate the distribution.
Arg2 | Required | Double | Deg_freedom - An integer that indicates the number of degrees of freedom.

Return Value

Double

Remarks

  • If any argument is non-numeric, T_DIST_2T returns the #VALUE! error value.

  • If deg_freedom < 1, T_DIST_2T returns the #NUM! error value.

  • If x < 0, then T_DIST_2T returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Dist_RT Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Dist_RT Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the right-tailed Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Dist_RT(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The numeric value at which to evaluate the distribution.
Arg2 | Required | Double | Degrees_freedom - An integer that indicates the number of degrees of freedom.

Return Value

Double

Remarks

  • If any argument is non-numeric, T_DIST_RT returns the #VALUE! error value.

  • If degrees_freedom < 1, T_DIST_RT returns the #NUM! error value.

  • The degrees_freedom and tails arguments are truncated to integers.

  • If tails is any value other than 1 or 2, T_DIST_RT returns the #NUM! error value.

  • If x < 0, then T_DIST_RT returns the #NUM! error value.

  • If tails = 1, T_DIST_RT is calculated as T_DIST_RT = P( X>x ), where X is a random variable that follows the t-distribution. If tails = 2, T_DIST_RT is calculated as T_DIST_RT = P(|X| > x) = P(X > x or X < -x).

  • Because x < 0 is not allowed, to use T_DIST_RT when x < 0, note that T_DIST_RT(-x,df) = 1 - T_DIST_RT(x,df) = P(X > -x) and T_DIST_2T(-x,df) = T_DIST_2T(x df) = P(|X| > x).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Inv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Inv Method (Excel)
See also Send feedback

Returns the left-tailed inverse of the Student t-distribution.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Dist_2T(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - The probability associated with the Student t-distribution.
Arg2 | Required | Double | Deg_freedom - The number of degrees of freedom with which to characterize the distribution.

Return Value

Double

Remarks

  • If either argument is non-numeric, T_INV returns the #VALUE! error value.

  • If probability < 0 or if probability > 1, T_INV returns the #NUM! error value.

  • If deg_freedom is not an integer, it is truncated.

  • If deg_freedom < 1, T_INV returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Inv_2T Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Inv_2T Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the t-value of the Student t-distribution as a function of the probability and the degrees of freedom.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Inv_2T(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - The probability associated with the two-tailed Student t-distribution.
Arg2 | Required | Double | Degrees_freedom - The number of degrees of freedom with which to characterize the distribution.

Return Value

Double

Remarks

  • If either argument is non-numeric, T_INV_2T returns the #VALUE! error value.

  • If probability < 0 or if probability > 1, T_INV_2T returns the #NUM! error value.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1, T_INV_2T returns the #NUM! error value.

  • T_INV_2T returns that value t, such that P(|X| > t) = probability where X is a random variable that follows the t-distribution and P(|X| > t) = P(X < -t or X > t).

  • A one-tailed t-value can be returned by replacing probability with 2*probability. For a probability of 0.05 and degrees of freedom of 10, the two-tailed value is calculated with T_INV_2T(0.05,10), which returns 2.28139. The one-tailed value for the same probability and degrees of freedom can be calculated with T_INV_2T(2*0.05,10), which returns 1.812462. Given a value for probability, T_INV_2T seeks that value x such that T_DIST_RT(x, degrees_freedom, 2) = probability. Thus, precision of T_INV_2T depends on precision of T_DIST_RT. T_INV_2T uses an iterative search technique. If the search has not converged after 100 iterations, the function returns the #N/A error value.

    Note Note

    In some tables, probability is described as (1-p).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.T_Test Method (Excel)

 Copy code hover
[image]

WorksheetFunction.T_Test Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the probability associated with a Student t-Test. Use T_TEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.

Version Information

Version Added: Excel 2010

Syntax

expression .T_Test(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - The first data set.
Arg2 | Required | Variant | Array2 - The second data set.
Arg3 | Required | Double | Tails - Specifies the number of distribution tails. If tails = 1, T_TEST uses the one-tailed distribution. If tails = 2, T_TEST uses the two-tailed distribution.
Arg4 | Required | Double | Type - The kind of t-Test to perform.

Return Value

Double

Remarks

If type equals | This test is performed
1 | Paired
2 | Two-sample equal variance (homoscedastic)
3 | Two-sample unequal variance (heteroscedastic)

  • If array1 and array2 have a different number of data points, and type = 1 (paired), T_TEST returns the #N/A error value.

  • The tails and type arguments are truncated to integers.

  • If tails or type is non-numeric, T_TEST returns the #VALUE! error value.

  • If tails is any value other than 1 or 2, T_TEST returns the #NUM! error value.

  • T_TEST uses the data in array1 and array2 to compute a non-negative t-statistic. If tails=1, T_TEST returns the probability of a higher value of the t-statistic under the assumption that array1 and array2 are samples from populations with the same mean. The value returned by T_TEST when tails=2 is double that returned when tails=1 and corresponds to the probability of a higher absolute value of the t-statistic under the "same population means" assumption.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Tanh Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Tanh Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the hyperbolic tangent of a number.

Syntax

expression .Tanh(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Number - any real number.

Return Value

Double

Remarks

The formula for the hyperbolic tangent is:

worksheet function tanh

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TBillEq Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TBillEq Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the bond-equivalent yield for a Treasury bill.

Syntax

expression .TBillEq(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
Arg2 | Required | Variant | Maturity - the Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
Arg3 | Optional | Variant | Discount - the Treasury bill's discount rate.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • Settlement and maturity are truncated to integers.

  • If settlement or maturity is not a valid date, TBILLEQ returns the #VALUE! error value.

  • If discount ≤ 0, TBILLEQ returns the #NUM! error value.

  • If settlement > maturity, or if maturity is more than one year after settlement, TBILLEQ returns the #NUM! error value.

  • TBILLEQ is calculated as TBILLEQ = (365 x rate)/(360-(rate x DSM)), where DSM is the number of days between settlement and maturity computed according to the 360 days per year basis.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TBillPrice Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TBillPrice Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the price per $100 face value for a Treasury bill.

Syntax

expression .TBillPrice(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
Arg2 | Required | Variant | Maturity - the Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
Arg3 | Optional | Variant | Discount - the Treasury bill's discount rate.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • Settlement and maturity are truncated to integers.

  • If settlement or maturity is not a valid date, TBILLPRICE returns the #VALUE! error value.

  • If discount ≤ 0, TBILLPRICE returns the #NUM! error value.

  • If settlement > maturity, or if maturity is more than one year after settlement, TBILLPRICE returns the #NUM! error value.

  • TBILLPRICE is calculated as follows: where: DSM = number of days from settlement to maturity, excluding any maturity date that is more than one calendar year after the settlement date.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TBillYield Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TBillYield Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the yield for a Treasury bill.

Syntax

expression .TBillYield(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
Arg2 | Required | Variant | Maturity - the Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
Arg3 | Optional | Variant | Pr - the Treasury bill's price per $100 face value.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • Settlement and maturity are truncated to integers.

  • If settlement or maturity is not a valid date, TBILLYIELD returns the #VALUE! error value.

  • If pr ≤ 0, TBILLYIELD returns the #NUM! error value.

  • If settlement ≥ maturity, or if maturity is more than one year after settlement, TBILLYIELD returns the #NUM! error value.

  • TBILLYIELD is calculated as follows: where: DSM = number of days from settlement to maturity, excluding any maturity date that is more than one calendar year after the settlement date.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TDist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TDist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Percentage Points (probability) for the Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the T_Dist_RT, T_Dist, and T_Dist_2T methods.

Syntax

expression .TDist(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the numeric value at which to evaluate the distribution.
Arg2 | Required | Double | Degrees_freedom - an integer indicating the number of degrees of freedom.
Arg3 | Required | Double | Tails - specifies the number of distribution tails to return. If tails = 1, TDIST returns the one-tailed distribution. If tails = 2, TDIST returns the two-tailed distribution.

Return Value

Double

Remarks

  • If any argument is nonnumeric, TDIST returns the #VALUE! error value.

  • If degrees_freedom < 1, TDIST returns the #NUM! error value.

  • The degrees_freedom and tails arguments are truncated to integers.

  • If tails is any value other than 1 or 2, TDIST returns the #NUM! error value.

  • If x < 0, then TDIST returns the #NUM! error value.

  • If tails = 1, TDIST is calculated as TDIST = P( X>x ), where X is a random variable that follows the t-distribution. If tails = 2, TDIST is calculated as TDIST = P(|X| > x) = P(X > x or X < -x).

  • Since x < 0 is not allowed, to use TDIST when x < 0, note that TDIST(-x,df,1) = 1 - TDIST(x,df,1) = P(X > -x) and TDIST(-x,df,2) = TDIST(x df,2) = P(|X| > x).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Text Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Text Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a value to text in a specific number format.

Syntax

expression .Text(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | A numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
Arg2 | Required | String | A number format in text form in the Category box on the Number tab in the Format Cells dialog box.

Return Value

String

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TInv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TInv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the T_Inv and T_Inv_2T methods.

Syntax

expression .TInv(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Probability - the probability associated with the two-tailed Student's t-distribution.
Arg2 | Required | Double | Degrees_freedom - the number of degrees of freedom with which to characterize the distribution.

Return Value

Double

Remarks

  • If either argument is nonnumeric, TINV returns the #VALUE! error value.

  • If probability < 0 or if probability > 1, TINV returns the #NUM! error value.

  • If degrees_freedom is not an integer, it is truncated.

  • If degrees_freedom < 1, TINV returns the #NUM! error value.

  • TINV returns that value t, such that P(|X| > t) = probability where X is a random variable that follows the t-distribution and P(|X| > t) = P(X < -t or X > t).

  • A one-tailed t-value can be returned by replacing probability with 2*probability. For a probability of 0.05 and degrees of freedom of 10, the two-tailed value is calculated with TINV(0.05,10), which returns 2.28139. The one-tailed value for the same probability and degrees of freedom can be calculated with TINV(2*0.05,10), which returns 1.812462. Given a value for probability, TINV seeks that value x such that TDIST(x, degrees_freedom, 2) = probability. Thus, precision of TINV depends on precision of TDIST.

    Note Note

    In some tables, probability is described as (1-p).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Transpose Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Transpose Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a vertical range of cells as a horizontal range, or vice versa. TRANSPOSE must be entered as an array formula in a range that has the same number of rows and columns, respectively, as an array has columns and rows. Use TRANSPOSE to shift the vertical and horizontal orientation of an array on a worksheet.

Syntax

expression .Transpose(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - an array or range of cells on a worksheet that you want to transpose. The transpose of an array is created by using the first row of the array as the first column of the new array, the second row of the array as the second column of the new array, and so on.

Return Value

Variant

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Trend Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Trend Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known_y's and known_x's. Returns the y-values along that line for the array of new_x's that you specify.

Syntax

expression .Trend(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Known_y's - the set of y-values you already know in the relationship y = mx + b.
Arg2 | Optional | Variant | Known_x's - an optional set of x-values that you may already know in the relationship y = mx + b.
Arg3 | Optional | Variant | New_x's - new x-values for which you want TREND to return corresponding y-values.
Arg4 | Optional | Variant | Const - a logical value specifying whether to force the constant b to equal 0.

Return Value

Variant

Remarks

  • If the array known_y's is in a single column, then each column of known_x's is interpreted as a separate variable.

  • If the array known_y's is in a single row, then each row of known_x's is interpreted as a separate variable.

  • The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a vector (that is, a range with a height of one row or a width of one column).

  • If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

  • New_x's must include a column (or row) for each independent variable, just as known_x's does. So, if known_y's is in a single column, known_x's and new_x's must have the same number of columns. If known_y's is in a single row, known_x's and new_x's must have the same number of rows.

  • If you omit new_x's, it is assumed to be the same as known_x's.

  • If you omit both known_x's and new_x's, they are assumed to be the array {1,2,3,...} that is the same size as known_y's.

  • If const is TRUE or omitted, b is calculated normally.

  • If const is FALSE, b is set equal to 0 (zero), and the m-values are adjusted so that y = mx.

  • For information about how Microsoft Excel fits a line to data, see LINEST.

  • You can use TREND for polynomial curve fitting by regressing against the same variable raised to different powers. For example, suppose column A contains y-values and column B contains x-values. You can enter x^2 in column C, x^3 in column D, and so on, and then regress columns B through D against column A.

  • Formulas that return arrays must be entered as array formulas.

  • When entering an array constant for an argument such as known_x's, use commas to separate values in the same row and semicolons to separate rows.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Trim Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Trim Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing.

Syntax

expression .Trim(Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | String | Text - the text from which you want spaces removed.

Return Value

String

Remarks

Important note Important

The TRIM function was designed to trim the 7-bit ASCII space character (value 32) from text. In the Unicode character set, there is an additional space character called the nonbreaking space character that has a decimal value of 160. This character is commonly used in Web pages as the HTML entity, &nbsp;. By itself, the TRIM function does not remove this nonbreaking space character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TrimMean Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TrimMean Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the mean of the interior of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set. You can use this function when you wish to exclude outlying data from your analysis.

Syntax

expression .TrimMean(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array - the array or range of values to trim and average.
Arg2 | Required | Double | Percent - the fractional number of data points to exclude from the calculation. For example, if percent = 0.2, 4 points are trimmed from a data set of 20 points (20 x 0.2): 2 from the top and 2 from the bottom of the set.

Return Value

Double

Remarks

  • If percent < 0 or percent > 1, TRIMMEAN returns the #NUM! error value.

  • TRIMMEAN rounds the number of excluded data points down to the nearest multiple of 2. If percent = 0.1, 10 percent of 30 data points equals 3 points. For symmetry, TRIMMEAN excludes a single value from the top and bottom of the data set.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.TTest Method (Excel)

 Copy code hover
[image]

WorksheetFunction.TTest Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the probability associated with a Student's t-Test. Use TTEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the T_Test method.

Syntax

expression .TTest(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array1 - the first data set.
Arg2 | Required | Variant | Array2 - the second data set.
Arg3 | Required | Double | Tails - specifies the number of distribution tails. If tails = 1, TTEST uses the one-tailed distribution. If tails = 2, TTEST uses the two-tailed distribution.
Arg4 | Required | Double | Type - the kind of t-Test to perform.

Return Value

Double

Remarks

If type equals | This test is performed
1 | Paired
2 | Two-sample equal variance (homoscedastic)
3 | Two-sample unequal variance (heteroscedastic)

  • If array1 and array2 have a different number of data points, and type = 1 (paired), TTEST returns the #N/A error value.

  • The tails and type arguments are truncated to integers.

  • If tails or type is nonnumeric, TTEST returns the #VALUE! error value.

  • If tails is any value other than 1 or 2, TTEST returns the #NUM! error value.

  • TTEST uses the data in array1 and array2 to compute a non-negative t-statistic. If tails=1, TTEST returns the probability of a higher value of the t-statistic under the assumption that array1 and array2 are samples from populations with the same mean. The value returned by TTEST when tails=2 is double that returned when tails=1 and corresponds to the probability of a higher absolute value of the t-statistic under the "same population means" assumption.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Unichar Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Unichar Method (Excel)
See also Send feedback

Returns the Unicode character referenced by the given numeric value.

Version information

Version Added: Excel 2013

Syntax

expression .Unichar(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | DOUBLE | Unicode number representing a character.

Return value

STRING

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Unicode Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Unicode Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the number (code point) corresponding to the first character of the text.

Version information

Version Added: Excel 2013

Syntax

expression .Unicode(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | Character that you want the Unicode value of.

Return value

DOUBLE

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.USDollar Method (Excel)

 Copy code hover
[image]

WorksheetFunction.USDollar Method (Excel)
See also Send feedback

Published: July 16, 2012

Converts a number to text format and applies a currency symbol. The name of the method (and the symbol that it applies) depends upon the language settings.

Syntax

expression .USDollar(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | A reference to a cell containing a number, or a formula that evaluates to a number.
Arg2 | Required | Double | The number of digits to the right of the decimal point. If Arg2 is negative, the number is rounded to the left of the decimal point. If you omit decimals, it is assumed to be 2.

Return Value

String

Remarks

The USDollar method converts a number to text using currency format, with the decimals rounded to the specified place. The format used is $#,##0.00_);($#,##0.00).

The major difference between formatting a cell that contains a number with the Format Cells command and formatting a number directly with the DOLLAR method is that DOLLAR converts its result to text. A number formatted with the Format Cells command is still a number. You can continue to use numbers formatted with DOLLAR in formulas, because Excel converts numbers entered as text values to numbers when it calculates.

Example

The following example displays the first number in a currency format, two digits to the right of the decimal point ($1,234.57).

Copy code Copy code
=DOLLAR(A2, 2)

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Var Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Var Method (Excel)
See also Send feedback

Published: July 16, 2012

Estimates variance based on a sample.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Var_S method.

Syntax

expression .Var(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a sample of a population.

Return Value

Double

Remarks

  • VAR assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the variance by using VARP.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • VAR uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Var_P Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Var_P Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates variance based on the entire population.

Version Information

Version Added: Excel 2010

Syntax

expression .Var_P(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments that correspond to a population.

Return Value

Double

Remarks

  • VAR_P assumes that its arguments are the entire population. If your data represents a sample of the population, then compute the variance by using VAR_S.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • The equation for VAR_P is: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Var_S Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Var_S Method (Excel)
See also Send feedback

Estimates variance based on a sample.

Version Information

Version Added: Excel 2010

Syntax

expression .Var_S(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a sample of a population.

Return Value

Double

Remarks

  • VAR_S assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the variance by using VAR_P.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • VAR_S uses the following formula: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.VarP Method (Excel)

 Copy code hover
[image]

WorksheetFunction.VarP Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates variance based on the entire population.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Var_P method.

Syntax

expression .VarP(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 - Arg30 | Required | Variant | Number1, number2, ... - 1 to 30 number arguments corresponding to a population.

Return Value

Double

Remarks

  • VARP assumes that its arguments are the entire population. If your data represents a sample of the population, then compute the variance by using VAR.

  • Arguments can either be numbers or names, arrays, or references that contain numbers.

  • Logical values, and text representations of numbers that you type directly into the list of arguments are counted.

  • If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

  • Arguments that are error values or text that cannot be translated into numbers cause errors.

  • The equation for VARP is: where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Vdb Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Vdb Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify. VDB stands for variable declining balance.

Syntax

expression .Vdb(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | Cost - the initial cost of the asset.
Arg2 | Required | Double | Salvage - the value at the end of the depreciation (sometimes called the salvage value of the asset). This value can be 0.
Arg3 | Required | Double | Life - the number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
Arg4 | Required | Double | Start_period - the starting period for which you want to calculate the depreciation. Start_period must use the same units as life.
Arg5 | Required | Double | End_period - the ending period for which you want to calculate the depreciation. End_period must use the same units as life.
Arg6 | Optional | Variant | Factor - the rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method). Change factor if you do not want to use the double-declining balance method. For a description of the double-declining balance method, see DDB.
Arg7 | Optional | Variant | No_switch - a logical value specifying whether to switch to straight-line depreciation when depreciation is greater than the declining balance calculation.

Return Value

Double

Remarks

  • If no_switch is TRUE, Microsoft Excel does not switch to straight-line depreciation even when the depreciation is greater than the declining balance calculation.

  • If no_switch is FALSE or omitted, Excel switches to straight-line depreciation when depreciation is greater than the declining balance calculation.

All arguments except no_switch must be positive numbers.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.VLookup Method (Excel)

 Copy code hover
[image]

WorksheetFunction.VLookup Method (Excel)
See also Send feedback

Published: July 16, 2012

Searches for a value in the first column of a table array and returns a value in the same row from another column in the table array.

Syntax

expression .VLookup(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Lookup_value - the value to search in the first column of the table array. Lookup_value can be a value or a reference. If lookup_value is smaller than the smallest value in the first column of table_array, VLOOKUP returns the #N/A error value.
Arg2 | Required | Variant | Table_array - two or more columns of data. Use a reference to a range or a range name. The values in the first column of table_array are the values searched by lookup_value. These values can be text, numbers, or logical values. Uppercase and lowercase text are equivalent.
Arg3 | Required | Variant | Col_index_num - the column number in table_array from which the matching value must be returned. A col_index_num of 1 returns the value in the first column in table_array; a col_index_num of 2 returns the value in the second column in table_array, and so on.
Arg4 | Optional | Variant | Range_lookup - a logical value that specifies whether you want the VLookup method to find an exact match or an approximate match:

Return Value

Variant

Remarks

The V in VLookup stands for vertical. Use the VLookup method instead of the HLookup method when your comparison values are located in a column to the left of the data that you want to find.

  • If Col_index_num is less than 1, the VLookup method generates an error.

  • If Col_index_num is greater than the number of columns in table_array, the VLookup method generates an error.

  • If Range_lookup is TRUE or omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned. The values in the first column of table_array must be placed in ascending sort order; otherwise, the VLookup method may not give the correct value.

  • If Range_lookup is FALSE, the VLookup method will only find an exact match. In this case, the values in the first column of table_array do not need to be sorted. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, an error is generated.

  • When searching text values in the first column of table_array, ensure that the data in the first column of table_array does not have leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and curly ( ' or ") quotation marks, or nonprinting characters. In these cases, the VLookup method may give an incorrect or unexpected value. For information about how to clean or trim values, see the Clean and Trim methods.

  • When searching number or date values, ensure that the data in the first column of table_array is not stored as text values. In this case, the VLookup method may give an incorrect or unexpected value.

  • If range_lookup is FALSE and lookup_value is text, then you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.WebService Method (Excel)

 Copy code hover
[image]

WorksheetFunction.WebService Method (Excel)
See also Send feedback

Published: July 16, 2012

Underlying function that calls the web service asynchronously, using an HTTP GET request, and returns the response.

Version information

Version Added: Excel 2013

Syntax

expression .WebService(Arg1)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | STRING | The URL of the web service to make the HTTP GET request to.

Remarks

The XPath parameter is limited to 1024 characters.

Return value

VARIANT

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Weekday Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Weekday Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.

Syntax

expression .Weekday(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Serial_number - a sequential number that represents the date of the day you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.
Arg2 | Optional | Variant | Return_type - a number that determines the type of return value.

Return Value

Double

Remarks

Return_type | Number returned
1 or omitted | Numbers 1 (Sunday) through 7 (Saturday). Behaves like previous versions of Microsoft Excel.
2 | Numbers 1 (Monday) through 7 (Sunday).
3 | Numbers 0 (Monday) through 6 (Sunday).
11 | Numbers 1 (Monday) through 7 (Sunday).
12 | Numbers 1 (Tuesday) through 7 (Monday)
13 | Numbers 1 (Wednesday) through 7 (Tuesday)
14 | Numbers 1 (Thursday) through 7 (Wednesday)
15 | Numbers 1 (Friday) through 7 (Thursday)
16 | Numbers 1 (Saturday) through 7 (Friday)
17 | Numbers 1 (Sunday) through 7 (Saturday)

Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Note Note

Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.WeekNum Method (Excel)

 Copy code hover
[image]

WorksheetFunction.WeekNum Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number that indicates where the week falls numerically within a year.

Syntax

expression .WeekNum(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Serial_num - a date within the week. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.
Arg2 | Optional | Variant | Return_type - a number that determines on which day the week begins. The default is 1.

Return Value

Double

Remarks

Important note Important

The WEEKNUM function considers the week containing January 1 to be the first week of the year. However, there is a European standard that defines the first week as the one with the majority of days (four or more) falling in the new year. This means that for years in which there are three days or less in the first week of January, the WEEKNUM function returns week numbers that are incorrect according to the European standard.

Return_type | Week Begins
1 | Week begins on Sunday. Weekdays are numbered 1 through 7.
2 | Week begins on Monday. Weekdays are numbered 1 through 7.

Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Note Note

Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Weibull Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Weibull Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Weibull_Dist method.

Syntax

expression .Weibull(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - the value at which to evaluate the function.
Arg2 | Required | Double | Alpha - a parameter to the distribution.
Arg3 | Required | Double | Beta - a parameter to the distribution.
Arg4 | Required | Boolean | Cumulative - determines the form of the function.

Return Value

Double

Remarks

  • If x, alpha, or beta is nonnumeric, WEIBULL returns the #VALUE! error value.

  • If x < 0, WEIBULL returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, WEIBULL returns the #NUM! error value.

  • The equation for the Weibull cumulative distribution function is:

  • The equation for the Weibull probability density function is:

  • When alpha = 1, WEIBULL returns the exponential distribution with:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Weibull_Dist Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Weibull_Dist Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating the mean time to failure for a device.

Version Information

Version Added: Excel 2010

Syntax

expression .Weibull_Dist(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Double | X - The value at which to evaluate the function.
Arg2 | Required | Double | Alpha - A parameter to the distribution.
Arg3 | Required | Double | Beta - A parameter to the distribution.
Arg4 | Required | Boolean | Cumulative - Determines the form of the function.

Return Value

Double

Remarks

  • If x, alpha, or beta is non-numeric, WEIBULL_DIST returns the #VALUE! error value.

  • If x < 0, WEIBULL_DIST returns the #NUM! error value.

  • If alpha ≤ 0 or if beta ≤ 0, WEIBULL_DIST returns the #NUM! error value.

  • The equation for the Weibull cumulative distribution function is:

  • The equation for the Weibull probability density function is:

  • When alpha = 1, WEIBULL_DIST returns the exponential distribution with:

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.WorkDay Method (Excel)

 Copy code hover
[image]

WorksheetFunction.WorkDay Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a number that represents a date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.

Syntax

expression .WorkDay(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Start_date - a date that represents the start date.
Arg2 | Required | Variant | Days - the number of nonweekend and nonholiday days before or after start_date. A positive value for days yields a future date; a negative value yields a past date.
Arg3 | Optional | Variant | Holidays - an optional list of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. The list can be either a range of cells that contain the dates or an array constant of the serial numbers that represent the dates.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text .

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • If any argument is not a valid date, WORKDAY returns the #VALUE! error value.

  • If start_date plus days yields an invalid date, WORKDAY returns the #NUM! error value.

  • If days is not an integer, it is truncated.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.WorkDay_Intl Method (Excel)

 Copy code hover
[image]

WorksheetFunction.WorkDay_Intl Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters. Weekend parameters indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.

Version Information

Version Added: Excel 2010

Syntax

expression .WorkDay_Intl(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Variant

Start_date - The start date, truncated to integer.

Arg2

Required

Variant

Days - The number of workdays before or after the start_date. A positive value yields a future date; a negative value yields a past date; a 0 (zero) value yields the start_date. Day-offset is truncated to an integer.

Arg3

Optional

Variant

Weekend - Indicates the days of the week that are weekend days and are not considered working days. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the following weekend days.

weekend-number | Weekend days
1 or omitted | Saturday, Sunday
2 | Sunday, Monday
3 | Monday, Tuesday
4 | Tuesday, Wednesday
5 | Wednesday, Thursday
6 | Thursday, Friday
7 | Friday, Saturday
11 | Sunday only
12 | Monday only
13 | Tuesday only
14 | Wednesday only
15 | Thursday only
16 | Friday only
17 | Saturday only

Arg4

Optional

Variant

Holidays - An optional set of one or more dates that are to be excluded from the working day calendar. Holidays is a range of cells that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.

Return Value

Double

Remarks

  • If start_date is out of range for the current date base value, WORKDAY_INTL returns the #NUM! error value.

  • If any date in holidays is out of range for the current date base value, WORKDAY_INTL returns the #NUM! error value.

  • If start_date plus day-offset yields an invalid date, WORKDAY_INTL returns the #NUM! error value.

  • If a weekend string is of invalid length or contains invalid characters, WORKDAY_INTL returns the #VALUE! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Xirr Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Xirr Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the IRR function.

Syntax

expression .Xirr(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Values - a series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. The series of values must contain at least one positive and one negative value.
Arg2 | Required | Variant | Dates - a schedule of payment dates that corresponds to the cash flow payments. The first payment date indicates the beginning of the schedule of payments. All other dates must be later than this date, but they may occur in any order. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.
Arg3 | Optional | Variant | Guess - a number that you guess is close to the result of XIRR.

Return Value

Double

Remarks

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • Numbers in dates are truncated to integers.

  • XIRR expects at least one positive cash flow and one negative cash flow; otherwise, XIRR returns the #NUM! error value.

  • If any number in dates is not a valid date, XIRR returns the #VALUE! error value.

  • If any number in dates precedes the starting date, XIRR returns the #NUM! error value.

  • If values and dates contain a different number of values, XIRR returns the #NUM! error value.

  • In most cases you do not need to provide guess for the XIRR calculation. If omitted, guess is assumed to be 0.1 (10 percent).

  • XIRR is closely related to XNPV, the net present value function. The rate of return calculated by XIRR is the interest rate corresponding to XNPV = 0.

  • Excel uses an iterative technique for calculating XIRR. Using a changing rate (starting with guess), XIRR cycles through the calculation until the result is accurate within 0.000001 percent. If XIRR can't find a result that works after 100 tries, the #NUM! error value is returned. The rate is changed until: where: di = the ith, or last, payment date. d1 = the 0th payment date. Pi = the ith, or last, payment.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Xnpv Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Xnpv Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the net present value for a schedule of cash flows that is not necessarily periodic. Read/write Double.

Syntax

expression .Xnpv(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | A series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment.
Arg2 | Required | Variant | A schedule of payment dates that corresponds to the cash flow payments. The first payment date indicates the beginning of the schedule of payments. All other dates must be later than this date, but they may occur in any order.

Return Value

Double

Remarks

To calculate the net present value for a series of cash flows that is periodic, use the Npv method.

Important note Important

The Xnpv method does not provide a parameter that corresponds to the rate argument required by the corresponding XNPV function (=XNPV(rate, values, dates)). To work around this limitation in VBA code, instead of using the Xpnv method, call the XNPV function by using the Evaluate method as shown in the following example.

Example

The following example returns the net present value for an investment with the above cost and returns. The cash flows are discounted at 9 percent. (2086.6476 or 2086.65)

Copy code Copy code
Dim npv As Double
npv = Application.Evaluate("=XNPV(.09,A2:A6,B2:B6)")

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Xor Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Xor Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns a logical exclusive OR of all arguments.

Version information

Version Added: Excel 2013

Syntax

expression .Xor(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11,Arg12,Arg13,Arg14,Arg15,Arg16,Arg17,Arg18,Arg19,Arg20,Arg21,Arg22,Arg23,Arg24,Arg25,Arg26,Arg27,Arg28,Arg29,Arg30)

expression A variable that represents a WorksheetFunction Object (Excel) object.

Parameters

Name | Required/Optional | Data type | Description
Arg1 | Required | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg2 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg3 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg4 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg5 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg6 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg7 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg8 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg9 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg10 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg11 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg12 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg13 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg14 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg15 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg16 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg17 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg18 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg19 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg20 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg21 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg22 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg23 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg24 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg25 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg26 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg27 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg28 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg29 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.
Arg30 | Optional | VARIANT | 1 to 254 conditions you want to test that can be either TRUE or FALSE and can be logical values, arrays, or references.

Return value

BOOL

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.YearFrac Method (Excel)

 Copy code hover
[image]

WorksheetFunction.YearFrac Method (Excel)
See also Send feedback

Published: July 16, 2012

Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term.

Syntax

expression .YearFrac(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Start_date - a date that represents the start date.
Arg2 | Required | Variant | End_date - a date that represents the end date.
Arg3 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • All arguments are truncated to integers.

  • If start_date or end_date are not valid dates, YEARFRAC returns the #VALUE! error value.

  • If basis < 0 or if basis > 4, YEARFRAC returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.YieldDisc Method (Excel)

 Copy code hover
[image]

WorksheetFunction.YieldDisc Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the annual yield for a discounted security.

Syntax

expression .YieldDisc(Arg1, Arg2, Arg3, Arg4, Arg5)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Pr - the security's price per $100 face value.
Arg4 | Required | Variant | Redemption - the security's redemption value per $100 face value.
Arg5 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, and basis are truncated to integers.

  • If settlement or maturity is not a valid date, YIELDDISC returns the #VALUE! error value.

  • If pr ≤ 0 or if redemption ≤ 0, YIELDDISC returns the #NUM! error value.

  • If basis < 0 or if basis > 4, YIELDDISC returns the #NUM! error value.

  • If settlement ≥ maturity, YIELDDISC returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.YieldMat Method (Excel)

 Copy code hover
[image]

WorksheetFunction.YieldMat Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the annual yield of a security that pays interest at maturity.

Syntax

expression .YieldMat(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Settlement - the security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
Arg2 | Required | Variant | Maturity - the security's maturity date. The maturity date is the date when the security expires.
Arg3 | Required | Variant | Issue - the security's issue date, expressed as a serial date number.
Arg4 | Required | Variant | Rate - the security's interest rate at date of issue.
Arg5 | Required | Variant | Pr - the security's price per $100 face value.
Arg6 | Optional | Variant | Basis - the type of day count basis to use.

Return Value

Double

Remarks

Important note Important

Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Basis | Day count basis
0 or omitted | US (NASD) 30/360
1 | Actual/actual
2 | Actual/360
3 | Actual/365
4 | European 30/360

  • Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

    Note Note

    Visual Basic for Applications (VBA) calculates serial dates differently than Excel. In VBA, serial number 1 is December 31, 1899, rather than January 1, 1900.

  • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.

  • Settlement, maturity, issue, and basis are truncated to integers.

  • If settlement, maturity, or issue is not a valid date, YIELDMAT returns the #VALUE! error value.

  • If rate < 0 or if pr ≤ 0, YIELDMAT returns the #NUM! error value.

  • If basis < 0 or if basis > 4, YIELDMAT returns the #NUM! error value.

  • If settlement ≥ maturity, YIELDMAT returns the #NUM! error value.

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.Z_Test Method (Excel)

 Copy code hover
[image]

WorksheetFunction.Z_Test Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, Z_TEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.

Version Information

Version Added: Excel 2010

Syntax

expression .Z_Test(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array is the array or range of data against which to test the hypothesized population mean.
Arg2 | Required | Double | The value to test.
Arg3 | Optional | Variant | Sigma - The population (known) standard deviation. If omitted, the sample standard deviation is used.

Return Value

Double

Remarks

  • If array is empty, Z_TEST returns the #N/A error value.

  • Z_TEST is calculated as follows when sigma is not omitted: or when sigma is omitted: where x is the sample mean AVERAGE(array); s is the sample standard deviation STDEV_S(array); and n is the number of observations in the sample COUNT(array).

  • Z_TEST represents the probability that the sample mean would be greater than the observed value AVERAGE(array), when the underlying population mean is μ 0 . From the symmetry of the Normal distribution, if AVERAGE(array) < μ 0 , Z_TEST will return a value greater than 0.5.

  • The following Excel formula can be used to calculate the two-tailed probability that the sample mean would be further from μ 0 (in either direction) than AVERAGE(array), when the underlying population mean is μ 0 : =2 * MIN(Z_TEST(array,μ 0 ,sigma), 1 - Z_TEST(array,μ 0 ,sigma)).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


WorksheetFunction.ZTest Method (Excel)

 Copy code hover
[image]

WorksheetFunction.ZTest Method (Excel)
See also Send feedback

Published: July 16, 2012

Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, ZTEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) — that is, the observed sample mean.

Important note Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the Z_Test method.

Syntax

expression .ZTest(Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | Variant | Array is the array or range of data against which to test the hypothesized population mean.
Arg2 | Required | Double | The value to test.
Arg3 | Optional | Variant | Sigma - the population (known) standard deviation. If omitted, the sample standard deviation is used.

Return Value

Double

Remarks

  • If array is empty, ZTEST returns the #N/A error value.

  • ZTEST is calculated as follows when sigma is not omitted: or when sigma is omitted: where x is the sample mean AVERAGE(array); s is the sample standard deviation STDEV(array); and n is the number of observations in the sample COUNT(array).

  • ZTEST represents the probability that the sample mean would be greater than the observed value AVERAGE(array), when the underlying population mean is μ 0 . From the symmetry of the Normal distribution, if AVERAGE(array) < μ 0 , ZTEST will return a value greater than 0.5.

  • The following Excel formula can be used to calculate the two-tailed probability that the sample mean would be further from μ 0 (in either direction) than AVERAGE(array), when the underlying population mean is μ 0 : =2 * MIN(ZTEST(array,μ 0 ,sigma), 1 - ZTEST(array,μ 0 ,sigma)).

See also

Concepts

WorksheetFunction Object

Other resources

WorksheetFunction Object Members


Worksheets Object (Excel)

 Copy code hover
[image]

Worksheets Object (Excel)
See also Send feedback

Published: July 16, 2012

A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.

Remarks

The Worksheet object is also a member of the Sheets collection. The Sheets collection contains all the sheets in the workbook (both chart sheets and worksheets).

Example

Use the Worksheets property to return the Worksheets collection.The following example moves all the worksheets to the end of the workbook.

VBA Copy code Copy code
Worksheets.Move After:=Sheets(Sheets.Count)

Use the Add method to create a new worksheet and add it to the collection. The following example adds two new worksheets before sheet one of the active workbook.

VBA Copy code Copy code
Worksheets.Add Count:=2, Before:=Sheets(1)

Use Worksheets(index), where index is the worksheet index number or name, to return a single Worksheet object. The following example hides worksheet one in the active workbook.

VBA Copy code Copy code
Worksheets(1).Visible = False

See also

Concepts

Excel Object Model Reference

Other resources

Worksheets Object Members


Worksheets Members (Excel)

 Copy code hover
[image]

Worksheets Members (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.

Methods

Name | Description
Add | Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.
Add2 | This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
FillAcrossSheets | Copies a range to the same area on all other worksheets in a collection.
Move | Moves the sheet to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Worksheets Properties (Excel)

 Copy code hover
[image]

Worksheets Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
HPageBreaks | Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Visible | Returns or sets a Variant value that determines whether the object is visible.
VPageBreaks | Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.


Worksheets.Application Property (Excel)

 Copy code hover
[image]

Worksheets.Application Property (Excel)
See also Send feedback

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a Worksheets object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Count Property (Excel)

 Copy code hover
[image]

Worksheets.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a Worksheets object.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Creator Property (Excel)

 Copy code hover
[image]

Worksheets.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Worksheets object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.HPageBreaks Property (Excel)

 Copy code hover
[image]

Worksheets.HPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.

Syntax

expression .HPageBreaks

expression A variable that represents a Worksheets object.

Remarks

There is a limit of 1026 horizontal page breaks per sheet.

Example

This example displays the number of full-screen and print-area horizontal page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).HPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Item Property (Excel)

 Copy code hover
[image]

Worksheets.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

Remarks

For more information about returning a single member of a collection, see Returning an Object from a Collection.

Example

Item is the default member for a collection. For example, the following two lines of code are equivalent.

VBA Copy code Copy code
ActiveWorkbook.Worksheets.Item(1)
ActiveWorkbook.Worksheets(1)

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Parent Property (Excel)

 Copy code hover
[image]

Worksheets.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Worksheets object.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Visible Property (Excel)

 Copy code hover
[image]

Worksheets.Visible Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value that determines whether the object is visible.

Syntax

expression .Visible

expression A variable that represents a Worksheets object.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.VPageBreaks Property (Excel)

 Copy code hover
[image]

Worksheets.VPageBreaks Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.

Syntax

expression .VPageBreaks

expression A variable that represents a Worksheets object.

Example

This example displays the total number of full-screen and print-area vertical page breaks.

VBA Copy code Copy code
For Each pb in Worksheets(1).VPageBreaks
 If pb.Extent = xlPageBreakFull Then
 cFull = cFull + 1
 Else
 cPartial = cPartial + 1
 End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
 " print-area page breaks"

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets Methods (Excel)

 Copy code hover
[image]

Worksheets Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.
Add2 | This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.
Copy | Copies the sheet to another location in the workbook.
Delete | Deletes the object.
FillAcrossSheets | Copies a range to the same area on all other worksheets in a collection.
Move | Moves the sheet to another location in the workbook.
PrintOut | Prints the object.
PrintPreview | Shows a preview of the object as it would look when printed.
Select | Selects the object.


Worksheets.Add Method (Excel)

 Copy code hover
[image]

Worksheets.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Creates a new worksheet, chart, or macro sheet. The new worksheet becomes the active sheet.

Syntax

expression .Add(Before, After, Count, Type)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | An object that specifies the sheet before which the new sheet is added.
After | Optional | Variant | An object that specifies the sheet after which the new sheet is added.
Count | Optional | Variant | The number of sheets to be added. The default value is one.
Type | Optional | Variant | Specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. If you are inserting a sheet based on an existing template, specify the path to the template. The default value is xlWorksheet.

Return Value

An Object value that represents the new worksheet, chart, or macro sheet.

Remarks

If Before and After are both omitted, the new sheet is inserted before the active sheet.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Add2 Method (Excel)

 Copy code hover
[image]

Worksheets.Add2 Method (Excel)
See also Send feedback

Published: July 16, 2012

This method is only implemented for the Charts collection object and will produce a run time error if used on the Sheets and Worksheets objects.

Version information

Version Added: Excel 2013

Syntax

expression .Add2(Before,After,Count,NewLayout)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data type | Description
Before | Optional | VARIANT | An object that specifies the sheet before which the new sheet is added.
After | Optional | VARIANT | An object that specifies the sheet after which the new sheet is added.
Count | Optional | VARIANT | The number of sheets to be added. The default value is one.
NewLayout | Optional | VARIANT | The layout of the new worksheet.

Return value

OBJECT

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Copy Method (Excel)

 Copy code hover
[image]

Worksheets.Copy Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies the sheet to another location in the workbook.

Syntax

expression .Copy(Before, After)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the copied sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the copied sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the copied sheet.

Example

This example copies Sheet1, placing the copy after Sheet3.

VBA Copy code Copy code
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Delete Method (Excel)

 Copy code hover
[image]

Worksheets.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Syntax

expression .Delete

expression A variable that represents a Worksheets object.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.FillAcrossSheets Method (Excel)

 Copy code hover
[image]

Worksheets.FillAcrossSheets Method (Excel)
See also Send feedback

Published: July 16, 2012

Copies a range to the same area on all other worksheets in a collection.

Syntax

expression .FillAcrossSheets(Range, Type)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to fill on all the worksheets in the collection. The range must be from a worksheet within the collection.
Type | Optional | XlFillWith | Specifies how to copy the range.

Example

This example fills the range A1:C5 on Sheet1, Sheet5, and Sheet7 with the contents of the same range on Sheet1.

VBA Copy code Copy code
x = Array("Sheet1", "Sheet5", "Sheet7")
Sheets(x).FillAcrossSheets _
 Worksheets("Sheet1").Range("A1:C5")

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Move Method (Excel)

 Copy code hover
[image]

Worksheets.Move Method (Excel)
See also Send feedback

Published: July 16, 2012

Moves the sheet to another location in the workbook.

Syntax

expression .Move(Before, After)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | The sheet before which the moved sheet will be placed. You cannot specify Before if you specify After.
After | Optional | Variant | The sheet after which the moved sheet will be placed. You cannot specify After if you specify Before.

Remarks

If you don't specify either Before or After, Microsoft Excel creates a new workbook that contains the moved sheet.

Example

This example moves Sheet1 after Sheet3 in the active workbook.

VBA Copy code Copy code
Worksheets("Sheet1").Move _
 after:=Worksheets("Sheet3")

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.PrintOut Method (Excel)

 Copy code hover
[image]

Worksheets.PrintOut Method (Excel)
See also Send feedback

Published: July 16, 2012

Prints the object.

Syntax

expression .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Variant | The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.
To | Optional | Variant | The number of the last page to print. If this argument is omitted, printing ends with the last page.
Copies | Optional | Variant | The number of copies to print. If this argument is omitted, one copy is printed.
Preview | Optional | Variant | True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.
ActivePrinter | Optional | Variant | Sets the name of the active printer.
PrintToFile | Optional | Variant | True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.
Collate | Optional | Variant | True to collate multiple copies.
PrToFileName | Optional | Variant | If PrintToFile is set to True, this argument specifies the name of the file you want to print to.
IgnorePrintAreas | Optional | Variant | True to ignore print areas and print the entire object.

Return Value

Variant

Remarks

"Pages" in the descriptions of From and To refers to printed pages — not overall pages in the sheet or workbook.

Example

This example prints the active sheet.

VBA Copy code Copy code
ActiveSheet.PrintOut

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.PrintPreview Method (Excel)

 Copy code hover
[image]

Worksheets.PrintPreview Method (Excel)
See also Send feedback

Published: July 16, 2012

Shows a preview of the object as it would look when printed.

Syntax

expression .PrintPreview(EnableChanges)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
EnableChanges | Optional | Variant | Pass a Boolean value to specify if the user can change the margins and other page setup options available in print preview.

Example

This example displays Sheet1 in print preview.

VBA Copy code Copy code
Worksheets("Sheet1").PrintPreview

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


Worksheets.Select Method (Excel)

 Copy code hover
[image]

Worksheets.Select Method (Excel)
See also Send feedback

Published: July 16, 2012

Selects the object.

Syntax

expression .Select(Replace)

expression A variable that represents a Worksheets object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | (used only with sheets). True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object.

See also

Concepts

Worksheets Object

Other resources

Worksheets Object Members


WorksheetView Object (Excel)

 Copy code hover
[image]

WorksheetView Object (Excel)
See also Send feedback

Published: July 16, 2012

An object that defines the behavior of a single worksheet view.

Version Information

Version Added: Excel 2007

Remarks

Controls the look and feel of the application or workbook-level view by providing properties such as DisplayFormulas, DisplayGridlines, and DisplayHeadings.

See also

Concepts

Excel Object Model Reference

Other resources

WorksheetView Object Members


WorksheetView Members (Excel)

 Copy code hover
[image]

WorksheetView Members (Excel)
Send feedback

Published: July 16, 2012

An object that defines the behavior of a single worksheet view.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFormulas | Returns or sets if formulas should be displayed or hidden in the current worksheet view. Read/write Boolean.
DisplayGridlines | True if gridlines are displayed. Read/write Boolean.
DisplayHeadings | True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.
DisplayOutline | True if outline symbols are displayed. Read/write Boolean.
DisplayZeros | True if zero values are displayed. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified WorksheetView object. Read-only.


WorksheetView Properties (Excel)

 Copy code hover
[image]

WorksheetView Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DisplayFormulas | Returns or sets if formulas should be displayed or hidden in the current worksheet view. Read/write Boolean.
DisplayGridlines | True if gridlines are displayed. Read/write Boolean.
DisplayHeadings | True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.
DisplayOutline | True if outline symbols are displayed. Read/write Boolean.
DisplayZeros | True if zero values are displayed. Read/write Boolean.
Parent | Returns the parent object for the specified object. Read-only.
Sheet | Returns the sheet name for the specified WorksheetView object. Read-only.


WorksheetView.Application Property (Excel)

 Copy code hover
[image]

WorksheetView.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Application

expression A variable that represents a WorksheetView object.

Remarks

You can use this property with an OLE Automation object to return the application of that object.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.Creator Property (Excel)

 Copy code hover
[image]

WorksheetView.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a WorksheetView object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.DisplayFormulas Property (Excel)

 Copy code hover
[image]

WorksheetView.DisplayFormulas Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets if formulas should be displayed or hidden in the current worksheet view. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayFormulas

expression A variable that represents a WorksheetView object.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.DisplayGridlines Property (Excel)

 Copy code hover
[image]

WorksheetView.DisplayGridlines Property (Excel)
See also Send feedback

Published: July 16, 2012

True if gridlines are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayGridlines

expression A variable that represents a WorksheetView object.

Remarks

This property applies only to worksheets and macro sheets.

This property affects only displayed gridlines. Use the PrintGridlines property to control the printing of gridlines.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.DisplayHeadings Property (Excel)

 Copy code hover
[image]

WorksheetView.DisplayHeadings Property (Excel)
See also Send feedback

Published: July 16, 2012

True if both row and column headings are displayed; False if no headings are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayHeadings

expression A variable that represents a WorksheetView object.

Remarks

This property applies only to worksheets and macro sheets.

This property affects only displayed headings. Use the PrintHeadings property to control the printing of headings.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.DisplayOutline Property (Excel)

 Copy code hover
[image]

WorksheetView.DisplayOutline Property (Excel)
See also Send feedback

Published: July 16, 2012

True if outline symbols are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayOutline

expression A variable that represents a WorksheetView object.

Remarks

This property applies only to worksheets and macro sheets.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.DisplayZeros Property (Excel)

 Copy code hover
[image]

WorksheetView.DisplayZeros Property (Excel)
See also Send feedback

Published: July 16, 2012

True if zero values are displayed. Read/write Boolean.

Version Information

Version Added: Excel 2007

Syntax

expression .DisplayZeros

expression A variable that represents a WorksheetView object.

Remarks

This property applies only to worksheets and macro sheets.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.Parent Property (Excel)

 Copy code hover
[image]

WorksheetView.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Parent

expression A variable that represents a WorksheetView object.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


WorksheetView.Sheet Property (Excel)

 Copy code hover
[image]

WorksheetView.Sheet Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the sheet name for the specified WorksheetView object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .Sheet

expression A variable that represents a WorksheetView object.

See also

Concepts

WorksheetView Object

Other resources

WorksheetView Object Members


XmlDataBinding Object (Excel)

 Copy code hover
[image]

XmlDataBinding Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the connection to the source data for an XmlMap object.

Remarks

Use the LoadSettings method initialize the settings for an XmlDataBinding object

Use the Refresh method to refresh a data binding.

Use the ClearSettings method to remove a data binding.

See also

Concepts

Excel Object Model Reference

Other resources

XmlDataBinding Object Members


XmlDataBinding Members (Excel)

 Copy code hover
[image]

XmlDataBinding Members (Excel)
Send feedback

Published: July 16, 2012

Represents the connection to the source data for an XmlMap object.

Methods

Name | Description
ClearSettings | Removes the specified data binding.
LoadSettings | Initializes the specified data binding with settings from an XML data file or a Data Retrieval Service Connection (.uxdc) file.
Refresh | Retrieves XML data using the current connection settings of the specified XmlDataBinding object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SourceUrl | Returns a String that represents the path to the XML data file or the Web service that provides the source data for the specified data binding. Read-only.


XmlDataBinding Properties (Excel)

 Copy code hover
[image]

XmlDataBinding Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
SourceUrl | Returns a String that represents the path to the XML data file or the Web service that provides the source data for the specified data binding. Read-only.


XmlDataBinding.Application Property (Excel)

 Copy code hover
[image]

XmlDataBinding.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlDataBinding object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding.Creator Property (Excel)

 Copy code hover
[image]

XmlDataBinding.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlDataBinding object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding.Parent Property (Excel)

 Copy code hover
[image]

XmlDataBinding.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlDataBinding object.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding.SourceUrl Property (Excel)

 Copy code hover
[image]

XmlDataBinding.SourceUrl Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the path to the XML data file or the Web service that provides the source data for the specified data binding. Read-only.

Syntax

expression .SourceUrl

expression A variable that represents a XmlDataBinding object.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding Methods (Excel)

 Copy code hover
[image]

XmlDataBinding Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearSettings | Removes the specified data binding.
LoadSettings | Initializes the specified data binding with settings from an XML data file or a Data Retrieval Service Connection (.uxdc) file.
Refresh | Retrieves XML data using the current connection settings of the specified XmlDataBinding object.


XmlDataBinding.ClearSettings Method (Excel)

 Copy code hover
[image]

XmlDataBinding.ClearSettings Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes the specified data binding.

Syntax

expression .ClearSettings

expression A variable that represents a XmlDataBinding object.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding.LoadSettings Method (Excel)

 Copy code hover
[image]

XmlDataBinding.LoadSettings Method (Excel)
See also Send feedback

Published: July 16, 2012

Initializes the specified data binding with settings from an XML data file or a Data Retrieval Service Connection (.uxdc) file.

Syntax

expression .LoadSettings(Url)

expression A variable that represents a XmlDataBinding object.

Parameters

Name | Required/Optional | Data Type | Description
Url | Required | String | The path to the XML data file. The path is specified in the Uniform Resource Locator (URL) or universal naming convention (UNC) format.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlDataBinding.Refresh Method (Excel)

 Copy code hover
[image]

XmlDataBinding.Refresh Method (Excel)
See also Send feedback

Published: July 16, 2012

Retrieves XML data using the current connection settings of the specified XmlDataBinding object.

Syntax

expression .Refresh

expression A variable that represents a XmlDataBinding object.

Return Value

An XlXmlImportResult value that indicates the result of the method.

See also

Concepts

XmlDataBinding Object

Other resources

XmlDataBinding Object Members


XmlMap Object (Excel)

 Copy code hover
[image]

XmlMap Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an XML map that has been added to a workbook.

Remarks

Use the Add method of the XmlMaps collection to add an XML map to a workbook.

Importing and exporting XML data

Use the Import method to import XML data from an XML data file into cells mapped to the specified XmlMap. The ImportXml method imports XML data for a String variable.

Use the Export method to export data from cells mapped to the specified XmlMap. The ExportXml method exports XML data to a String variable.

See also

Concepts

Excel Object Model Reference

Other resources

XmlMap Object Members


XmlMap Members (Excel)

 Copy code hover
[image]

XmlMap Members (Excel)
Send feedback

Published: July 16, 2012

Represents an XML map that has been added to a workbook.

Methods

Name | Description
Delete | Removes the specified XML map from the workbook.
Export | Exports the contents of cells mapped to the specified XmlMap object to an XML data file.
ExportXml | Exports the contents of cells mapped to the specified XmlMap object to a String variable.
Import | Imports data from the specified XML data file into cells that have been mapped to the specified XmlMap object.
ImportXml | Imports XML data from a String variable into cells that have been mapped to the specified XmlMap object.

Properties

Name | Description
AdjustColumnWidth | True if the column widths are automatically adjusted for the best fit each time you refresh the specified XML map. False if the column widths aren't automatically adjusted with each refresh. The default value is True. Read/write Boolean.
AppendOnImport | True if you want to append new rows to XML lists that are bound to the specified schema map when you are importing new data or refreshing an existing connection. False if you want to overwrite the contents of cells that are bound to the specified schema map when you are importing new data or refreshing an existing connection. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBinding | Returns an XmlDataBinding object that represents the binding associated with the specified schema map. Read-only.
IsExportable | Returns True if Microsoft Excel can use the XPath objects in the specified schema map to export XML data and all XML lists mapped to the specified schema map can be exported.
Name | Returns or sets a String value that represents the friendly name used to uniquely identify a mapping in the workbook.
Parent | Returns the parent object for the specified object. Read-only.
PreserveColumnFilter | Returns or sets whether filtering is preserved when the specified XML map is refreshed. Read/write Boolean.
PreserveNumberFormatting | True if number formatting on cells mapped to the specified XML schema map will be preserved when the schema map is refreshed. The default value is False. Read/write Boolean.
RootElementName | Returns a String that represents the name of the root element for the specified XML schema map. Read-only.
RootElementNamespace | Returns an XmlNamespace object that represents the root element for the specified XML schema map. Read-only.
SaveDataSourceDefinition | True if the data source definition of the specified XML schema map is saved with the workbook. The default value is True. Read/write Boolean.
Schemas | Returns an XmlSchemas collection that represents the schemas that the specified XmlMap object contains. Read-only.
ShowImportExportValidationErrors | Returns or sets whether to display a dialog box that details schema-validation errors when data is imported or exported through the specified XML schema map. The default value is False. Read/write Boolean.
WorkbookConnection | Retuns a new connection for the specified XMLMap object. Read-only.


XmlMap Properties (Excel)

 Copy code hover
[image]

XmlMap Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AdjustColumnWidth | True if the column widths are automatically adjusted for the best fit each time you refresh the specified XML map. False if the column widths aren't automatically adjusted with each refresh. The default value is True. Read/write Boolean.
AppendOnImport | True if you want to append new rows to XML lists that are bound to the specified schema map when you are importing new data or refreshing an existing connection. False if you want to overwrite the contents of cells that are bound to the specified schema map when you are importing new data or refreshing an existing connection. The default value is False. Read/write Boolean.
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
DataBinding | Returns an XmlDataBinding object that represents the binding associated with the specified schema map. Read-only.
IsExportable | Returns True if Microsoft Excel can use the XPath objects in the specified schema map to export XML data and all XML lists mapped to the specified schema map can be exported.
Name | Returns or sets a String value that represents the friendly name used to uniquely identify a mapping in the workbook.
Parent | Returns the parent object for the specified object. Read-only.
PreserveColumnFilter | Returns or sets whether filtering is preserved when the specified XML map is refreshed. Read/write Boolean.
PreserveNumberFormatting | True if number formatting on cells mapped to the specified XML schema map will be preserved when the schema map is refreshed. The default value is False. Read/write Boolean.
RootElementName | Returns a String that represents the name of the root element for the specified XML schema map. Read-only.
RootElementNamespace | Returns an XmlNamespace object that represents the root element for the specified XML schema map. Read-only.
SaveDataSourceDefinition | True if the data source definition of the specified XML schema map is saved with the workbook. The default value is True. Read/write Boolean.
Schemas | Returns an XmlSchemas collection that represents the schemas that the specified XmlMap object contains. Read-only.
ShowImportExportValidationErrors | Returns or sets whether to display a dialog box that details schema-validation errors when data is imported or exported through the specified XML schema map. The default value is False. Read/write Boolean.
WorkbookConnection | Retuns a new connection for the specified XMLMap object. Read-only.


XmlMap.AdjustColumnWidth Property (Excel)

 Copy code hover
[image]

XmlMap.AdjustColumnWidth Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the column widths are automatically adjusted for the best fit each time you refresh the specified XML map. False if the column widths aren't automatically adjusted with each refresh. The default value is True. Read/write Boolean.

Syntax

expression .AdjustColumnWidth

expression A variable that represents a XmlMap object.

Remarks

The maximum column width is two-thirds the width of the screen.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.AppendOnImport Property (Excel)

 Copy code hover
[image]

XmlMap.AppendOnImport Property (Excel)
See also Send feedback

Published: July 16, 2012

True if you want to append new rows to XML lists that are bound to the specified schema map when you are importing new data or refreshing an existing connection. False if you want to overwrite the contents of cells that are bound to the specified schema map when you are importing new data or refreshing an existing connection. The default value is False. Read/write Boolean.

Syntax

expression .AppendOnImport

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Application Property (Excel)

 Copy code hover
[image]

XmlMap.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlMap object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Creator Property (Excel)

 Copy code hover
[image]

XmlMap.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlMap object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.DataBinding Property (Excel)

 Copy code hover
[image]

XmlMap.DataBinding Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlDataBinding object that represents the binding associated with the specified schema map. Read-only.

Syntax

expression .DataBinding

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.IsExportable Property (Excel)

 Copy code hover
[image]

XmlMap.IsExportable Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if Microsoft Excel can use the XPath objects in the specified schema map to export XML data and all XML lists mapped to the specified schema map can be exported.

Syntax

expression .IsExportable

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Name Property (Excel)

 Copy code hover
[image]

XmlMap.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the friendly name used to uniquely identify a mapping in the workbook.

Syntax

expression .Name

expression A variable that represents a XmlMap object.

Remarks

The string specified for the Name property must be unique within the workbook, and cannot exceed 255 characters.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Parent Property (Excel)

 Copy code hover
[image]

XmlMap.Parent Property (Excel)
See also Send feedback

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.PreserveColumnFilter Property (Excel)

 Copy code hover
[image]

XmlMap.PreserveColumnFilter Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether filtering is preserved when the specified XML map is refreshed. Read/write Boolean.

Syntax

expression .PreserveColumnFilter

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.PreserveNumberFormatting Property (Excel)

 Copy code hover
[image]

XmlMap.PreserveNumberFormatting Property (Excel)
See also Send feedback

Published: July 16, 2012

True if number formatting on cells mapped to the specified XML schema map will be preserved when the schema map is refreshed. The default value is False. Read/write Boolean.

Syntax

expression .PreserveNumberFormatting

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.RootElementName Property (Excel)

 Copy code hover
[image]

XmlMap.RootElementName Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of the root element for the specified XML schema map. Read-only.

Syntax

expression .RootElementName

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.RootElementNamespace Property (Excel)

 Copy code hover
[image]

XmlMap.RootElementNamespace Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlNamespace object that represents the root element for the specified XML schema map. Read-only.

Syntax

expression .RootElementNamespace

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.SaveDataSourceDefinition Property (Excel)

 Copy code hover
[image]

XmlMap.SaveDataSourceDefinition Property (Excel)
See also Send feedback

Published: July 16, 2012

True if the data source definition of the specified XML schema map is saved with the workbook. The default value is True. Read/write Boolean.

Syntax

expression .SaveDataSourceDefinition

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Schemas Property (Excel)

 Copy code hover
[image]

XmlMap.Schemas Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlSchemas collection that represents the schemas that the specified XmlMap object contains. Read-only.

Syntax

expression .Schemas

expression A variable that represents a XmlMap object.

Remarks

The first item in the returned XmlSchemas collection is the schema that is used as the root element of the specified XML schema map.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.ShowImportExportValidationErrors Property (Excel)

 Copy code hover
[image]

XmlMap.ShowImportExportValidationErrors Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display a dialog box that details schema-validation errors when data is imported or exported through the specified XML schema map. The default value is False. Read/write Boolean.

Syntax

expression .ShowImportExportValidationErrors

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.WorkbookConnection Property (Excel)

 Copy code hover
[image]

XmlMap.WorkbookConnection Property (Excel)
See also Send feedback

Published: July 16, 2012

Retuns a new connection for the specified XMLMap object. Read-only.

Version Information

Version Added: Excel 2007

Syntax

expression .WorkbookConnection

expression A variable that represents a XmlMap object.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap Methods (Excel)

 Copy code hover
[image]

XmlMap Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Removes the specified XML map from the workbook.
Export | Exports the contents of cells mapped to the specified XmlMap object to an XML data file.
ExportXml | Exports the contents of cells mapped to the specified XmlMap object to a String variable.
Import | Imports data from the specified XML data file into cells that have been mapped to the specified XmlMap object.
ImportXml | Imports XML data from a String variable into cells that have been mapped to the specified XmlMap object.


XmlMap.Delete Method (Excel)

 Copy code hover
[image]

XmlMap.Delete Method (Excel)
See also Send feedback

Published: July 16, 2012

Removes the specified XML map from the workbook.

Syntax

expression .Delete

expression A variable that represents a XmlMap object.

Remarks

Deleting the XML map will convert all of the XML Lists to generic Lists and remove all of the single-cell mappings (with the data still remaining). In addition, the XmlMap object will be removed from the XmlMaps collection. The map and schema information will be removed from the workbook (it will no longer be persisted in the XLS file and XMLSS). Any references to the deleted object become invalid.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Export Method (Excel)

 Copy code hover
[image]

XmlMap.Export Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports the contents of cells mapped to the specified XmlMap object to an XML data file.

Syntax

expression .Export(Url, Overwrite)

expression An expression that returns an XmlMap object.

Parameters

Name | Required/Optional | Data Type | Description
Url | Required | String | The path and file name of the XML data file to export to.
Overwrite | Optional | Variant | Set to True to overwrite the file specified in the URL parameter if the file exists. The default value is False.

Return Value

An XlXmlExportResult value that indicates the result of the method.

Remarks

Use the ExportXml method to export the contents of the mapped cells to a String variable.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.ExportXml Method (Excel)

 Copy code hover
[image]

XmlMap.ExportXml Method (Excel)
See also Send feedback

Published: July 16, 2012

Exports the contents of cells mapped to the specified XmlMap object to a String variable.

Syntax

expression .ExportXml(Data)

expression A variable that represents a XmlMap object.

Parameters

Name | Required/Optional | Data Type | Description
Data | Required | String | The variable to export the data to.

Return Value

XlXmlExportResult

Remarks

XlXmlExportResult can be one of the following XlXmlExportResult constants.

xlXmlExportSuccess . Export successful. No errors to report.

xlXmlExportValidationFailed . The data being exported failed schema validation, but was exported anyway.

To export the contents of the mapped cells to an XML data file, use the Export method.

Example

The following example exports the contents of the cells mapped to the "Contacts" schema map to a variable named strContactData.

VBA Copy code Copy code
Sub ExportToString()
 Dim strContactData As String

 ActiveWorkbook.XmlMaps("Contacts").ExportXml Data:=strContactData
End Sub

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.Import Method (Excel)

 Copy code hover
[image]

XmlMap.Import Method (Excel)
See also Send feedback

Published: July 16, 2012

Imports data from the specified XML data file into cells that have been mapped to the specified XmlMap object.

Syntax

expression .Import(Url, Overwrite)

expression A variable that represents a XmlMap object.

Parameters

Name | Required/Optional | Data Type | Description
Url | Required | String | The path to the XML data to import. The path can be specified in Universal Naming convention (UNC) or Uniform Resource Locator (URL) format. The file can be an XML data file.
Overwrite | Optional | Variant | Set to True to overwrite existing data. Set to False to append to existing data. The default value is False.

Return Value

A XlXmlImportResult value that indicates the result of the method.

Remarks

This method returns one of the following XlXmlImportResult constants:

xlXmlImportElementsTruncated The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess The XML data file was successfully imported.

xlXmlImportValidationFailed The data being imported failed schema validation, but was imported anyway.

If either of the following conditions is true, a runtime error will occur. If more than one condition is true, Excel returns a runtime error for the most severe (they are listed below with the most severe listed first):

  • If the XML data contains syntactical errors.

  • If import is cancelled because not all of the data could fit in the worksheet.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMap.ImportXml Method (Excel)

 Copy code hover
[image]

XmlMap.ImportXml Method (Excel)
See also Send feedback

Published: July 16, 2012

Imports XML data from a String variable into cells that have been mapped to the specified XmlMap object.

Syntax

expression .ImportXml(XmlData, Overwrite)

expression A variable that represents a XmlMap object.

Parameters

Name | Required/Optional | Data Type | Description
XmlData | Required | String | The string that contains the XML data to import.
Overwrite | Optional | Variant | Specifies whether to overwrite the contents of cells that are currently mapped to the specified XML map. Set to True to overwrite the cells; set to False to append the data to the existing range. If this parameter is not specified, the current value of the AppendOnImport property of the XML map determines whether the contents of cells are overwritten or not.

Return Value

XlXmlImportResult

Remarks

XlXmlImportResult can be one of the following XlXmlImportResult constants.

xlXmlImportElementsTruncated. The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess. The XML data file was successfully imported.

xlXmlImportValidationFailed. The data being imported failed schema validation, but was imported anyway.

To import the contents of an XML data file into cells mapped to a specific schema map, use the Import method of the XmlMap object.

If either of the following conditions is true, a runtime error will occur. If more than one condition is true, Excel returns a runtime error for the most severe (they are listed below with the most severe listed first):

  • If the XML data contains syntactical errors.

  • If import is cancelled because not all of the data could fit in the worksheet.

See also

Concepts

XmlMap Object

Other resources

XmlMap Object Members


XmlMaps Object (Excel)

 Copy code hover
[image]

XmlMaps Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of XmlMap objects that have been added to a workbook.

Example

Use the Add method to add an XML map to a workbook.

VBA Copy code Copy code
Sub AddXmlMap()
 Dim strSchemaLocation As String

 strSchemaLocation = "http://example.microsoft.com/schemas/CustomerData.xsd"
 ActiveWorkbook.XmlMaps.Add strSchemaLocation, "Root"
End Sub

See also

Concepts

Excel Object Model Reference

Other resources

XmlMaps Object Members


XmlMaps Members (Excel)

 Copy code hover
[image]

XmlMaps Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of XmlMap objects that have been added to a workbook.

Methods

Name | Description
Add | Adds an XML map to the specified workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


XmlMaps Properties (Excel)

 Copy code hover
[image]

XmlMaps Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


XmlMaps.Application Property (Excel)

 Copy code hover
[image]

XmlMaps.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlMaps object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlMaps.Count Property (Excel)

 Copy code hover
[image]

XmlMaps.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a XmlMaps object.

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlMaps.Creator Property (Excel)

 Copy code hover
[image]

XmlMaps.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlMaps object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlMaps.Item Property (Excel)

 Copy code hover
[image]

XmlMaps.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a XmlMaps object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlMaps.Parent Property (Excel)

 Copy code hover
[image]

XmlMaps.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlMaps object.

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlMaps Methods (Excel)

 Copy code hover
[image]

XmlMaps Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds an XML map to the specified workbook.


XmlMaps.Add Method (Excel)

 Copy code hover
[image]

XmlMaps.Add Method (Excel)
See also Send feedback

Published: July 16, 2012

Adds an XML map to the specified workbook.

Syntax

expression .Add(Schema, RootElementName)

expression An expression that returns a XmlMaps object.

Parameters

Name | Required/Optional | Data Type | Description
Schema | Required | String | The schema to be added as an XML map. The string can be a path to a schema file, or the schema itself. The path can be specified in the Universal Naming Convention (UNC) or Uniform Resource Locator (URL) format.
RootElementName | Optional | Variant | The name of the root element. This argument can be ignored if the schema contains only one root element.

Return Value

An XmlMap object that represents the new XML map.

See also

Concepts

XmlMaps Object

Other resources

XmlMaps Object Members


XmlNamespace Object (Excel)

 Copy code hover
[image]

XmlNamespace Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents a namespace that has been added to a workbook.

Remarks

Use the Prefix property to return the prefix of an XmlNamespace object.

Use the Uri property to return the Uniform Resource Identifier (URI) of an XmlNamespace object.

See also

Concepts

Excel Object Model Reference

Other resources

XmlNamespace Object Members


XmlNamespace Members (Excel)

 Copy code hover
[image]

XmlNamespace Members (Excel)
Send feedback

Published: July 16, 2012

Represents a namespace that has been added to a workbook.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Prefix | Returns a String that represents the prefix for the specified XML namespace. Read-only.
Uri | Returns a String that represents the Uniform Resource Identifier (URI) for the specified XML namespace. Read-only.


XmlNamespace Properties (Excel)

 Copy code hover
[image]

XmlNamespace Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Parent | Returns the parent object for the specified object. Read-only.
Prefix | Returns a String that represents the prefix for the specified XML namespace. Read-only.
Uri | Returns a String that represents the Uniform Resource Identifier (URI) for the specified XML namespace. Read-only.


XmlNamespace.Application Property (Excel)

 Copy code hover
[image]

XmlNamespace.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlNamespace object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlNamespace Object

Other resources

XmlNamespace Object Members


XmlNamespace.Creator Property (Excel)

 Copy code hover
[image]

XmlNamespace.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlNamespace object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlNamespace Object

Other resources

XmlNamespace Object Members


XmlNamespace.Parent Property (Excel)

 Copy code hover
[image]

XmlNamespace.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlNamespace object.

See also

Concepts

XmlNamespace Object

Other resources

XmlNamespace Object Members


XmlNamespace.Prefix Property (Excel)

 Copy code hover
[image]

XmlNamespace.Prefix Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the prefix for the specified XML namespace. Read-only.

Syntax

expression .Prefix

expression A variable that represents a XmlNamespace object.

See also

Concepts

XmlNamespace Object

Other resources

XmlNamespace Object Members


XmlNamespace.Uri Property (Excel)

 Copy code hover
[image]

XmlNamespace.Uri Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the Uniform Resource Identifier (URI) for the specified XML namespace. Read-only.

Syntax

expression .Uri

expression A variable that represents a XmlNamespace object.

See also

Concepts

XmlNamespace Object

Other resources

XmlNamespace Object Members


XmlNamespaces Object (Excel)

 Copy code hover
[image]

XmlNamespaces Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of XmlNamespace objects in a workbook.

Remarks

Use the Item method to access a particular XmlNamespace object.

Use the Value property to return a String that lists the namespaces that have been added to a workbook.

See also

Concepts

Excel Object Model Reference

Other resources

XmlNamespaces Object Members


XmlNamespaces Members (Excel)

 Copy code hover
[image]

XmlNamespaces Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of XmlNamespace objects in a workbook.

Methods

Name | Description
InstallManifest | Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Value | Returns a String value that represents the XML namespaces that have been added to the workbook.


XmlNamespaces Properties (Excel)

 Copy code hover
[image]

XmlNamespaces Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.
Value | Returns a String value that represents the XML namespaces that have been added to the workbook.


XmlNamespaces.Application Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlNamespaces object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces.Count Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a XmlNamespaces object.

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces.Creator Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlNamespaces object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces.Item Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a XmlNamespaces object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces.Parent Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlNamespaces object.

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces.Value Property (Excel)

 Copy code hover
[image]

XmlNamespaces.Value Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the XML namespaces that have been added to the workbook.

Syntax

expression .Value

expression A variable that represents a XmlNamespaces object.

Remarks

If the workbook contains more than one namespace, then the namespaces are seperated by a blank space in the string returned by the Value property.

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlNamespaces Methods (Excel)

 Copy code hover
[image]

XmlNamespaces Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
InstallManifest | Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.


XmlNamespaces.InstallManifest Method (Excel)

 Copy code hover
[image]

XmlNamespaces.InstallManifest Method (Excel)
See also Send feedback

Published: July 16, 2012

Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.

Syntax

expression .InstallManifest(Path, InstallForAllUsers)

expression A variable that represents a XmlNamespaces object.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path and file name of the XML expansion pack.
InstallForAllUsers | Optional | Variant | True installs the XML expansion pack and makes it available to all users on a machine. False makes the XML expansion pack available for the current user only. Default is False.

Remarks

For security purposes, you cannot install an unsigned manifest. For more information about manifests, see the Smart Document Software Development Kit (SDK) on the Microsoft Developer Network (MSDN) Web site.

Example

The following example installs the SimpleSample smart document solution on the user's computer and makes it available only to the current user.

Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, see the Smart Document SDK.

VBA Copy code Copy code
Application.XMLNamespaces.InstallManifest _
 "http://smartdocuments/simplesample/manifest.xml"

See also

Concepts

XmlNamespaces Object

Other resources

XmlNamespaces Object Members


XmlSchema Object (Excel)

 Copy code hover
[image]

XmlSchema Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an XML schema contained by an XmlMap object.

Remarks

Use the Item method to return an XmlSchema object from the XmlSchemas collection.

Use the Namespace property to return the target namespace for a schema.

Use the XML property to return the XML contents of a schema.

See also

Concepts

Excel Object Model Reference

Other resources

XmlSchema Object Members


XmlSchema Members (Excel)

 Copy code hover
[image]

XmlSchema Members (Excel)
Send feedback

Published: July 16, 2012

Represents an XML schema contained by an XmlMap object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns a String value that represents the friendly name used to identify an XML schema in an XmlMap object.
Namespace | Returns an XmlNamespace object that represents the target namespace for the specified schema. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
XML | Returns a String value that represents the content of the specified schema.


XmlSchema Properties (Excel)

 Copy code hover
[image]

XmlSchema Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Name | Returns a String value that represents the friendly name used to identify an XML schema in an XmlMap object.
Namespace | Returns an XmlNamespace object that represents the target namespace for the specified schema. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
XML | Returns a String value that represents the content of the specified schema.


XmlSchema.Application Property (Excel)

 Copy code hover
[image]

XmlSchema.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlSchema object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchema.Creator Property (Excel)

 Copy code hover
[image]

XmlSchema.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlSchema object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchema.Name Property (Excel)

 Copy code hover
[image]

XmlSchema.Name Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the friendly name used to identify an XML schema in an XmlMap object.

Syntax

expression .Name

expression A variable that represents a XmlSchema object.

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchema.Namespace Property (Excel)

 Copy code hover
[image]

XmlSchema.Namespace Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlNamespace object that represents the target namespace for the specified schema. Read-only.

Syntax

expression .Namespace

expression A variable that represents a XmlSchema object.

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchema.Parent Property (Excel)

 Copy code hover
[image]

XmlSchema.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlSchema object.

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchema.XML Property (Excel)

 Copy code hover
[image]

XmlSchema.XML Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the content of the specified schema.

Syntax

expression .XML

expression A variable that represents a XmlSchema object.

See also

Concepts

XmlSchema Object

Other resources

XmlSchema Object Members


XmlSchemas Object (Excel)

 Copy code hover
[image]

XmlSchemas Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents the collection of XmlSchema objects contained by an XmlMap object.

Remarks

Use the Schemas property of the XmlMap object to return the XmlSchemas collection.

Use the Item method to return an XmlSchema object from the XmlSchemas collection.

See also

Concepts

Excel Object Model Reference

Other resources

XmlSchemas Object Members


XmlSchemas Members (Excel)

 Copy code hover
[image]

XmlSchemas Members (Excel)
Send feedback

Published: July 16, 2012

Represents the collection of XmlSchema objects contained by an XmlMap object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


XmlSchemas Properties (Excel)

 Copy code hover
[image]

XmlSchemas Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Count | Returns a Long value that represents the number of objects in the collection.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Item | Returns a single object from a collection.
Parent | Returns the parent object for the specified object. Read-only.


XmlSchemas.Application Property (Excel)

 Copy code hover
[image]

XmlSchemas.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XmlSchemas object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XmlSchemas Object

Other resources

XmlSchemas Object Members


XmlSchemas.Count Property (Excel)

 Copy code hover
[image]

XmlSchemas.Count Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a Long value that represents the number of objects in the collection.

Syntax

expression .Count

expression A variable that represents a XmlSchemas object.

See also

Concepts

XmlSchemas Object

Other resources

XmlSchemas Object Members


XmlSchemas.Creator Property (Excel)

 Copy code hover
[image]

XmlSchemas.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XmlSchemas object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XmlSchemas Object

Other resources

XmlSchemas Object Members


XmlSchemas.Item Property (Excel)

 Copy code hover
[image]

XmlSchemas.Item Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Syntax

expression .Item(Index)

expression A variable that represents a XmlSchemas object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number of the object.

See also

Concepts

XmlSchemas Object

Other resources

XmlSchemas Object Members


XmlSchemas.Parent Property (Excel)

 Copy code hover
[image]

XmlSchemas.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XmlSchemas object.

See also

Concepts

XmlSchemas Object

Other resources

XmlSchemas Object Members


XPath Object (Excel)

 Copy code hover
[image]

XPath Object (Excel)
See also Send feedback

Published: July 16, 2012

Represents an XPath that has been mapped to a Range or ListColumn object.

Example

Use the SetValue method to map an XPath to a range or list column. The SetValue method is also used to change the properties of an existing XPath.

The following example creates an XML list based on the "Contacts" schema map that is attached to the workbook, then uses the SetValue method to bind each column to an XPath.

Use the Clear method to remove an XPath that has been mapped to a range or list column.

VBA Copy code Copy code
Sub CreateXMLList()
 Dim mapContact As XmlMap
 Dim strXPath As String
 Dim lstContacts As ListObject
 Dim lcNewCol As ListColumn

 ' Specify the schema map to use.
 Set mapContact = ActiveWorkbook.XmlMaps("Contacts")

 ' Create a new list.
 Set lstContacts = ActiveSheet.ListObjects.Add

 ' Specify the first element to map.
 strXPath = "/Root/Person/FirstName"
 ' Map the element.
 lstContacts.ListColumns(1).XPath.SetValue mapContact, strXPath

 ' Specify the element to map.
 strXPath = "/Root/Person/LastName"
 ' Add a column to the list.
 Set lcNewCol = lstContacts.ListColumns.Add
 ' Map the element.
 lcNewCol.XPath.SetValue mapContact, strXPath

 strXPath = "/Root/Person/Address/Zip"
 Set lcNewCol = lstContacts.ListColumns.Add
 lcNewCol.XPath.SetValue mapContact, strXPath
End Sub

See also

Concepts

Excel Object Model Reference

Other resources

XPath Object Members


XPath Members (Excel)

 Copy code hover
[image]

XPath Members (Excel)
Send feedback

Represents an XPath that has been mapped to a Range or ListColumn object.

Methods

Name | Description
Clear | Clears all XPath schema information for the mapped range.
SetValue | Maps the specified XPath object to a ListColumn object or Range collection. If the XPath object has previously been mapped to the ListColumn object or Range collection, the SetValue method sets the properties of the XPath object.

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Map | Returns an XmlMap object that represents the schema map that contains the specified XPath object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Repeating | Returns True if the specified XPath object is mapped to an XML list; returns False if the XPath object is mapped to a single cell. Read-only Boolean.
Value | Returns a String that represents the XPath for the specified object.


XPath Properties (Excel)

 Copy code hover
[image]

XPath Properties (Excel)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
Map | Returns an XmlMap object that represents the schema map that contains the specified XPath object. Read-only.
Parent | Returns the parent object for the specified object. Read-only.
Repeating | Returns True if the specified XPath object is mapped to an XML list; returns False if the XPath object is mapped to a single cell. Read-only Boolean.
Value | Returns a String that represents the XPath for the specified object.


XPath.Application Property (Excel)

 Copy code hover
[image]

XPath.Application Property (Excel)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

Syntax

expression .Application

expression A variable that represents a XPath object.

Example

This example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveWorkbook
If myObject.Application.Value = "Microsoft Excel" Then
 MsgBox "This is an Excel Application object."
Else
 MsgBox "This is not an Excel Application object."
End If

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.Creator Property (Excel)

 Copy code hover
[image]

XPath.Creator Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a XPath object.

Remarks

If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. The Creator property is designed to be used in Microsoft Excel for the Macintosh, where each application has a four-character creator code. For example, Microsoft Excel has the creator code XCEL.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.Map Property (Excel)

 Copy code hover
[image]

XPath.Map Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns an XmlMap object that represents the schema map that contains the specified XPath object. Read-only.

Syntax

expression .Map

expression A variable that represents a XPath object.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.Parent Property (Excel)

 Copy code hover
[image]

XPath.Parent Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns the parent object for the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a XPath object.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.Repeating Property (Excel)

 Copy code hover
[image]

XPath.Repeating Property (Excel)
See also Send feedback

Published: July 16, 2012

Returns True if the specified XPath object is mapped to an XML list; returns False if the XPath object is mapped to a single cell. Read-only Boolean.

Syntax

expression .Repeating

expression A variable that represents a XPath object.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.Value Property (Excel)

 Copy code hover
[image]

XPath.Value Property (Excel)
See also Send feedback

Returns a String that represents the XPath for the specified object.

Syntax

expression .Value

expression A variable that represents a XPath object.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath Methods (Excel)

 Copy code hover
[image]

XPath Methods (Excel)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Clears all XPath schema information for the mapped range.
SetValue | Maps the specified XPath object to a ListColumn object or Range collection. If the XPath object has previously been mapped to the ListColumn object or Range collection, the SetValue method sets the properties of the XPath object.


XPath.Clear Method (Excel)

 Copy code hover
[image]

XPath.Clear Method (Excel)
See also Send feedback

Published: July 16, 2012

Clears all XPath schema information for the mapped range.

Syntax

expression .Clear

expression A variable that represents a XPath object.

Remarks

Clear affects the entire range mapped to this XPath object.

This method does not clear the data from the cells mapped to the specified XPath. Use the Clear method of the Range object to clear the data from the cells.

If the specified XPath is mapped in an XML list, then the schema mapping is removed, but the list is not deleted from the worksheet.

If the mapped range is a single-cell then the single-cell is removed and the data remains.

This method will produce an error if any of the following conditions are true:

  • The range spans multiple columns in the grid.

  • Part of the range spans already mapped cells and the rest spans unmapped cells.

  • Part of the range spans one mapping, and another part of the range spans a different mapping or different XPath from the same mapping.

See also

Concepts

XPath Object

Other resources

XPath Object Members


XPath.SetValue Method (Excel)

 Copy code hover
[image]

XPath.SetValue Method (Excel)
See also Send feedback

Published: July 16, 2012

Maps the specified XPath object to a ListColumn object or Range collection. If the XPath object has previously been mapped to the ListColumn object or Range collection, the SetValue method sets the properties of the XPath object.

Syntax

expression .SetValue(Map, XPath, SelectionNamespace, Repeating)

expression A variable that represents a XPath object.

Parameters

Name | Required/Optional | Data Type | Description
Map | Required | XmlMap | The map info that the mapped range will be associated with.
XPath | Required | String | A valid XPath expression that tells Excel what XML data should appear in this mapped range. The XPath string can also contain valid filters, in which case, only a subset of the data that the XPath points to will ever appear in this mapped range.
SelectionNamespace | Optional | Variant | Specifies any namespace prefixes used in the XPath argument. This argument can be omitted if the XPath object doesn't contain any prefixes, or if the XPath object uses the Microsoft Excel internal prefixes.
Repeating | Optional | Variant | Specifies whether the XPath object is to be bound to a column in an XML list, or mapped to a single cell. Set to True to bind the XPath object to a column in an XML list. False forces a non-repeating cell to be created. If the range is greater than a single cell and False is specified, a runtime error will occur.

Remarks

See IsExportable Property for a discussion on XPath support in Excel. If the XPath expression is invalid or if the XPath specified has already been mapped, a runtime error will occur.

If Excel cannot resolve the namespace, a runtime error will occur.

This method will produce an error if any of the following conditions are true:

  • The range spans multiple columns in the grid.

  • Part of the range spans already mapped cells and the rest spans unmapped cells.

  • Part of the range spans one mapping, and another part of the range spans a different mapping or different XPath from the same mapping.

If the range is a single cell then Excel defaults to creating a single-mapped, non-repeating mapped cell. The non-repeating cell is given no header.

The exception to the above statement occurs when the single-cell range lies within a ListObject, in which case, mapping information is applied to the entire column.

If the range spans multiple cells then Excel creates a repeating XML List. Excel treats the selected range as all data values, so when the XML List is created, the range is shifted down by one row and the header is placed in the cell that the top of the range occupied. The insert row lies at the bottom of the shifted range.

Note Note

  • Excel's header detection algorithm is not used in the object model. The assumption is that no headers exist in the grid.

  • Auto-merge and auto-grow are disabled when creating mapped ranges in the object model.

Example

The following example creates an XML list based on the "Contacts" schema map that is attached to the workbook, and then uses the SetValue method to bind each column to an XPath object.

VBA Copy code Copy code
Sub CreateXMLList()
    Dim mapContact As XmlMap
    Dim strXPath As String
    Dim lstContacts As ListObject
    Dim objNewCol As ListColumn

    ' Specify the schema map to use.
    Set mapContact = ActiveWorkbook.XmlMaps("Contacts")

    ' Create a new list.
    Set lstContacts = ActiveSheet.ListObjects.Add

    ' Specify the first element to map.
    strXPath = "/Root/Person/FirstName"
    ' Map the element.
    lstContacts.ListColumns(1).XPath.SetValue mapContact, strXPath

    ' Specify the second element to map.
    strXPath = "/Root/Person/LastName"
    ' Add a column to the list.
    Set objNewCol = lstContacts.ListColumns.Add
    ' Map the element.
    objNewCol.XPath.SetValue mapContact, strXPath

    strXPath = "/Root/Person/Address/Zip"
    Set objNewCol = lstContacts.ListColumns.Add
    objNewCol.XPath.SetValue mapContact, strXPath
End Sub

See also

Concepts

XPath Object

Other resources

XPath Object Members


Enumerations (Excel)

 Copy code hover
[image]

Enumerations (Excel)
Send feedback

Published: July 16, 2012

This section contains documentation for the enumerations in the Excel object model.


Constants Enumeration (Excel)

 Copy code hover
[image]

Constants Enumeration (Excel)
Send feedback

Published: July 16, 2012

This enumeration groups together constants used with various Excel methods.

Version Information

Version Added: Excel 2007

Name | Value | Description
xl3DBar | -4099 | 3D Bar
xl3DEffects1 | 13 | 3D Effects1
xl3DEffects2 | 14 | 3D Effects2
xl3DSurface | -4103 | 3D Surface
xlAbove | 0 | Above
xlAccounting1 | 4 | Accounting1
xlAccounting2 | 5 | Accounting2
xlAccounting4 | 17 | Accounting4
xlAdd | 2 | Add
xlAll | -4104 | All
xlAccounting3 | 6 | Accounting3
xlAllExceptBorders | 7 | All Except Borders
xlAutomatic | -4105 | Automatic
xlBar | 2 | Automatic
xlBelow | 1 | Below
xlBidi | -5000 | Bidi
xlBidiCalendar | 3 | BidiCalendar
xlBoth | 1 | Both
xlBottom | -4107 | Bottom
xlCascade | 7 | Cascade
xlCenter | -4108 | Center
xlCenterAcrossSelection | 7 | Center Across Selection
xlChart4 | 2 | Chart 4
xlChartSeries | 17 | Chart Series
xlChartShort | 6 | Chart Short
xlChartTitles | 18 | Chart Titles
xlChecker | 9 | Checker
xlCircle | 8 | Circle
xlClassic1 | 1 | Classic1
xlClassic2 | 2 | Classic2
xlClassic3 | 3 | Classic3
xlClosed | 3 | Closed
xlColor1 | 7 | Color1
xlColor2 | 8 | Color2
xlColor3 | 9 | Color3
xlColumn | 3 | Column
xlCombination | -4111 | Combination
xlComplete | 4 | Complete
xlConstants | 2 | Constants
xlContents | 2 | Contents
xlContext | -5002 | Context
xlCorner | 2 | Corner
xlCrissCross | 16 | CrissCross
xlCross | 4 | Cross
xlCustom | -4114 | Custom
xlDebugCodePane | 13 | Debug Code Pane
xlDefaultAutoFormat | -1 | Default Auto Format
xlDesktop | 9 | Desktop
xlDiamond | 2 | Diamond
xlDirect | 1 | Direct
xlDistributed | -4117 | Distributed
xlDivide | 5 | Divide
xlDoubleAccounting | 5 | Double Accounting
xlDoubleClosed | 5 | Double Closed
xlDoubleOpen | 4 | Double Open
xlDoubleQuote | 1 | Double Quote
xlDrawingObject | 14 | Drawing Object
xlEntireChart | 20 | Entire Chart
xlExcelMenus | 1 | Excel Menus
xlExtended | 3 | Extended
xlFill | 5 | Fill
xlFirst | 0 | First
xlFixedValue | 1 | Fixed Value
xlFloating | 5 | Floating
xlFormats | -4122 | Formats
xlFormula | 5 | Formula
xlFullScript | 1 | Full Script
xlGeneral | 1 | General
xlGray16 | 17 | Gray16
xlGray25 | -4124 | Gray25
xlGray50 | -4125 | Gray50
xlGray75 | -4126 | Gray75
xlGray8 | 18 | Gray8
xlGregorian | 2 | Gregorian
xlGrid | 15 | Grid
xlGridline | 22 | Gridline
xlHigh | -4127 | High
xlHindiNumerals | 3 | Hindi Numerals
xlIcons | 1 | Icons
xlImmediatePane | 12 | Immediate Pane
xlInside | 2 | Inside
xlInteger | 2 | Integer
xlJustify | -4130 | Justify
xlLast | 1 | Last
xlLastCell | 11 | Last Cell
xlLatin | -5001 | Latin
xlLeft | -4131 | Left
xlLeftToRight | 2 | Left To Right
xlLightDown | 13 | Light Down
xlLightHorizontal | 11 | Light Horizontal
xlLightUp | 14 | Light Up
xlLightVertical | 12 | Light Vertical
xlList1 | 10 | List1
xlList2 | 11 | List2
xlList3 | 12 | List3
xlLocalFormat1 | 15 | Local Format1
xlLocalFormat2 | 16 | Local Format2
xlLogicalCursor | 1 | Logical Cursor
xlLong | 3 | Long
xlLotusHelp | 2 | Lotus Help
xlLow | -4134 | Low
xlLTR | -5003 | LTR
xlMacrosheetCell | 7 | MacrosheetCell
xlManual | -4135 | Manual
xlMaximum | 2 | Maximum
xlMinimum | 4 | Minimum
xlMinusValues | 3 | Minus Values
xlMixed | 2 | Mixed
xlMixedAuthorizedScript | 4 | Mixed Authorized Script
xlMixedScript | 3 | Mixed Script
xlModule | -4141 | Module
xlMultiply | 4 | Multiply
xlNarrow | 1 | Narrow
xlNextToAxis | 4 | Next To Axis
xlNoDocuments | 3 | No Documents
xlNone | -4142 | None
xlNotes | -4144 | Notes
xlOff | -4146 | Off
xlOn | 1 | On
xlOpaque | 3 | Opaque
xlOpen | 2 | Open
xlOutside | 3 | Outside
xlPartial | 3 | Partial
xlPartialScript | 2 | Partial Script
xlPercent | 2 | Percent
xlPlus | 9 | Plus
xlPlusValues | 2 | Plus Values
xlReference | 4 | Reference
xlRight | -4152 | Right
xlRTL | -5004 | RTL
xlScale | 3 | Scale
xlSemiautomatic | 2 | Semiautomatic
xlSemiGray75 | 10 | SemiGray75
xlShort | 1 | Short
xlShowLabel | 4 | Show Label
xlShowLabelAndPercent | 5 | Show Label and Percent
xlShowPercent | 3 | Show Percent
xlShowValue | 2 | Show Value
xlSimple | -4154 | Simple
xlSingle | 2 | Single
xlSingleAccounting | 4 | Single Accounting
xlSingleQuote | 2 | Single Quote
xlSolid | 1 | Solid
xlSquare | 1 | Square
xlStar | 5 | Star
xlStError | 4 | St Error
xlStrict | 2 | Strict
xlSubtract | 3 | Subtract
xlSystem | 1 | System
xlTextBox | 16 | Text Box
xlTiled | 1 | Tiled
xlTitleBar | 8 | Title Bar
xlToolbar | 1 | Toolbar
xlToolbarButton | 2 | Toolbar Button
xlTop | -4160 | Top
xlTopToBottom | 1 | Top To Bottom
xlTransparent | 2 | Transparent
xlTriangle | 3 | Triangle
xlVeryHidden | 2 | Very Hidden
xlVisible | 12 | Visible
xlVisualCursor | 2 | Visual Cursor
xlWatchPane | 11 | Watch Pane
xlWide | 3 | Wide
xlWorkbookTab | 6 | Workbook Tab
xlWorksheet4 | 1 | Worksheet4
xlWorksheetCell | 3 | Worksheet Cell
xlWorksheetShort | 5 | Worksheet Short


XlAboveBelow Enumeration (Excel)

 Copy code hover
[image]

XlAboveBelow Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies if the values are above or below average.

Version Information

Version Added: Excel 2007

Name | Value | Description
XlAboveAverage | 0 | Above average.
XlAboveStdDev | 4 | Above standard deviation.
XlBelowAverage | 1 | Below average.
XlBelowStdDev | 5 | Below standard deviation.
XlEqualAboveAverage | 2 | Equal above average.
XlEqualBelowAverage | 3 | Equal below average.


XlActionType Enumeration (Excel)

 Copy code hover
[image]

XlActionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the action that should be performed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlActionTypeDrillthrough | 256 | Drill through.
xlActionTypeReport | 128 | Report.
xlActionTypeRowset | 16 | Rowset.
xlActionTypeUrl | 1 | URL.


XlAllocation Enumeration (Excel)

 Copy code hover
[image]

XlAllocation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies when to calculate changes when performing what-if analysis on a PivotTable based on an OLAP data source.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlAutomaticAllocation | 2 | Calculate changes automatically after each value is changed.
xlManualAllocation | 1 | Calculate changes manually.


XlAllocationMethod Enumeration (Excel)

 Copy code hover
[image]

XlAllocationMethod Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the method to use to allocate values when performing what-if analysis on a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlEqualAllocation | 1 | Use equal allocation.
xlWeightedAllocation | 2 | Use weighted allocation.

Remarks

If the AllocationMethod property is set to xlWeightedAllocation, you can optionally specify the weight expression to use by setting the AllocationWeightExpression property.


XlAllocationValue Enumeration (Excel)

 Copy code hover
[image]

XlAllocationValue Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what value to allocate when performing what-if analysis on a PivotTable report based on an OLAP data source.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlAllocateIncrement | 2 | Increment based on the old value.
xlAllocateValue | 1 | The value entered divided by the number of allocations.


XlApplicationInternational Enumeration (Excel)

 Copy code hover
[image]

XlApplicationInternational Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies country/region and international settings.

Version Information

Version Added: Excel 2007

Name | Value | Description
xl24HourClock | 33 | True if you're using 24-hour time; False if you're using 12-hour time.
xl4DigitYears | 43 | True if you're using four-digit years; False if you're using two-digit years.
xlAlternateArraySeparator | 16 | Alternate array item separator to be used if the current array separator is the same as the decimal separator.
xlColumnSeparator | 14 | Character used to separate columns in array literals.
xlCountryCode | 1 | Country/Region version of Microsoft Excel.
xlCountrySetting | 2 | Current country/region setting in the Windows Control Panel.
xlCurrencyBefore | 37 | True if the currency symbol precedes the currency values; False if it follows them.
xlCurrencyCode | 25 | Currency symbol.
xlCurrencyDigits | 27 | Number of decimal digits to be used in currency formats.
xlCurrencyLeadingZeros | 40 | True if leading zeros are displayed for zero currency values.
xlCurrencyMinusSign | 38 | True if you're using a minus sign for negative numbers; False if you're using parentheses.
xlCurrencyNegative | 28 | Currency format for negative currency values:0 = (symbolx) or (xsymbol)1 = -symbolx or -xsymbol2 = symbol-x or x-symbol3 = symbolx- or xsymbol-where symbol is the currency symbol of the country or region. Note that the position of the currency symbol is determined by xlCurrencyBefore.
xlCurrencySpaceBefore | 36 | True if a space is added before the currency symbol.
xlCurrencyTrailingZeros | 39 | True if trailing zeros are displayed for zero currency values.
xlDateOrder | 32 | Order of date elements:0 = month-day-year1 = day-month-year2 = year-month-day
xlDateSeparator | 17 | Date separator (/).
xlDayCode | 21 | Day symbol (d).
xlDayLeadingZero | 42 | True if a leading zero is displayed in days.
xlDecimalSeparator | 3 | Decimal separator.
xlGeneralFormatName | 26 | Name of the General number format.
xlHourCode | 22 | Hour symbol (h).
xlLeftBrace | 12 | Character used instead of the left brace ({) in array literals.
xlLeftBracket | 10 | Character used instead of the left bracket ([) in R1C1-style relative references.
xlListSeparator | 5 | List separator.
xlLowerCaseColumnLetter | 9 | Lowercase column letter.
xlLowerCaseRowLetter | 8 | Lowercase row letter.
xlMDY | 44 | True if the date order is month-day-year for dates displayed in the long form; False if the date order is day-month-year.
xlMetric | 35 | True if you're using the metric system; False if you're using the English measurement system.
xlMinuteCode | 23 | Minute symbol (m).
xlMonthCode | 20 | Month symbol (m).
xlMonthLeadingZero | 41 | True if a leading zero is displayed in months (when months are displayed as numbers).
xlMonthNameChars | 30 | Always returns three characters for backward compatibility. Abbreviated month names are read from Microsoft Windows and can be any length.
xlNoncurrencyDigits | 29 | Number of decimal digits to be used in noncurrency formats.
xlNonEnglishFunctions | 34 | True if you're not displaying functions in English.
xlRightBrace | 13 | Character used instead of the right brace (}) in array literals.
xlRightBracket | 11 | Character used instead of the right bracket (]) in R1C1-style references.
xlRowSeparator | 15 | Character used to separate rows in array literals.
xlSecondCode | 24 | Second symbol (s).
xlThousandsSeparator | 4 | Zero or thousands separator.
xlTimeLeadingZero | 45 | True if a leading zero is displayed in times.
xlTimeSeparator | 18 | Time separator (:).
xlUpperCaseColumnLetter | 7 | Uppercase column letter.
xlUpperCaseRowLetter | 6 | Uppercase row letter (for R1C1-style references).
xlWeekdayNameChars | 31 | Always returns three characters for backward compatibility. Abbreviated weekday names are read from Microsoft Windows and can be any length.
xlYearCode | 19 | Year symbol in number formats (y).


XlApplyNamesOrder Enumeration (Excel)

 Copy code hover
[image]

XlApplyNamesOrder Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which range name is listed first when a cell reference is replaced by a row-oriented and column-oriented range name.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColumnThenRow | 2 | Columns listed before rows.
xlRowThenColumn | 1 | Rows listed before columns.


XlArabicModes Enumeration (Excel)

 Copy code hover
[image]

XlArabicModes Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies spelling rules for the Arabic spelling checker.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlArabicBothStrict | 3 | The spelling checker uses spelling rules regarding both Arabic words ending with the letter yaa and Arabic words beginning with an alef hamza.
xlArabicNone | 0 | The spelling checker ignores spelling rules regarding either Arabic words ending with the letter yaa or Arabic words beginning with an alef hamza.
xlArabicStrictAlefHamza | 1 | The spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza.
xlArabicStrictFinalYaa | 2 | The spelling checker uses spelling rules regarding Arabic words ending with the letter yaa.


XlArrangeStyle Enumeration (Excel)

 Copy code hover
[image]

XlArrangeStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how windows are arranged on the screen.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlArrangeStyleCascade | 7 | Windows are cascaded.
xlArrangeStyleHorizontal | -4128 | Windows are arranged horizontally.
xlArrangeStyleTiled | 1 | Default. Windows are tiled.
xlArrangeStyleVertical | -4166 | Windows are arranged vertically.


XlArrowHeadLength Enumeration (Excel)

 Copy code hover
[image]

XlArrowHeadLength Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the length of the arrowhead at the end of a line.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlArrowHeadLengthLong | 3 | Longest arrowhead.
xlArrowHeadLengthMedium | -4138 | Medium-length arrowhead.
xlArrowHeadLengthShort | 1 | Shortest arrowhead.


XlArrowHeadStyle Enumeration (Excel)

 Copy code hover
[image]

XlArrowHeadStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of arrowhead to apply at the end of a line.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlArrowHeadStyleClosed | 3 | Small arrowhead with curved edge at connection to line.
xlArrowHeadStyleDoubleClosed | 5 | Large diamond-shaped arrowhead.
xlArrowHeadStyleDoubleOpen | 4 | Large arrowhead with curved edge at connection to line.
xlArrowHeadStyleNone | -4142 | No arrowhead.
xlArrowHeadStyleOpen | 2 | Large triangular arrowhead.


XlArrowHeadWidth Enumeration (Excel)

 Copy code hover
[image]

XlArrowHeadWidth Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the width of the arrowhead at the end of a line.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlArrowHeadWidthMedium | -4138 | Medium-width arrowhead.
xlArrowHeadWidthNarrow | 1 | Narrowest arrowhead.
xlArrowHeadWidthWide | 3 | Widest arrowhead.


XlAutoFillType Enumeration (Excel)

 Copy code hover
[image]

XlAutoFillType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the target range is to be filled, based on the contents of the source range.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlFillCopy | 1 | Copy the values and formats from the source range to the target range, repeating if necessary.
xlFillDays | 5 | Extend the names of the days of the week in the source range into the target range. Formats are copied from the source range to the target range, repeating if necessary.
xlFillDefault | 0 | Excel determines the values and formats used to fill the target range.
xlFillFormats | 3 | Copy only the formats from the source range to the target range, repeating if necessary.
xlFillMonths | 7 | Extend the names of the months in the source range into the target range. Formats are copied from the source range to the target range, repeating if necessary.
xlFillSeries | 2 | Extend the values in the source range into the target range as a series (for example, '1, 2' is extended as '3, 4, 5'). Formats are copied from the source range to the target range, repeating if necessary.
xlFillValues | 4 | Copy only the values from the source range to the target range, repeating if necessary.
xlFillWeekdays | 6 | Extend the names of the days of the workweek in the source range into the target range. Formats are copied from the source range to the target range, repeating if necessary.
xlFillYears | 8 | Extend the years in the source range into the target range. Formats are copied from the source range to the target range, repeating if necessary.
xlGrowthTrend | 10 | Extend the numeric values from the source range into the target range, assuming that the relationships between the numbers in the source range are multiplicative (for example, '1, 2,' is extended as '4, 8, 16', assuming that each number is a result of multiplying the previous number by some value). Formats are copied from the source range to the target range, repeating if necessary.
xlLinearTrend | 9 | Extend the numeric values from the source range into the target range, assuming that the relationships between the numbers is additive (for example, '1, 2,' is extended as '3, 4, 5', assuming that each number is a result of adding some value to the previous number). Formats are copied from the source range to the target range, repeating if necessary.
xlFlashFill | 11 | Extend the values from the source range into the target range based on the detected pattern of previous user actions, repeating if necessary.


XlAutoFilterOperator Enumeration (Excel)

 Copy code hover
[image]

XlAutoFilterOperator Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the operator to use to associate two criteria applied by a filter.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAnd | 1 | Logical AND of Criteria1 and Criteria2.
xlBottom10Items | 4 | Lowest-valued items displayed (number of items specified in Criteria1).
xlBottom10Percent | 6 | Lowest-valued items displayed (percentage specified in Criteria1).
xlFilterCellColor | 8 | Color of the cell
xlFilterDynamic | 11 | Dynamic filter
xlFilterFontColor | 9 | Color of the font
xlFilterIcon | 10 | Filter icon
xlFilterValues | 7 | Filter values
xlOr | 2 | Logical OR of Criteria1 or Criteria2.
xlTop10Items | 3 | Highest-valued items displayed (number of items specified in Criteria1).
xlTop10Percent | 5 | Highest-valued items displayed (percentage specified in Criteria1).


XlAxisCrosses Enumeration (Excel)

 Copy code hover
[image]

XlAxisCrosses Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the point on the specified axis where the other axis crosses.

Name | Value | Description
xlAxisCrossesAutomatic | -4105 | Microsoft Excel sets the axis crossing point.
xlAxisCrossesCustom | -4114 | The CrossesAt property specifies the axis crossing point.
xlAxisCrossesMaximum | 2 | The axis crosses at the maximum value.
xlAxisCrossesMinimum | 4 | The axis crosses at the minimum value.


XlAxisGroup Enumeration (Excel)

 Copy code hover
[image]

XlAxisGroup Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of axis group.

Name | Value | Description
xlPrimary | 1 | Primary axis group.
xlSecondary | 2 | Secondary axis group.


XlAxisType Enumeration (Excel)

 Copy code hover
[image]

XlAxisType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the axis type.

Name | Value | Description
xlCategory | 1 | Axis displays categories.
xlSeriesAxis | 3 | Axis displays data series.
xlValue | 2 | Axis displays values.


XlBackground Enumeration (Excel)

 Copy code hover
[image]

XlBackground Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the background type for text in charts.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBackgroundAutomatic | -4105 | Excel controls the background.
xlBackgroundOpaque | 3 | Opaque background.
xlBackgroundTransparent | 2 | Transparent background.


XlBarShape Enumeration (Excel)

 Copy code hover
[image]

XlBarShape Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the shape used with the 3-D bar or column chart.

Name | Value | Description
xlBox | 0 | Box.
xlConeToMax | 5 | Cone, truncated at value.
xlConeToPoint | 4 | Cone, coming to point at value.
xlCylinder | 3 | Cylinder.
xlPyramidToMax | 2 | Pyramid, truncated at value.
xlPyramidToPoint | 1 | Pyramid, coming to point at value.


XlBordersIndex Enumeration (Excel)

 Copy code hover
[image]

XlBordersIndex Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the border to be retrieved.

Name | Value | Description
xlDiagonalDown | 5 | Border running from the upper left-hand corner to the lower right of each cell in the range.
xlDiagonalUp | 6 | Border running from the lower left-hand corner to the upper right of each cell in the range.
xlEdgeBottom | 9 | Border at the bottom of the range.
xlEdgeLeft | 7 | Border at the left-hand edge of the range.
xlEdgeRight | 10 | Border at the right-hand edge of the range.
xlEdgeTop | 8 | Border at the top of the range.
xlInsideHorizontal | 12 | Horizontal borders for all cells in the range except borders on the outside of the range.
xlInsideVertical | 11 | Vertical borders for all the cells in the range except borders on the outside of the range.


XlBorderWeight Enumeration (Excel)

 Copy code hover
[image]

XlBorderWeight Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the weight of the border around a range.

Name | Value | Description
xlHairline | 1 | Hairline (thinnest border).
xlMedium | -4138 | Medium.
xlThick | 4 | Thick (widest border).
xlThin | 2 | Thin.


XlBuiltInDialog Enumeration (Excel)

 Copy code hover
[image]

XlBuiltInDialog Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which dialog box to display.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlDialogActivate | 103 | Activate dialog box
xlDialogActiveCellFont | 476 | Active Cell Font dialog box
xlDialogAddChartAutoformat | 390 | Add Chart Autoformat dialog box
xlDialogAddinManager | 321 | Addin Manager dialog box
xlDialogAlignment | 43 | Alignment dialog box
xlDialogApplyNames | 133 | Apply Names dialog box
xlDialogApplyStyle | 212 | Apply Style dialog box
xlDialogAppMove | 170 | AppMove dialog box
xlDialogAppSize | 171 | AppSize dialog box
xlDialogArrangeAll | 12 | Arrange All dialog box
xlDialogAssignToObject | 213 | Assign To Object dialog box
xlDialogAssignToTool | 293 | Assign To Tool dialog box
xlDialogAttachText | 80 | Attach Text dialog box
xlDialogAttachToolbars | 323 | Attach Toolbars dialog box
xlDialogAutoCorrect | 485 | Auto Correct dialog box
xlDialogAxes | 78 | Axes dialog box
xlDialogBorder | 45 | Border dialog box
xlDialogCalculation | 32 | Calculation dialog box
xlDialogCellProtection | 46 | Cell Protection dialog box
xlDialogChangeLink | 166 | Change Link dialog box
xlDialogChartAddData | 392 | Chart Add Data dialog box
xlDialogChartLocation | 527 | Chart Location dialog box
xlDialogChartOptionsDataLabelMultiple | 724 | Chart Options DataLabel Multiple dialog box
xlDialogChartOptionsDataLabels | 505 | Chart Options DataLabels dialog box
xlDialogChartOptionsDataTable | 506 | Chart Options DataTable dialog box
xlDialogChartSourceData | 540 | Chart SourceData dialog box
xlDialogChartTrend | 350 | Chart Trend dialog box
xlDialogChartType | 526 | Chart Type dialog box
xlDialogChartWizard | 288 | ChartWizard dialog box
xlDialogCheckboxProperties | 435 | Checkbox Properties dialog box
xlDialogClear | 52 | Clear dialog box
xlDialogColorPalette | 161 | Color Palette dialog box
xlDialogColumnWidth | 47 | Column Width dialog box
xlDialogCombination | 73 | Combination dialog box
xlDialogConditionalFormatting | 583 | Conditional Formatting dialog box
xlDialogConsolidate | 191 | Consolidate dialog box
xlDialogCopyChart | 147 | Copy Chart dialog box
xlDialogCopyPicture | 108 | Copy Picture dialog box
xlDialogCreateList | 796 | Create List dialog box
xlDialogCreateNames | 62 | Create Names dialog box
xlDialogCreatePublisher | 217 | Create Publisher dialog box
xlDialogCreateRelationship | 1272 | Create Relationship dialog box
xlDialogCustomizeToolbar | 276 | Customize Toolbar dialog box
xlDialogCustomViews | 493 | Custom Views dialog box
xlDialogDataDelete | 36 | Data Delete dialog box
xlDialogDataLabel | 379 | Data Label dialog box
xlDialogDataLabelMultiple | 723 | Data Label Multiple dialog box
xlDialogDataSeries | 40 | Data Series dialog box
xlDialogDataValidation | 525 | Data Validation dialog box
xlDialogDefineName | 61 | Define Name dialog box
xlDialogDefineStyle | 229 | Define Style dialog box
xlDialogDeleteFormat | 111 | Delete Format dialog box
xlDialogDeleteName | 110 | Delete Name dialog box
xlDialogDemote | 203 | Demote dialog box
xlDialogDisplay | 27 | Display dialog box
xlDialogDocumentInspector | 862 | Document Inspector dialog box
xlDialogEditboxProperties | 438 | Editbox Properties dialog box
xlDialogEditColor | 223 | Edit Color dialog box
xlDialogEditDelete | 54 | Edit Delete dialog box
xlDialogEditionOptions | 251 | Edition Options dialog box
xlDialogEditSeries | 228 | Edit Series dialog box
xlDialogErrorbarX | 463 | Errorbar X dialog box
xlDialogErrorbarY | 464 | Errorbar Y dialog box
xlDialogErrorChecking | 732 | Error Checking dialog box
xlDialogEvaluateFormula | 709 | Evaluate Formula dialog box
xlDialogExternalDataProperties | 530 | External Data Properties dialog box
xlDialogExtract | 35 | Extract dialog box
xlDialogFileDelete | 6 | File Delete dialog box
xlDialogFileSharing | 481 | File Sharing dialog box
xlDialogFillGroup | 200 | Fill Group dialog box
xlDialogFillWorkgroup | 301 | Fill Workgroup dialog box
xlDialogFilter | 447 | Dialog Filter dialog box
xlDialogFilterAdvanced | 370 | Filter Advanced dialog box
xlDialogFindFile | 475 | Find File dialog box
xlDialogFont | 26 | Font dialog box
xlDialogFontProperties | 381 | Font Properties dialog box
xlDialogFormatAuto | 269 | Format Auto dialog box
xlDialogFormatChart | 465 | Format Chart dialog box
xlDialogFormatCharttype | 423 | Format Charttype dialog box
xlDialogFormatFont | 150 | Format Font dialog box
xlDialogFormatLegend | 88 | Format Legend dialog box
xlDialogFormatMain | 225 | Format Main dialog box
xlDialogFormatMove | 128 | Format Move dialog box
xlDialogFormatNumber | 42 | Format Number dialog box
xlDialogFormatOverlay | 226 | Format Overlay dialog box
xlDialogFormatSize | 129 | Format Size dialog box
xlDialogFormatText | 89 | Format Text dialog box
xlDialogFormulaFind | 64 | Formula Find dialog box
xlDialogFormulaGoto | 63 | Formula Goto dialog box
xlDialogFormulaReplace | 130 | Formula Replace dialog box
xlDialogFunctionWizard | 450 | Function Wizard dialog box
xlDialogGallery3dArea | 193 | Gallery 3D Area dialog box
xlDialogGallery3dBar | 272 | Gallery 3D Bar dialog box
xlDialogGallery3dColumn | 194 | Gallery 3D Column dialog box
xlDialogGallery3dLine | 195 | Gallery 3D Line dialog box
xlDialogGallery3dPie | 196 | Gallery 3D Pie dialog box
xlDialogGallery3dSurface | 273 | Gallery 3D Surface dialog box
xlDialogGalleryArea | 67 | Gallery Area dialog box
xlDialogGalleryBar | 68 | Gallery Bar dialog box
xlDialogGalleryColumn | 69 | Gallery Column dialog box
xlDialogGalleryCustom | 388 | Gallery Custom dialog box
xlDialogGalleryDoughnut | 344 | Gallery Doughnut dialog box
xlDialogGalleryLine | 70 | Gallery Line dialog box
xlDialogGalleryPie | 71 | Gallery Pie dialog box
xlDialogGalleryRadar | 249 | Gallery Radar dialog box
xlDialogGalleryScatter | 72 | Gallery Scatter dialog box
xlDialogGoalSeek | 198 | Goal Seek dialog box
xlDialogGridlines | 76 | Gridlines dialog box
xlDialogImportTextFile | 666 | Import Text File dialog box
xlDialogInsert | 55 | Insert dialog box
xlDialogInsertHyperlink | 596 | Insert Hyperlink dialog box
xlDialogInsertObject | 259 | Insert Object dialog box
xlDialogInsertPicture | 342 | Insert Picture dialog box
xlDialogInsertTitle | 380 | Insert Title dialog box
xlDialogLabelProperties | 436 | Label Properties dialog box
xlDialogListboxProperties | 437 | Listbox Properties dialog box
xlDialogMacroOptions | 382 | Macro Options dialog box
xlDialogMailEditMailer | 470 | Mail Edit Mailer dialog box
xlDialogMailLogon | 339 | Mail Logon dialog box
xlDialogMailNextLetter | 378 | Mail Next Letter dialog box
xlDialogMainChart | 85 | Main Chart dialog box
xlDialogMainChartType | 185 | Main Chart Type dialog box
xlDialogManageRelationships | 1271 | Manage Relationships dialog box
xlDialogMenuEditor | 322 | Menu Editor dialog box
xlDialogMove | 262 | Move dialog box
xlDialogMyPermission | 834 | My Permission dialog box
xlDialogNameManager | 977 | NameManager dialog box
xlDialogNew | 119 | New dialog box
xlDialogNewName | 978 | NewName dialog box
xlDialogNewWebQuery | 667 | New Web Query dialog box
xlDialogNote | 154 | Note dialog box
xlDialogObjectProperties | 207 | Object Properties dialog box
xlDialogObjectProtection | 214 | Object Protection dialog box
xlDialogOpen | 1 | Open dialog box
xlDialogOpenLinks | 2 | Open Links dialog box
xlDialogOpenMail | 188 | Open Mail dialog box
xlDialogOpenText | 441 | Open Text dialog box
xlDialogOptionsCalculation | 318 | Options Calculation dialog box
xlDialogOptionsChart | 325 | Options Chart dialog box
xlDialogOptionsEdit | 319 | Options Edit dialog box
xlDialogOptionsGeneral | 356 | Options General dialog box
xlDialogOptionsListsAdd | 458 | Options Lists Add dialog box
xlDialogOptionsME | 647 | OptionsME dialog box
xlDialogOptionsTransition | 355 | Options Transition dialog box
xlDialogOptionsView | 320 | Options View dialog box
xlDialogOutline | 142 | Outline dialog box
xlDialogOverlay | 86 | Overlay dialog box
xlDialogOverlayChartType | 186 | Overlay ChartType dialog box
xlDialogPageSetup | 7 | Page Setup dialog box
xlDialogParse | 91 | Parse dialog box
xlDialogPasteNames | 58 | Paste Names dialog box
xlDialogPasteSpecial | 53 | Paste Special dialog box
xlDialogPatterns | 84 | Patterns dialog box
xlDialogPermission | 832 | Permission dialog box
xlDialogPhonetic | 656 | Phonetic dialog box
xlDialogPivotCalculatedField | 570 | Pivot Calculated Field dialog box
xlDialogPivotCalculatedItem | 572 | Pivot Calculated Item dialog box
xlDialogPivotClientServerSet | 689 | Pivot Client Server Set dialog box
xlDialogPivotFieldGroup | 433 | Pivot Field Group dialog box
xlDialogPivotFieldProperties | 313 | Pivot Field Properties dialog box
xlDialogPivotFieldUngroup | 434 | Pivot Field Ungroup dialog box
xlDialogPivotShowPages | 421 | Pivot Show Pages dialog box
xlDialogPivotSolveOrder | 568 | Pivot Solve Order dialog box
xlDialogPivotTableOptions | 567 | Pivot Table Options dialog box
xlDialogPivotTableSlicerConnections | 1183 | Pivot Table Slicer Connections dialog box
xlDialogPivotTableWhatIfAnalysisSettings | 1153 | Pivot Table What If Analysis Settings dialog box
xlDialogPivotTableWizard | 312 | Pivot Table Wizard dialog box
xlDialogPlacement | 300 | Placement dialog box
xlDialogPrint | 8 | Print dialog box
xlDialogPrinterSetup | 9 | Printer Setup dialog box
xlDialogPrintPreview | 222 | Print Preview dialog box
xlDialogPromote | 202 | Promote dialog box
xlDialogProperties | 474 | Properties dialog box
xlDialogPropertyFields | 754 | Property Fields dialog box
xlDialogProtectDocument | 28 | Protect Document dialog box
xlDialogProtectSharing | 620 | Protect Sharing dialog box
xlDialogPublishAsWebPage | 653 | Publish As WebPage dialog box
xlDialogPushbuttonProperties | 445 | Pushbutton Properties dialog box
xlDialogRecommendedPivotTables | 1258 | Recommended PivotTables dialog box
xlDialogReplaceFont | 134 | Replace Font dialog box
xlDialogRoutingSlip | 336 | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
xlDialogRowHeight | 127 | Row Height dialog box
xlDialogRun | 17 | Run dialog box
xlDialogSaveAs | 5 | SaveAs dialog box
xlDialogSaveCopyAs | 456 | SaveCopyAs dialog box
xlDialogSaveNewObject | 208 | Save New Object dialog box
xlDialogSaveWorkbook | 145 | Save Workbook dialog box
xlDialogSaveWorkspace | 285 | Save Workspace dialog box
xlDialogScale | 87 | Scale dialog box
xlDialogScenarioAdd | 307 | Scenario Add dialog box
xlDialogScenarioCells | 305 | Scenario Cells dialog box
xlDialogScenarioEdit | 308 | Scenario Edit dialog box
xlDialogScenarioMerge | 473 | Scenario Merge dialog box
xlDialogScenarioSummary | 311 | Scenario Summary dialog box
xlDialogScrollbarProperties | 420 | Scrollbar Properties dialog box
xlDialogSearch | 731 | Search dialog box
xlDialogSelectSpecial | 132 | Select Special dialog box
xlDialogSendMail | 189 | Send Mail dialog box
xlDialogSeriesAxes | 460 | Series Axes dialog box
xlDialogSeriesOptions | 557 | Series Options dialog box
xlDialogSeriesOrder | 466 | Series Order dialog box
xlDialogSeriesShape | 504 | Series Shape dialog box
xlDialogSeriesX | 461 | Series X dialog box
xlDialogSeriesY | 462 | Series Y dialog box
xlDialogSetBackgroundPicture | 509 | Set Background Picture dialog box
xlDialogSetManager | 1109 | Set Manager dialog box
xlDialogSetMDXEditor | 1208 | Set MDX Editor dialog box
xlDialogSetPrintTitles | 23 | Set Print Titles dialog box
xlDialogSetTupleEditorOnColumns | 1108 | Set Tuple Editor On Columns dialog box
xlDialogSetTupleEditorOnRows | 1107 | Set Tuple Editor On Rows dialog box
xlDialogSetUpdateStatus | 159 | Set Update Status dialog box
xlDialogShowDetail | 204 | Show Detail dialog box
xlDialogShowToolbar | 220 | Show Toolbar dialog box
xlDialogSize | 261 | Size dialog box
xlDialogSlicerCreation | 1182 | Slicer Creation dialog box
xlDialogSlicerPivotTableConnections | 1184 | Slicer Pivot Table Connections dialog box
xlDialogSlicerSettings | 1179 | Slicer Settings dialog box
xlDialogSort | 39 | Sort dialog box
xlDialogSortSpecial | 192 | Sort Special dialog box
xlDialogSparklineInsertColumn | 1134 | Sparkline Insert Column dialog box
xlDialogSparklineInsertLine | 1133 | Sparkline Insert Line dialog box
xlDialogSparklineInsertWinLoss | 1135 | Sparkline Insert Win Loss dialog box
xlDialogSplit | 137 | Split dialog box
xlDialogStandardFont | 190 | Standard Font dialog box
xlDialogStandardWidth | 472 | Standard Width dialog box
xlDialogStyle | 44 | Style dialog box
xlDialogSubscribeTo | 218 | Subscribe To dialog box
xlDialogSubtotalCreate | 398 | Subtotal Create dialog box
xlDialogSummaryInfo | 474 | Summary Info dialog box
xlDialogTable | 41 | Table dialog box
xlDialogTabOrder | 394 | Tab Order dialog box
xlDialogTextToColumns | 422 | Text To Columns dialog box
xlDialogUnhide | 94 | Unhide dialog box
xlDialogUpdateLink | 201 | Update Link dialog box
xlDialogVbaInsertFile | 328 | VBA Insert File dialog box
xlDialogVbaMakeAddin | 478 | VBA Make Addin dialog box
xlDialogVbaProcedureDefinition | 330 | VBA Procedure Definition dialog box
xlDialogView3d | 197 | View 3D dialog box
xlDialogWebOptionsBrowsers | 773 | Web Options Browsers dialog box
xlDialogWebOptionsEncoding | 686 | Web Options Encoding dialog box
xlDialogWebOptionsFiles | 684 | Web Options Files dialog box
xlDialogWebOptionsFonts | 687 | Web Options Fonts dialog box
xlDialogWebOptionsGeneral | 683 | Web Options General dialog box
xlDialogWebOptionsPictures | 685 | Web Options Pictures dialog box
xlDialogWindowMove | 14 | Window Move dialog box
xlDialogWindowSize | 13 | Window Size dialog box
xlDialogWorkbookAdd | 281 | Workbook Add dialog box
xlDialogWorkbookCopy | 283 | Workbook Copy dialog box
xlDialogWorkbookInsert | 354 | Workbook Insert dialog box
xlDialogWorkbookMove | 282 | Workbook Move dialog box
xlDialogWorkbookName | 386 | Workbook Name dialog box
xlDialogWorkbookNew | 302 | Workbook New dialog box
xlDialogWorkbookOptions | 284 | Workbook Options dialog box
xlDialogWorkbookProtect | 417 | Workbook Protect dialog box
xlDialogWorkbookTabSplit | 415 | Workbook Tab Split dialog box
xlDialogWorkbookUnhide | 384 | Workbook Unhide dialog box
xlDialogWorkgroup | 199 | Workgroup dialog box
xlDialogWorkspace | 95 | Workspace dialog box
xlDialogZoom | 256 | Zoom dialog box


XlCalcFor Enumeration (Excel)

 Copy code hover
[image]

XlCalcFor Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what should be calculated.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAllValues | 0 | All values.
xlColGroups | 2 | Column groups.
xlRowGroups | 1 | Row groups.


XlCalcMemNumberFormatType Enumeration (Excel)

 Copy code hover
[image]

XlCalcMemNumberFormatType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the format of cell values that are based on the calculated member.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
xlNumberFormatTypeDefault | 0 | Use the default format type of the calculated member for the cell value.
xlNumberFormatTypeNumber | 1 | Calculated member cell format is a number.
xlNumberFormatTypePercent | 2 | Calculated member cell format is a percentage.


XlCalculatedMemberType Enumeration (Excel)

 Copy code hover
[image]

XlCalculatedMemberType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of a calculated member in a PivotTable.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlCalculatedMeasure | 2 | The member is a Multidimensional Expressions (MDX) expression that defines the measure.
xlCalculatedMember | 0 | The member uses a Multidimensional Expression (MDX) formula.
xlCalculatedSet | 1 | The member contains an MDX formula for a set in a cube field.


XlCalculation Enumeration (Excel)

 Copy code hover
[image]

XlCalculation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the calculation mode.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCalculationAutomatic | -4105 | Excel controls recalculation.
xlCalculationManual | -4135 | Calculation is done when the user requests it.
xlCalculationSemiautomatic | 2 | Excel controls recalculation but ignores changes in tables.


XlCalculationInterruptKey Enumeration (Excel)

 Copy code hover
[image]

XlCalculationInterruptKey Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which key interrupts recalculation.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAnyKey | 2 | Pressing any key interrupts recalculation.
xlEscKey | 1 | Pressing the ESC key interrupts recalculation.
xlNoKey | 0 | No key press can interrupt recalculation.


XlCalculationState Enumeration (Excel)

 Copy code hover
[image]

XlCalculationState Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the calculation state of the application.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCalculating | 1 | Calculations in process.
xlDone | 0 | Calculations complete.
xlPending | 2 | Changes that trigger calculation have been made, but a recalculation has not yet been performed.


XlCategoryLabelLevel Enumeration (Excel)

 Copy code hover
[image]

XlCategoryLabelLevel Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the category labels for the category label levels.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
XlCategoryLabelLevelAll (default) | -1 (&HFFFFFFFF) | Set category labels to all category label levels w/in range on the chart.
XlCategoryLabelLevelCustom | -2 (&HFFFFFFFE) | Indicates literal data in the category labels.
XlCategoryLabelLevelNone | -3 (&HFFFFFFFD) | Set no category labels in the chart. Defaults to automatic indexed labels.
xlCategoryLabelLevelAll | -1 |
xlCategoryLabelLevelCustom | -2 |
xlCategoryLabelLevelNone | -3 |


XlCategoryType Enumeration (Excel)

 Copy code hover
[image]

XlCategoryType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of the category axis.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAutomaticScale | -4105 | Excel controls the axis type.
xlCategoryScale | 2 | Axis groups data by an arbitrary set of categories.
xlTimeScale | 3 | Axis groups data on a time scale.


XlCellChangedState Enumeration (Excel)

 Copy code hover
[image]

XlCellChangedState Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether a PivotTable value cell has been edited or recalculated since the PivotTable report was created or the last commit operation was performed.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlCellChangeApplied | 3 | The value in the cell has been edited or recalculated, and that change has been applied to the data source. (Applies only PivotTable reports with OLAP data sources)
xlCellChanged | 2 | The value in the cell has been edited or recalculated.
xlCellNotChanged | 1 | The value in the cell has not been edited or recalculated.

Remarks

Applying and saving changes applies only to PivotTable reports with OLAP data sources. For more information about the meaning of the XlCellChangedState enumeration constant values, see the CellChanged property of the PivotCell object.


XlCellInsertionMode Enumeration (Excel)

 Copy code hover
[image]

XlCellInsertionMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way that rows on the specified worksheet are added or deleted to accommodate the number of rows in a recordset returned by a query.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlInsertDeleteCells | 1 | Partial rows are inserted or deleted to match the exact number of rows required for the new recordset.
xlInsertEntireRows | 2 | Entire rows are inserted, if necessary, to accommodate any overflow. No cells or rows are deleted from the worksheet.
xlOverwriteCells | 0 | No new cells or rows are added to the worksheet. Data in surrounding cells is overwritten to accommodate any overflow.


XlCellType Enumeration (Excel)

 Copy code hover
[image]

XlCellType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of cells.

Name | Value | Description
xlCellTypeAllFormatConditions | -4172 | Cells of any format.
xlCellTypeAllValidation | -4174 | Cells having validation criteria.
xlCellTypeBlanks | 4 | Empty cells.
xlCellTypeComments | -4144 | Cells containing notes.
xlCellTypeConstants | 2 | Cells containing constants.
xlCellTypeFormulas | -4123 | Cells containing formulas.
xlCellTypeLastCell | 11 | The last cell in the used range.
xlCellTypeSameFormatConditions | -4173 | Cells having the same format.
xlCellTypeSameValidation | -4175 | Cells having the same validation criteria.
xlCellTypeVisible | 12 | All visible cells.


XlChartElementPosition Enumeration (Excel)

 Copy code hover
[image]

XlChartElementPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the position of the chart element.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlChartElementPositionAutomatic | -4105 | Automatically sets the position of the chart element.
xlChartElementPositionCustom | -4114 | Specifies a specific position for the chart element.


XlChartGallery Enumeration (Excel)

 Copy code hover
[image]

XlChartGallery Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies a chart gallery.

Name | Value | Description
xlAnyGallery | 23 | Either of the galleries.
xlBuiltIn | 21 | The built-in gallery.
xlUserDefined | 22 | The user-defined gallery.


XlChartItem Enumeration (Excel)

 Copy code hover
[image]

XlChartItem Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of the chart item.

Name | Value | Description
xlAxis | 21 | Axis.
xlAxisTitle | 17 | Axis title.
xlChartArea | 2 | Chart area.
xlChartTitle | 4 | Chart title.
xlCorners | 6 | Corners.
xlDataLabel | 0 | Data label.
xlDataTable | 7 | Data table.
xlDisplayUnitLabel | 30 | Display unit label.
xlDownBars | 20 | Down bars.
xlDropLines | 26 | Drop lines.
xlErrorBars | 9 | Error bars.
xlFloor | 23 | Floor.
xlHiLoLines | 25 | HiLo lines.
xlLeaderLines | 29 | Leader lines.
xlLegend | 24 | Legend.
xlLegendEntry | 12 | Legend entry.
xlLegendKey | 13 | Legend key.
xlMajorGridlines | 15 | Major gridlines.
xlMinorGridlines | 16 | Minor gridlines.
xlNothing | 28 | Nothing.
xlPivotChartDropZone | 32 | PivotChart drop zone.
xlPivotChartFieldButton | 31 | PivotChart field button.
xlPlotArea | 19 | Plot area.
xlRadarAxisLabels | 27 | Radar axis labels.
xlSeries | 3 | Series.
xlSeriesLines | 22 | Series lines.
xlShape | 14 | Shape.
xlTrendline | 8 | Trend line.
xlUpBars | 18 | Up bars.
xlWalls | 5 | Walls.
xlXErrorBars | 10 | X error bars.
xlYErrorBars | 11 | Y error bars.


XlChartLocation Enumeration (Excel)

 Copy code hover
[image]

XlChartLocation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies where to relocate a chart.

Name | Value | Description
xlLocationAsNewSheet | 1 | Chart is moved to a new sheet.
xlLocationAsObject | 2 | Chart is to be embedded in an existing sheet.
xlLocationAutomatic | 3 | Excel controls chart location.


XlChartPicturePlacement Enumeration (Excel)

 Copy code hover
[image]

XlChartPicturePlacement Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the placement of a user-selected picture on a bar in a 3-D bar or column.

Name | Value | Description
xlAllFaces | 7 | Display on all faces.
xlEnd | 2 | Display on end.
xlEndSides | 3 | Display on end and sides.
xlFront | 4 | Display on front.
xlFrontEnd | 6 | Display on front and end.
xlFrontSides | 5 | Display on front and sides.
xlSides | 1 | Display on sides.


XlChartPictureType Enumeration (Excel)

 Copy code hover
[image]

XlChartPictureType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how pictures are displayed on a column, bar picture chart, or legend key.

Name | Value | Description
xlStack | 2 | Picture is sized to repeat a maximum of 15 times in the longest stacked bar.
xlStackScale | 3 | Picture is sized to a specified number of units and repeated the length of the bar.
xlStretch | 1 | Picture is stretched the full length of the stacked bar.


XlChartSplitType Enumeration (Excel)

 Copy code hover
[image]

XlChartSplitType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the values displayed in the second chart in a pie chart or a bar of pie chart.

Name | Value | Description
xlSplitByCustomSplit | 4 | Arbitrary slides are displayed in the second chart.
xlSplitByPercentValue | 3 | Second chart displays values less than some percentage of the total value. The percentage is specified by the SplitValue property.
xlSplitByPosition | 1 | Second chart displays the smallest values in the data series. The number of values to display is specified by the SplitValue property.
xlSplitByValue | 2 | Second chart displays values less than the value specified by the SplitValue property.


XlChartType Enumeration (Excel)

 Copy code hover
[image]

XlChartType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the chart type.

Name | Value | Description
xl3DArea | -4098 | 3D Area.
xl3DAreaStacked | 78 | 3D Stacked Area.
xl3DAreaStacked100 | 79 | 100% Stacked Area.
xl3DBarClustered | 60 | 3D Clustered Bar.
xl3DBarStacked | 61 | 3D Stacked Bar.
xl3DBarStacked100 | 62 | 3D 100% Stacked Bar.
xl3DColumn | -4100 | 3D Column.
xl3DColumnClustered | 54 | 3D Clustered Column.
xl3DColumnStacked | 55 | 3D Stacked Column.
xl3DColumnStacked100 | 56 | 3D 100% Stacked Column.
xl3DLine | -4101 | 3D Line.
xl3DPie | -4102 | 3D Pie.
xl3DPieExploded | 70 | Exploded 3D Pie.
xlArea | 1 | Area
xlAreaStacked | 76 | Stacked Area.
xlAreaStacked100 | 77 | 100% Stacked Area.
xlBarClustered | 57 | Clustered Bar.
xlBarOfPie | 71 | Bar of Pie.
xlBarStacked | 58 | Stacked Bar.
xlBarStacked100 | 59 | 100% Stacked Bar.
xlBubble | 15 | Bubble.
xlBubble3DEffect | 87 | Bubble with 3D effects.
xlColumnClustered | 51 | Clustered Column.
xlColumnStacked | 52 | Stacked Column.
xlColumnStacked100 | 53 | 100% Stacked Column.
xlConeBarClustered | 102 | Clustered Cone Bar.
xlConeBarStacked | 103 | Stacked Cone Bar.
xlConeBarStacked100 | 104 | 100% Stacked Cone Bar.
xlConeCol | 105 | 3D Cone Column.
xlConeColClustered | 99 | Clustered Cone Column.
xlConeColStacked | 100 | Stacked Cone Column.
xlConeColStacked100 | 101 | 100% Stacked Cone Column.
xlCylinderBarClustered | 95 | Clustered Cylinder Bar.
xlCylinderBarStacked | 96 | Stacked Cylinder Bar.
xlCylinderBarStacked100 | 97 | 100% Stacked Cylinder Bar.
xlCylinderCol | 98 | 3D Cylinder Column.
xlCylinderColClustered | 92 | Clustered Cone Column.
xlCylinderColStacked | 93 | Stacked Cone Column.
xlCylinderColStacked100 | 94 | 100% Stacked Cylinder Column.
xlDoughnut | -4120 | Doughnut.
xlDoughnutExploded | 80 | Exploded Doughnut.
xlLine | 4 | Line.
xlLineMarkers | 65 | Line with Markers.
xlLineMarkersStacked | 66 | Stacked Line with Markers.
xlLineMarkersStacked100 | 67 | 100% Stacked Line with Markers.
xlLineStacked | 63 | Stacked Line.
xlLineStacked100 | 64 | 100% Stacked Line.
xlPie | 5 | Pie.
xlPieExploded | 69 | Exploded Pie.
xlPieOfPie | 68 | Pie of Pie.
xlPyramidBarClustered | 109 | Clustered Pyramid Bar.
xlPyramidBarStacked | 110 | Stacked Pyramid Bar.
xlPyramidBarStacked100 | 111 | 100% Stacked Pyramid Bar.
xlPyramidCol | 112 | 3D Pyramid Column.
xlPyramidColClustered | 106 | Clustered Pyramid Column.
xlPyramidColStacked | 107 | Stacked Pyramid Column.
xlPyramidColStacked100 | 108 | 100% Stacked Pyramid Column.
xlRadar | -4151 | Radar.
xlRadarFilled | 82 | Filled Radar.
xlRadarMarkers | 81 | Radar with Data Markers.
xlStockHLC | 88 | High-Low-Close.
xlStockOHLC | 89 | Open-High-Low-Close.
xlStockVHLC | 90 | Volume-High-Low-Close.
xlStockVOHLC | 91 | Volume-Open-High-Low-Close.
xlSurface | 83 | 3D Surface.
xlSurfaceTopView | 85 | Surface (Top View).
xlSurfaceTopViewWireframe | 86 | Surface (Top View wireframe).
xlSurfaceWireframe | 84 | 3D Surface (wireframe).
xlXYScatter | -4169 | Scatter.
xlXYScatterLines | 74 | Scatter with Lines.
xlXYScatterLinesNoMarkers | 75 | Scatter with Lines and No Data Markers.
xlXYScatterSmooth | 72 | Scatter with Smoothed Lines.
xlXYScatterSmoothNoMarkers | 73 | Scatter with Smoothed Lines and No Data Markers.


XlCheckInVersionType Enumeration (Excel)

 Copy code hover
[image]

XlCheckInVersionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of version for the document checked in when using the CheckIn method. Applies to workbooks stored in a SharePoint library.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCheckInMajorVersion | 1 | Check in the major version.
xlCheckInMinorVersion | 0 | Check in the minor version.
xlCheckInOverwriteVersion | 2 | Overwrite current version on the server.


XlClipboardFormat Enumeration (Excel)

 Copy code hover
[image]

XlClipboardFormat Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the format of an item on the Microsoft Windows clipboard.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlClipboardFormatBIFF | 8 | Binary Interchange file format for Excel version 2.x
xlClipboardFormatBIFF12 | 63 | Binary Interchange file format 12
xlClipboardFormatBIFF2 | 18 | Binary Interchange file format 2
xlClipboardFormatBIFF3 | 20 | Binary Interchange file format 3
xlClipboardFormatBIFF4 | 30 | Binary Interchange file format 4
xlClipboardFormatBinary | 15 | Binary format
xlClipboardFormatBitmap | 9 | Bitmap format
xlClipboardFormatCGM | 13 | CGM format
xlClipboardFormatCSV | 5 | CSV format
xlClipboardFormatDIF | 4 | DIF format
xlClipboardFormatDspText | 12 | Dsp Text format
xlClipboardFormatEmbeddedObject | 21 | Embedded Object
xlClipboardFormatEmbedSource | 22 | Embedded Source
xlClipboardFormatLink | 11 | Link
xlClipboardFormatLinkSource | 23 | Link to the source file
xlClipboardFormatLinkSourceDesc | 32 | Link to the source description
xlClipboardFormatMovie | 24 | Movie
xlClipboardFormatNative | 14 | Native
xlClipboardFormatObjectDesc | 31 | Object description
xlClipboardFormatObjectLink | 19 | Object link
xlClipboardFormatOwnerLink | 17 | Link to the owner
xlClipboardFormatPICT | 2 | Picture
xlClipboardFormatPrintPICT | 3 | Print picture
xlClipboardFormatRTF | 7 | RTF format
xlClipboardFormatScreenPICT | 29 | Screen Picture
xlClipboardFormatStandardFont | 28 | Standard Font
xlClipboardFormatStandardScale | 27 | Standard Scale
xlClipboardFormatSYLK | 6 | SYLK
xlClipboardFormatTable | 16 | Table
xlClipboardFormatText | 0 | Text
xlClipboardFormatToolFace | 25 | Tool Face
xlClipboardFormatToolFacePICT | 26 | Tool Face Picture
xlClipboardFormatVALU | 1 | Value
xlClipboardFormatWK1 | 10 | Workbook


XlCmdType Enumeration (Excel)

 Copy code hover
[image]

XlCmdType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the value of the CommandText property.

Version information

Version Added: Excel 2013

Name | Value | Description
xlCmdCube | 1 | Contains a cube name for an OLAP data source.
xlCmdDAX | 8 | Contains a Data Analysis Expressions (DAX) formula.
xlCmdDefault | 4 | Contains command text that the OLE DB provider understands.
xlCmdExcel | 7 | Contains an Excel formula.
xlCmdList | 5 | Contains a pointer to list data.
xlCmdSql | 2 | Contains an SQL statement.
xlCmdTable | 3 | Contains a table name for accessing OLE DB data sources.
xlCmdTableCollection | 6 | Contains the name of a table collection.


XlColorIndex Enumeration (Excel)

 Copy code hover
[image]

XlColorIndex Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the color of a selected feature, such as a border, font, or fill.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColorIndexAutomatic | -4105 | Automatic color.
xlColorIndexNone | -4142 | No color.


XlColumnDataType Enumeration (Excel)

 Copy code hover
[image]

XlColumnDataType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how a column is to be parsed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDMYFormat | 4 | DMY date format.
xlDYMFormat | 7 | DYM date format.
xlEMDFormat | 10 | EMD date format.
xlGeneralFormat | 1 | General.
xlMDYFormat | 3 | MDY date format.
xlMYDFormat | 6 | MYD date format.
xlSkipColumn | 9 | Column is not parsed.
xlTextFormat | 2 | Text.
xlYDMFormat | 8 | YDM date format.
xlYMDFormat | 5 | YMD date format.


XlCommandUnderlines Enumeration (Excel)

 Copy code hover
[image]

XlCommandUnderlines Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the state of the command underlines in Microsoft Excel for the Macintosh.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCommandUnderlinesAutomatic | -4105 | Excel controls the display of command underlines.
xlCommandUnderlinesOff | -4146 | Command underlines are not displayed.
xlCommandUnderlinesOn | 1 | Command underlines are displayed.


XlCommentDisplayMode Enumeration (Excel)

 Copy code hover
[image]

XlCommentDisplayMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way that cells display comments and comment indicators.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCommentAndIndicator | 1 | Display comment and indicator at all times.
xlCommentIndicatorOnly | -1 | Display comment indicator only. Display comment when mouse pointer is moved over cell.
xlNoIndicator | 0 | Display neither the comment nor the comment indicator at any time.


XlConditionValueTypes Enumeration (Excel)

 Copy code hover
[image]

XlConditionValueTypes Enumeration (Excel)
Send feedback

Specifies the types of condition values that can be used.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlConditionValueAutomaticMax | 7 | The longest data bar is proportional to the maximum value in the range.
xlConditionValueAutomaticMin | 6 | The shortest data bar is proportional to the minimum value in the range.
xlConditionValueFormula | 4 | Formula is used.
xlConditionValueHighestValue | 2 | Highest value from the list of values.
xlConditionValueLowestValue | 1 | Lowest value from the list of values.
xlConditionValueNone | -1 | No conditional value.
xlConditionValueNumber | 0 | Number is used.
xlConditionValuePercent | 3 | Percentage is used.
xlConditionValuePercentile | 5 | Percentile is used.


XlConnectionType Enumeration (Excel)

 Copy code hover
[image]

XlConnectionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of database connection.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlConnectionTypeDATAFEED | 6 | Data Feed
XlConnectionType.xlConnectionTypeMODEL | 7 | PowerPivot Model
xlConnectionTypeNOSOURCE |  | No source
xlConnectionTypeODBC | 2 | ODBC
xlConnectionTypeOLEDB | 1 | OLEDB
xlConnectionTypeTEXT | 4 | Text
xlConnectionTypeWEB | 5 | Web
xlConnectionTypeWORKSHEET | 8 | Worksheet
xlConnectionTypeXMLMAP | 3 | XML MAP


XlConsolidationFunction Enumeration (Excel)

 Copy code hover
[image]

XlConsolidationFunction Enumeration (Excel)
Send feedback

Specifies the subtotal function.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlAverage | -4106 | Average.
xlCount | -4112 | Count.
xlCountNums | -4113 | Count numerical values only.
xlDistinctCount | 111 | Count using Distinct Count analysis.
xlMax | -4136 | Maximum.
xlMin | -4139 | Minimum.
xlProduct | -4149 | Multiply.
xlStDev | -4155 | Standard deviation, based on a sample.
xlStDevP | -4156 | Standard deviation, based on the whole population.
xlSum | -4157 | Sum.
xlUnknown | 1000 | No subtotal function specified.
xlVar | -4164 | Variation, based on a sample.
xlVarP | -4165 | Variation, based on the whole population.


XlContainsOperator Enumeration (Excel)

 Copy code hover
[image]

XlContainsOperator Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the operator used in a function.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBeginsWith | 2 | Begins with a specified value.
xlContains | 0 | Contains a specified value.
xlDoesNotContain | 1 | Does not contain the specified value.
xlEndsWith | 3 | Endswith the specified value


XlCopyPictureFormat Enumeration (Excel)

 Copy code hover
[image]

XlCopyPictureFormat Enumeration (Excel)
Send feedback

Specifies the format of the picture being copied.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBitmap | 2 | Bitmap (.bmp, .jpg, .gif).
xlPicture | -4147 | Drawn picture (.png, .wmf, .mix).


XlCorruptLoad Enumeration (Excel)

 Copy code hover
[image]

XlCorruptLoad Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the processing for a file when it is opened.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlExtractData | 2 | Workbook is opened in extract data mode.
xlNormalLoad | 0 | Workbook is opened normally.
xlRepairFile | 1 | Workbook is opened in repair mode.


XlCreator Enumeration (Excel)

 Copy code hover
[image]

XlCreator Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the 32-bit creator code for Excel for Macintosh (decimal 1480803660, Hex 5843454C, string XCEL).

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCreatorCode | 1480803660 | The Excel for Macintosh creator code.


XlCredentialsMethod Enumeration (Excel)

 Copy code hover
[image]

XlCredentialsMethod Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of credentials method used.

Version Information

Version Added: Excel 2007

Name | Value | Description
CredentialsMethodIntegrated | 0 | Integrated
CredentialsMethodNone | 1 | No credentials used
CredentialsMethodStored | 2 | Use stored credentials


XlCubeFieldSubType Enumeration (Excel)

 Copy code hover
[image]

XlCubeFieldSubType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the subtype of the CubeField.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlCubeAttribute | 4 | Attribute
xlCubeCalculatedMeasure | 5 | Calculated Measure
xlCubeHierarchy | 1 | Hierarchy
xlCubeImplicitMeasure | 11 | An implicit measure
xlCubeKPIGoal | 7 | KPI Goal
xlCubeKPIStatus | 8 | KPI Status
xlCubeKPITrend | 9 | KPI Trend
xlCubeKPIValue | 6 | KPI Value
xlCubeKPIWeight | 10 | KPI Weight
xlCubeMeasure | 2 | Measure
xlCubeSet | 3 | Set

Remarks

Note Note

The values have "Cube" in the name in order to not overlap with the xlMeasure and xlSet values for the CubeFieldType property. If the names are the same, autocomplete will not work in the Visual Basic environment because it finds ambiguous values.


XlCubeFieldType Enumeration (Excel)

 Copy code hover
[image]

XlCubeFieldType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether the OLAP field is a hierarchy, set, or measure field.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHierarchy | 1 | OLAP field is a hierarchy.
xlMeasure | 2 | OLAP field is a measure.
xlSet | 3 | OLAP field is a set.


XlCutCopyMode Enumeration (Excel)

 Copy code hover
[image]

XlCutCopyMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether status is Copy mode or Cut mode.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCopy | 1 | In Copy mode
xlCut | 2 | In Cut mode


XlCVError Enumeration (Excel)

 Copy code hover
[image]

XlCVError Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the cell error number and value.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlErrDiv0 | 2007 | Error number: 2007
xlErrNA | 2042 | Error number: 2042
xlErrName | 2029 | Error number: 2029
xlErrNull | 2000 | Error number: 2000
xlErrNum | 2036 | Error number: 2036
xlErrRef | 2023 | Error number: 2023
xlErrValue | 2015 | Error number: 2015


XlDataBarAxisPosition Enumeration (Excel)

 Copy code hover
[image]

XlDataBarAxisPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the axis position for a range of cells with conditional formatting as data bars.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlDataBarAxisAutomatic | 0 | Display the axis at a variable position based on the ratio of the minimum negative value to the maximum positive value in the range. Positive values are displayed in a left-to-right direction. Negative values are displayed in a right-to-left direction. When all values are positive or all values are negative, no axis is displayed.
xlDataBarAxisMidpoint | 1 | Display the axis at the midpoint of the cell regardless of the set of values in the range. Positive values are displayed in a left-to-right direction. Negative values are displayed in a right-to-left direction.
xlDataBarAxisNone | 2 | No axis is displayed, and both positive and negative values are displayed in the left-to-right direction.


XlDataBarBorderType Enumeration (Excel)

 Copy code hover
[image]

XlDataBarBorderType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the border of a data bar.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlDataBarBorderNone | 0 | The data bar has no border.
xlDataBarBorderSolid | 1 | The data bar has a solid border.


XlDataBarFillType Enumeration (Excel)

 Copy code hover
[image]

XlDataBarFillType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how a data bar is filled with color.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlDataBarFillGradient | 1 | The data bar is filled with a color gradient.
xlDataBarFillSolid | 0 | The data bar is filled with solid color.


XlDataBarNegativeColorType Enumeration (Excel)

 Copy code hover
[image]

XlDataBarNegativeColorType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether to use the same border and fill color as postive data bars.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlDataBarColor | 0 | Use the color specified in the Negative Value and Axis Setting dialog box or by using the ColorType and BorderColorType properties of the NegativeBarFormat object.
xlDataBarSameAsPositive | 1 | Use the same color as positive data bars.


XlDataLabelPosition Enumeration (Excel)

 Copy code hover
[image]

XlDataLabelPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies where the data label is positioned.

Name | Value | Description
xlLabelPositionAbove | 0 | Data label is positioned above the data point.
xlLabelPositionBelow | 1 | Data label is positioned below the data point.
xlLabelPositionBestFit | 5 | Microsoft Office Excel 2007 sets the position of the data label.
xlLabelPositionCenter | -4108 | Data label is centered on the data point or is inside a bar or pie chart.
xlLabelPositionCustom | 7 | Data label is in a custom position.
xlLabelPositionInsideBase | 4 | Data label is positioned inside the data point at the bottom edge.
xlLabelPositionInsideEnd | 3 | Data label is positioned inside the data point at the top edge.
xlLabelPositionLeft | -4131 | Data label is positioned to the left of the data point.
xlLabelPositionMixed | 6 | Data labels are in multiple positions.
xlLabelPositionOutsideEnd | 2 | Data label is positioned outside the data point at the top edge.
xlLabelPositionRight | -4152 | Data label is positioned to the right of the data point.


XlDataLabelSeparator Enumeration (Excel)

 Copy code hover
[image]

XlDataLabelSeparator Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the separator used with data labels.

Name | Value | Description
xlDataLabelSeparatorDefault | 1 | Excel selects the separator.


XlDataLabelsType Enumeration (Excel)

 Copy code hover
[image]

XlDataLabelsType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of data label to apply.

Name | Value | Description
xlDataLabelsShowBubbleSizes | 6 | Show the size of the bubble in reference to the absolute value.
xlDataLabelsShowLabel | 4 | Category for the point.
xlDataLabelsShowLabelAndPercent | 5 | Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.
xlDataLabelsShowNone | -4142 | No data labels.
xlDataLabelsShowPercent | 3 | Percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowValue | 2 | Default value for the point (assumed if this argument is not specified).


XlDataSeriesDate Enumeration (Excel)

 Copy code hover
[image]

XlDataSeriesDate Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of date to apply to a data series.

Name | Value | Description
xlDay | 1 | Day
xlMonth | 3 | Month
xlWeekday | 2 | Weekdays
xlYear | 4 | Year


XlDataSeriesType Enumeration (Excel)

 Copy code hover
[image]

XlDataSeriesType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the data series to create.

Name | Value | Description
xlAutoFill | 4 | Fill series according to AutoFill settings.
xlChronological | 3 | Fill with date values.
xlDataSeriesLinear | -4132 | Extend values, assuming an additive progression (for example, '1, 2' is extended as '3, 4, 5').
xlGrowth | 2 | Extend values, assuming a multiplicative progression (for example, '1, 2' is extended as '4, 8, 16').


XlDeleteShiftDirection Enumeration (Excel)

 Copy code hover
[image]

XlDeleteShiftDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to shift cells to replace deleted cells.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlShiftToLeft | -4159 | Cells are shifted to the left.
xlShiftUp | -4162 | Cells are shifted up.


XlDirection Enumeration (Excel)

 Copy code hover
[image]

XlDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the direction in which to move.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDown | -4121 | Down.
xlToLeft | -4159 | To left.
xlToRight | -4161 | To right.
xlUp | -4162 | Up.


XlDisplayBlanksAs Enumeration (Excel)

 Copy code hover
[image]

XlDisplayBlanksAs Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how blank cells are plotted on a chart.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlInterpolated | 3 | Values are interpolated into the chart.
xlNotPlotted | 1 | Blank cells are not plotted.
xlZero | 2 | Blanks are plotted as zero.


XlDisplayDrawingObjects Enumeration (Excel)

 Copy code hover
[image]

XlDisplayDrawingObjects Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how shapes are displayed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDisplayShapes | -4104 | Show all shapes.
xlHide | 3 | Hide all shapes.
xlPlaceholders | 2 | Show only placeholders.


XlDisplayUnit Enumeration (Excel)

 Copy code hover
[image]

XlDisplayUnit Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the display unit label for an axis.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHundredMillions | -8 | Hundreds of millions.
xlHundreds | -2 | Hundreds.
xlHundredThousands | -5 | Hundreds of thousands.
xlMillionMillions | -10 | Millions of millions.
xlMillions | -6 | Millions.
xlTenMillions | -7 | Tens of millions.
xlTenThousands | -4 | Tens of thousands.
xlThousandMillions | -9 | Thousands of millions.
xlThousands | -3 | Thousands.


XlDupeUnique Enumeration (Excel)

 Copy code hover
[image]

XlDupeUnique Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether duplicate or unique values shoud be displayed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDuplicate | 1 | Display duplicate values.
xlUnique | 0 | Display unique values.


XlDVAlertStyle Enumeration (Excel)

 Copy code hover
[image]

XlDVAlertStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the icon used in message boxes displayed during validation.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlValidAlertInformation | 3 | Information icon.
xlValidAlertStop | 1 | Stop icon.
xlValidAlertWarning | 2 | Warning icon.


XlDVType Enumeration (Excel)

 Copy code hover
[image]

XlDVType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of validation test to be performed in conjunction with values.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlValidateCustom | 7 | Data is validated using an arbitrary formula.
xlValidateDate | 4 | Date values.
xlValidateDecimal | 2 | Numeric values.
xlValidateInputOnly | 0 | Validate only when user changes the value.
xlValidateList | 3 | Value must be present in a specified list.
xlValidateTextLength | 6 | Length of text.
xlValidateTime | 5 | Time values.
xlValidateWholeNumber | 1 | Whole numeric values.


XlDynamicFilterCriteria Enumeration (Excel)

 Copy code hover
[image]

XlDynamicFilterCriteria Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the filter criterion.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFilterAboveAverage | 33 | Filter all above-average values.
xlFilterAllDatesInPeriodApril | 24 | Filter all dates in April.
xlFilterAllDatesInPeriodAugust | 28 | Filter all dates in August.
xlFilterAllDatesInPeriodDecember | 32 | Filter all dates in December.
xlFilterAllDatesInPeriodFebruray | 22 | Filter all dates in February.
xlFilterAllDatesInPeriodJanuary | 21 | Filter all dates in January.
xlFilterAllDatesInPeriodJuly | 27 | Filter all dates in July.
xlFilterAllDatesInPeriodJune | 26 | Filter all dates in June.
xlFilterAllDatesInPeriodMarch | 23 | Filter all dates in March.
xlFilterAllDatesInPeriodMay | 25 | Filter all dates in May.
xlFilterAllDatesInPeriodNovember | 31 | Filter all dates in November.
xlFilterAllDatesInPeriodOctober | 30 | Filter all dates in October.
xlFilterAllDatesInPeriodQuarter1 | 17 | Filter all dates in Quarter1.
xlFilterAllDatesInPeriodQuarter2 | 18 | Filter all dates in Quarter2.
xlFilterAllDatesInPeriodQuarter3 | 19 | Filter all dates in Quarter3.
xlFilterAllDatesInPeriodQuarter4 | 20 | Filter all dates in Quarter4.
xlFilterAllDatesInPeriodSeptember | 29 | Filter all dates in September.
xlFilterBelowAverage | 34 | Filter all below-average values.
xlFilterLastMonth | 8 | Filter all values related to last month.
xlFilterLastQuarter | 11 | Filter all values related to last quarter.
xlFilterLastWeek | 5 | Filter all values related to last week.
xlFilterLastYear | 14 | Filter all values related to last year.
xlFilterNextMonth | 9 | Filter all values related to next month.
xlFilterNextQuarter | 12 | Filter all values related to next quarter.
xlFilterNextWeek | 6 | Filter all values related to next week.
xlFilterNextYear | 15 | Filter all values related to next year.
xlFilterThisMonth | 7 | Filter all values related to the current month.
xlFilterThisQuarter | 10 | Filter all values related to the current quarter.
xlFilterThisWeek | 4 | Filter all values related to the current week.
xlFilterThisYear | 13 | Filter all values related to the current year.
xlFilterToday | 1 | Filter all values related to the current date.
xlFilterTomorrow | 3 | Filter all values related to tomorrow.
xlFilterYearToDate | 16 | Filter all values from today until a year ago.
xlFilterYesterday | 2 | Filter all values related to yesterday.


XlEditionFormat Enumeration (Excel)

 Copy code hover
[image]

XlEditionFormat Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the format of the published edition. This enumeration is only for Macintosh and should not be used.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBIFF | 2 | Binary Interchange file format.
xlPICT | 1 | Metafile picture structure (.wmf).
xlRTF | 4 | Rich Text Format (.rtf).
xlVALU | 8 | VALU.


XlEditionOptionsOption Enumeration (Excel)

 Copy code hover
[image]

XlEditionOptionsOption Enumeration (Excel)
Send feedback

Published: July 16, 2012

This enumeration is only for Macintosh and should not be used.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAutomaticUpdate | 4 | Automatic update.
xlCancel | 1 | Cancel.
xlChangeAttributes | 6 | Change attributes.
xlManualUpdate | 5 | Manual update.
xlOpenSource | 3 | Open source.
xlSelect | 3 | Select.
xlSendPublisher | 2 | Send to Microsoft Publisher.
xlUpdateSubscriber | 2 | Update subscriber.


XlEditionType Enumeration (Excel)

 Copy code hover
[image]

XlEditionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of edition to be changed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPublisher | 1 | Publisher
xlSubscriber | 2 | Subscriber


XlEnableCancelKey Enumeration (Excel)

 Copy code hover
[image]

XlEnableCancelKey Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Office Excel 2007 handles CTRL+BREAK (or ESC or COMMAND+PERIOD) user interruptions to the running procedure.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDisabled | 0 | Cancel key trapping is completely disabled.
xlErrorHandler | 2 | The interrupt is sent to the running procedure as an error, trappable by an error handler set up with an On Error GoTo statement. The trappable error code is 18.
xlInterrupt | 1 | The current procedure is interrupted, and the user can debug or end the procedure.


XlEnableSelection Enumeration (Excel)

 Copy code hover
[image]

XlEnableSelection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what can be selected on the sheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlNoRestrictions | 0 | Anything can be selected.
xlNoSelection | -4142 | Nothing can be selected.
xlUnlockedCells | 1 | Only unlocked cells can be selected.


XlEndStyleCap Enumeration (Excel)

 Copy code hover
[image]

XlEndStyleCap Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the end style for error bars.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCap | 1 | Caps applied.
xlNoCap | 2 | No caps applied.


XlErrorBarDirection Enumeration (Excel)

 Copy code hover
[image]

XlErrorBarDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which axis values are to receive error bars.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlX | -4168 | Bars run parallel to the Y axis for X-axis values.
xlY | 1 | Bars run parallel to the X axis for Y-axis values.


XlErrorBarInclude Enumeration (Excel)

 Copy code hover
[image]

XlErrorBarInclude Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which error-bar parts to include.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlErrorBarIncludeBoth | 1 | Both positive and negative error range.
xlErrorBarIncludeMinusValues | 3 | Only negative error range.
xlErrorBarIncludeNone | -4142 | No error bar range.
xlErrorBarIncludePlusValues | 2 | Only positive error range.


XlErrorBarType Enumeration (Excel)

 Copy code hover
[image]

XlErrorBarType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the range marked by error bars.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlErrorBarTypeCustom | -4114 | Range is set by fixed values or cell values.
xlErrorBarTypeFixedValue | 1 | Fixed-length error bars.
xlErrorBarTypePercent | 2 | Percentage of range to be covered by the error bars.
xlErrorBarTypeStDev | -4155 | Shows range for specified number of standard deviations.
xlErrorBarTypeStError | 4 | Shows standard error range.


XlErrorChecks Enumeration (Excel)

 Copy code hover
[image]

XlErrorChecks Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of error object to be retrieved from the Errors collection.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlEmptyCellReferences | 7 | The cell contains a formula referring to empty cells.
xlEvaluateToError | 1 | The cell evaluates to an error value.
xlInconsistentFormula | 4 | The cell contains an inconsistent formula for a region.
xlInconsistentListFormula | 9 | The cell contains an inconsistent formula for a list.
xlListDataValidation | 8 | Data in the list contains a validation error.
xlNumberAsText | 3 | Number entered as text.
xlOmittedCells | 5 | Cells omitted.
xlTextDate | 2 | Date entered as text.
xlUnlockedFormulaCells | 6 | Formula cells are unlocked.


XlFileAccess Enumeration (Excel)

 Copy code hover
[image]

XlFileAccess Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the new access mode for the object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlReadOnly | 3 | Read only.
xlReadWrite | 2 | Read/write.


XlFileFormat Enumeration (Excel)

 Copy code hover
[image]

XlFileFormat Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the file format when saving the worksheet.

Name | Value | Description
xlAddIn | 18 | Microsoft Excel 97-2003 Add-In
xlAddIn8 | 18 | Microsoft Excel 97-2003 Add-In
xlCSV | 6 | CSV
xlCSVMac | 22 | Macintosh CSV
xlCSVMSDOS | 24 | MSDOS CSV
xlCSVWindows | 23 | Windows CSV
xlCurrentPlatformText | -4158 | Current Platform Text
xlDBF2 | 7 | DBF2
xlDBF3 | 8 | DBF3
xlDBF4 | 11 | DBF4
xlDIF | 9 | DIF
xlExcel12 | 50 | Excel12
xlExcel2 | 16 | Excel2
xlExcel2FarEast | 27 | Excel2 FarEast
xlExcel3 | 29 | Excel3
xlExcel4 | 33 | Excel4
xlExcel4Workbook | 35 | Excel4 Workbook
xlExcel5 | 39 | Excel5
xlExcel7 | 39 | Excel7
xlExcel8 | 56 | Excel8
xlExcel9795 | 43 | Excel9795
xlHtml | 44 | HTML format
xlIntlAddIn | 26 | International Add-In
xlIntlMacro | 25 | International Macro
xlOpenDocumentSpreadsheet | 60 | OpenDocument Spreadsheet
xlOpenXMLAddIn | 55 | Open XML Add-In
xlOpenXMLStrictWorkbook | 61 (&H3D) | Strict Open XML file
xlOpenXMLTemplate | 54 | Open XML Template
xlOpenXMLTemplateMacroEnabled | 53 | Open XML Template Macro Enabled
xlOpenXMLWorkbook | 51 | Open XML Workbook
xlOpenXMLWorkbookMacroEnabled | 52 | Open XML Workbook Macro Enabled
xlSYLK | 2 | SYLK
xlTemplate | 17 | Template
xlTemplate8 | 17 | Template 8
xlTextMac | 19 | Macintosh Text
xlTextMSDOS | 21 | MSDOS Text
xlTextPrinter | 36 | Printer Text
xlTextWindows | 20 | Windows Text
xlUnicodeText | 42 | Unicode Text
xlWebArchive | 45 | Web Archive
xlWJ2WD1 | 14 | WJ2WD1
xlWJ3 | 40 | WJ3
xlWJ3FJ3 | 41 | WJ3FJ3
xlWK1 | 5 | WK1
xlWK1ALL | 31 | WK1ALL
xlWK1FMT | 30 | WK1FMT
xlWK3 | 15 | WK3
xlWK3FM3 | 32 | WK3FM3
xlWK4 | 38 | WK4
xlWKS | 4 | Worksheet
xlWorkbookDefault | 51 | Workbook default
xlWorkbookNormal | -4143 | Workbook normal
xlWorks2FarEast | 28 | Works2 FarEast
xlWQ1 | 34 | WQ1
xlXMLSpreadsheet | 46 | XML Spreadsheet


XlFileValidationPivotMode Enumeration (Excel)

 Copy code hover
[image]

XlFileValidationPivotMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to validate the data caches for PivotTable reports.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlFileValidationPivotDefault | 0 | Validate the contents of data caches as specified by the PivotOptions registry setting (default).
xlFileValidationPivotRun | 1 | Validate the contents of all data caches regardless of the registry setting.
xlFileValidationPivotSkip | 2 | Do not validate the contents of data caches.

Remarks

This enumeration is used to specify the setting of the FileValidationPivot property of the Application object.

The effect of the xlFileValidationPivotDefault setting is controlled by the PivotOptions registry value, which is set in the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Security\FileValidation. The PivotOptions value is a DWORD value that can be set as listed in the following table.

PivotOptions value

Description

0

Never validate PivotTable report data caches. (Not recommended)

1

Validate PivotTable report data caches in the following cases (Default setting):

  • The file was opened from the Internet.

  • The file is an e-mail attachment.

  • The file was opened by using the Open in Protected View command of the Open dialog box.

  • The file was opened from a known unsafe location where Internet content is cached locally, or from a user-defined untrusted location.

  • The data cache is parsed on load when the file is opened.

2

Validate all PivotTable report data caches.


XlFillWith Enumeration (Excel)

 Copy code hover
[image]

XlFillWith Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to copy the range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFillWithAll | -4104 | Copy contents and formats.
xlFillWithContents | 2 | Copy contents only.
xlFillWithFormats | -4122 | Copy formats only.


XlFilterAction Enumeration (Excel)

 Copy code hover
[image]

XlFilterAction Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether data is to be copied or left in place during a filter operation.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFilterCopy | 2 | Copy filtered data to new location.
xlFilterInPlace | 1 | Leave data in place.


XlFilterAllDatesInPeriod Enumeration (Excel)

 Copy code hover
[image]

XlFilterAllDatesInPeriod Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how dates should be filtered in the specified period.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFilterAllDatesInPeriodDay | 2 | Filter all dates for the specified date.
xlFilterAllDatesInPeriodHour | 3 | Filter all dates for the specified hour.
xlFilterAllDatesInPeriodMinute | 4 | Filter all dates until the specified minute.
xlFilterAllDatesInPeriodMonth | 1 | Filter all dates for the specified month.
xlFilterAllDatesInPeriodSecond | 5 | Filter all dates until the specified second.
xlFilterAllDatesInPeriodYear | 0 | Filter all dates for the specified year.


XlFilterStatus Enumeration (Excel)

 Copy code hover
[image]

XlFilterStatus Enumeration (Excel)
Send feedback

Published: July 16, 2012

Used to return a status from filter functions.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
xlFilterStatusOK | 0 | Signifies OK or successful.
xlFilterStatusDateWrongOrder | 1 | SetFilterDateRange(…): StartDate > EndDate
xlFilterStatusDateHasTime | 2 | SetFilterDateRange(…): StartDate or EndDate have a time portion.
xlFilterStatusInvalidDate | 3 | SetFilterDateRange(…): StartDate or EndDate are not valid dates.


XlFindLookIn Enumeration (Excel)

 Copy code hover
[image]

XlFindLookIn Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of data to search.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlComments | -4144 | Comments.
xlFormulas | -4123 | Formulas.
xlValues | -4163 | Values.


XlFixedFormatQuality Enumeration (Excel)

 Copy code hover
[image]

XlFixedFormatQuality Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the quality of speadsheets saved in different fixed formats.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlQualityMinimum | 1 | Minimum quality
xlQualityStandard | 0 | Standard quality


XlFixedFormatType Enumeration (Excel)

 Copy code hover
[image]

XlFixedFormatType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of file format.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTypePDF | 0 | "PDF" — Portable Document Format file (.pdf).
xlTypeXPS | 1 | "XPS" — XPS Document (.xps).


XlFormatConditionOperator Enumeration (Excel)

 Copy code hover
[image]

XlFormatConditionOperator Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the operator to use to compare a formula against the value in a cell or, for xlBetween and xlNotBetween, to compare two formulas.

Name | Value | Description
xlBetween | 1 | Between. Can be used only if two formulas are provided.
xlEqual | 3 | Equal.
xlGreater | 5 | Greater than.
xlGreaterEqual | 7 | Greater than or equal to.
xlLess | 6 | Less than.
xlLessEqual | 8 | Less than or equal to.
xlNotBetween | 2 | Not between. Can be used only if two formulas are provided.
xlNotEqual | 4 | Not equal.


XlFormatConditionType Enumeration (Excel)

 Copy code hover
[image]

XlFormatConditionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether the conditional format is based on a cell value or an expression.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAboveAverageCondition | 12 | Above average condition
xlBlanksCondition | 10 | Blanks condition
xlCellValue | 1 | Cell value
xlColorScale | 3 | Color scale
xlDatabar | 4 | Databar
xlErrorsCondition | 16 | Errors condition
xlExpression | 2 | Expression
XlIconSet | 6 | Icon set
xlNoBlanksCondition | 13 | No blanks condition
xlNoErrorsCondition | 17 | No errors condition
xlTextString | 9 | Text string
xlTimePeriod | 11 | Time period
xlTop10 | 5 | Top 10 values
xlUniqueValues | 8 | Unique values


XlFormatFilterTypes Enumeration (Excel)

 Copy code hover
[image]

XlFormatFilterTypes Enumeration (Excel)
Send feedback

Specifies the types of format filters.

Version Information

Version Added: Excel 2007

Name | Value | Description
FilterBottom | 0 | Bottom.
FilterBottomPercent | 2 | Bottom Percent.
FilterTop | 1 | Top.
FilterTopPercent | 3 | Top Percent.


XlFormControl Enumeration (Excel)

 Copy code hover
[image]

XlFormControl Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of the form control.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlButtonControl | 0 | Button.
xlCheckBox | 1 | Check box.
xlDropDown | 2 | Combo box.
xlEditBox | 3 | Text box.
xlGroupBox | 4 | Group box.
xlLabel | 5 | Label.
xlListBox | 6 | List box.
xlOptionButton | 7 | Option button.
xlScrollBar | 8 | Scroll bar.
xlSpinner | 9 | Spinner.


XlFormulaLabel Enumeration (Excel)

 Copy code hover
[image]

XlFormulaLabel Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the formula label type for the specified range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColumnLabels | 2 | Column labels only.
xlMixedLabels | 3 | Row and column labels.
xlNoLabels | -4142 | No labels.
xlRowLabels | 1 | Row labels only.


XlGenerateTableRefs Enumeration (Excel)

 Copy code hover
[image]

XlGenerateTableRefs Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of table references.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlA1TableRefs | 0 | A1 Table References.
xlTableNames | 1 | Table Names.


XlGradientFillType Enumeration (Excel)

 Copy code hover
[image]

XlGradientFillType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of gradient fill.

Version Information

Version Added: Excel 2007

Name | Value | Description
GradientFillLinear | 0 | Gradient is filled in a straight line.
GradientFillPath | 1 | Gradient is filled in a non-linear or curved path.


XlHAlign Enumeration (Excel)

 Copy code hover
[image]

XlHAlign Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the horizontal alignment for the object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHAlignCenter | -4108 | Center.
xlHAlignCenterAcrossSelection | 7 | Center across selection.
xlHAlignDistributed | -4117 | Distribute.
xlHAlignFill | 5 | Fill.
xlHAlignGeneral | 1 | Align according to data type.
xlHAlignJustify | -4130 | Justify.
xlHAlignLeft | -4131 | Left.
xlHAlignRight | -4152 | Right.


XlHebrewModes Enumeration (Excel)

 Copy code hover
[image]

XlHebrewModes Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the mode for the Hebrew spelling checker.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHebrewFullScript | 0 | The conventional script type as required by the Hebrew Language Academy when writing text without diacritics.
xlHebrewMixedAuthorizedScript | 3 | The Hebrew traditional script.
xlHebrewMixedScript | 2 | In this mode the speller accepts any word recognized as Hebrew, whether in Full Script, Partial Script, or any unconventional spelling variation that is known to the speller.
xlHebrewPartialScript | 1 | In this mode the speller accepts words both in Full Script and Partial Script. Some words will be flagged since this spelling is not authorized in either Full script or Partial script.


XlHighlightChangesTime Enumeration (Excel)

 Copy code hover
[image]

XlHighlightChangesTime Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which set of changes is shown in a shared workbook.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAllChanges | 2 | Show all changes.
xlNotYetReviewed | 3 | Show only changes not yet reviewed.
xlSinceMyLastSave | 1 | Show changes made since last save by last user.


XlHtmlType Enumeration (Excel)

 Copy code hover
[image]

XlHtmlType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of HTML generated by Excel when you save the specified item to a Web page and whether the item is static or interactive.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHtmlCalc | 1 | Use the Spreadsheet component. Deprecated.
xlHtmlChart | 3 | Use the Chart component. Deprecated.
xlHtmlList | 2 | Use the PivotTable component. Deprecated.
xlHtmlStatic | 0 | Use static (noninteractive) HTML for viewing only.

Remarks

Note Note

All XlHtmlType enumerations other than xlHtmlStatic have been deprecated.


XlIcon Enumeration (Excel)

 Copy code hover
[image]

XlIcon Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the icon for a criterion in an icon set conditional formatting rule.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlIcon0Bars | 37 | Signal Meter With No Filled Bars
xlIcon0FilledBoxes | 52 | 0 Filled Boxes
xlIcon1Bar | 38 | Signal Meter With One Filled Bar
xlIcon1FilledBox | 51 | 1 Filled Boxes
xlIcon2Bars | 39 | Signal Meter With Two Filled Bars
xlIcon2FilledBoxes | 50 | 2 Filled Boxes
xlIcon3Bars | 40 | Signal Meter With Three Filled Bars
xlIcon3FilledBoxes | 49 | 3 Filled Boxes
xlIcon4Bars | 41 | Signal Meter With Four Filled Bars
xlIcon4FilledBoxes | 48 | 4 Filled Boxes
xlIconBlackCircle | 32 | Black Circle
xlIconBlackCircleWithBorder | 13 | Black Circle With Border
xlIconCircleWithOneWhiteQuarter | 33 | Circle With One White Quarter
xlIconCircleWithThreeWhiteQuarters | 35 | Circle With Three White Quarters
xlIconCircleWithTwoWhiteQuarters | 34 | Circle With Two White Quarters
xlIconGoldStar | 42 | Gold Star
xlIconGrayCircle | 31 | Gray Circle
xlIconGrayDownArrow | 6 | Gray Down Arrow
xlIconGrayDownInclineArrow | 28 | Gray Down Incline Arrow
xlIconGraySideArrow | 5 | Gray Side Arrow
xlIconGrayUpArrow | 4 | Gray Up Arrow
xlIconGrayUpInclineArrow | 27 | Gray Up Incline Arrow
xlIconGreenCheck | 22 | Green Check
xlIconGreenCheckSymbol | 19 | Green Check Symbol
xlIconGreenCircle | 10 | Green Circle
xlIconGreenFlag | 7 | Green Flag
xlIconGreenTrafficLight | 14 | Green Traffic Light
xlIconGreenUpArrow | 1 | Green Up Arrow
xlIconGreenUpTriangle | 45 | Green Up Triangle
xlIconHalfGoldStar | 43 | Half Gold Star
xlIconNoCellIcon | -1 | No Cell Icon
xlIconPinkCircle | 30 | Pink Circle
xlIconRedCircle | 29 | Red Circle
xlIconRedCircleWithBorder | 12 | Red Circle With Border
xlIconRedCross | 24 | Red Cross
xlIconRedCrossSymbol | 21 | Red Cross Symbol
xlIconRedDiamond | 18 | Red Diamond
xlIconRedDownArrow | 3 | Red Down Arrow
xlIconRedDownTriangle | 47 | Red Down Triangle
xlIconRedFlag | 9 | Red Flag
xlIconRedTrafficLight | 16 | Red Traffic Light
xlIconSilverStar | 44 | Silver Star
xlIconWhiteCircleAllWhiteQuarters | 36 | White Circle (All White Quarters)
xlIconYellowCircle | 11 | Yellow Circle
xlIconYellowDash | 46 | Yellow Dash
xlIconYellowDownInclineArrow | 26 | Yellow Down Incline Arrow
xlIconYellowExclamation | 23 | Yellow Exclamation
xlIconYellowExclamationSymbol | 20 | Yellow Exclamation Symbol
xlIconYellowFlag | 8 | Yellow Flag
xlIconYellowSideArrow | 2 | Yellow Side Arrow
xlIconYellowTrafficLight | 15 | Yellow Traffic Light
xlIconYellowTriangle | 17 | Yellow Triangle
xlIconYellowUpInclineArrow | 25 | Yellow Up Incline Arrow

Remarks

Specify the icon for a criterion in an icon set conditional formatting rule by using the Icon property of the IconCriterion object.


XlIconSet Enumeration (Excel)

 Copy code hover
[image]

XlIconSet Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of icon set.

Version Information

Version Added: Excel 2007

Name | Value | Description
xl3Arrows | 1 | 3 Arrows
xl3ArrowsGray | 2 | 3 Arrows Gray
xl3Flags | 3 | 3 Flags
xl3Signs | 6 | 3 Signs
xl3Symbols | 7 | 3 Symbols
xl3TrafficLights1 | 4 | 3 Traffic Lights 1
xl3TrafficLights2 | 5 | 3 Traffic Lights 2
xl4Arrows | 8 | 4 Arrows
xl4ArrowsGray | 9 | 4 Arrows Gray
xl4CRV | 11 | 4 CRV
xl4RedToBlack | 10 | 4 Red To Black
xl4TrafficLights | 12 | 4 Traffic Lights
xl5Arrows | 13 | 5 Arrows
xl5ArrowsGray | 14 | 5 Arrows Gray
xl5CRV | 15 | 5 CRV
xl5Quarters | 16 | 5 Quarters


XlIMEMode Enumeration (Excel)

 Copy code hover
[image]

XlIMEMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the description of the Japanese input rules.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlIMEModeAlpha | 8 | Half-width alphanumeric.
xlIMEModeAlphaFull | 7 | Full-width alphanumeric.
xlIMEModeDisable | 3 | Disable.
xlIMEModeHangul | 10 | Hangul.
xlIMEModeHangulFull | 9 | Full-width Hangul.
xlIMEModeHiragana | 4 | Hiragana.
xlIMEModeKatakana | 5 | Katakana.
xlIMEModeKatakanaHalf | 6 | Half-width Katakana.
xlIMEModeNoControl | 0 | No control.
xlIMEModeOff | 2 | Off (English mode).
xlIMEModeOn | 1 | Mode on.


XlImportDataAs Enumeration (Excel)

 Copy code hover
[image]

XlImportDataAs Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the format in which to return data from a database.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPivotTableReport | 1 | Returns the data as a PivotTable.
xlQueryTable | 0 | Returns the data as a QueryTable.


XlInsertFormatOrigin Enumeration (Excel)

 Copy code hover
[image]

XlInsertFormatOrigin Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies from where to copy the format for inserted rows.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFormatFromLeftOrAbove | 0 | Copy the format from cells above and/or to the left.
xlFormatFromRightOrBelow | 1 | Copy the format from cells below and/or to the right.


XlInsertShiftDirection Enumeration (Excel)

 Copy code hover
[image]

XlInsertShiftDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the direction in which to shift cells during an insertion.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlShiftDown | -4121 | Shift cells down.
xlShiftToRight | -4161 | Shift cells to the right.


XlLayoutFormType Enumeration (Excel)

 Copy code hover
[image]

XlLayoutFormType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way the specified PivotTable items appear—in table format or in outline format.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlOutline | 1 | The LayoutSubtotalLocation property specifies where the subtotal appears in the PivotTable report.
xlTabular | 0 | Default.


XlLayoutRowType Enumeration (Excel)

 Copy code hover
[image]

XlLayoutRowType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of layout row.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCompactRow | 0 | Compact Row
xlOutlineRow | 2 | Outline Row
xlTabularRow | 1 | Tabular Row


XlLegendPosition Enumeration (Excel)

 Copy code hover
[image]

XlLegendPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the position of the legend on a chart.

Name | Value | Description
xlLegendPositionBottom | -4107 | Below the chart.
xlLegendPositionCorner | 2 | In the upper right-hand corner of the chart border.
xlLegendPositionCustom | -4161 | A custom position.
xlLegendPositionLeft | -4131 | Left of the chart.
xlLegendPositionRight | -4152 | Right of the chart.
xlLegendPositionTop | -4160 | Above the chart.


XlLineStyle Enumeration (Excel)

 Copy code hover
[image]

XlLineStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the line style for the border.

Name | Value | Description
xlContinuous | 1 | Continuous line.
xlDash | -4115 | Dashed line.
xlDashDot | 4 | Alternating dashes and dots.
xlDashDotDot | 5 | Dash followed by two dots.
xlDot | -4118 | Dotted line.
xlDouble | -4119 | Double line.
xlLineStyleNone | -4142 | No line.
xlSlantDashDot | 13 | Slanted dashes.


XlLink Enumeration (Excel)

 Copy code hover
[image]

XlLink Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of link.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlExcelLinks | 1 | The link is to an Excel worksheet.
xlOLELinks | 2 | The link is to an OLE source.
xlPublishers | 5 | Macintosh only.
xlSubscribers | 6 | Macintosh only.


XlLinkInfo Enumeration (Excel)

 Copy code hover
[image]

XlLinkInfo Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of information the link will return.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlEditionDate | 2 | Applies only to editions in the Macintosh operating system.
xlLinkInfoStatus | 3 | Returns the link status.
xlUpdateState | 1 | Specifies whether the link updates automatically or manually.


XlLinkInfoType Enumeration (Excel)

 Copy code hover
[image]

XlLinkInfoType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of link.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLinkInfoOLELinks | 2 | OLE or DDE server
xlLinkInfoPublishers | 5 | Publisher
xlLinkInfoSubscribers | 6 | Subscriber


XlLinkStatus Enumeration (Excel)

 Copy code hover
[image]

XlLinkStatus Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the status of a link.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLinkStatusCopiedValues | 10 | Copied values.
xlLinkStatusIndeterminate | 5 | Unable to determine status.
xlLinkStatusInvalidName | 7 | Invalid name.
xlLinkStatusMissingFile | 1 | File missing.
xlLinkStatusMissingSheet | 2 | Sheet missing.
xlLinkStatusNotStarted | 6 | Not started.
xlLinkStatusOK | 0 | No errors.
xlLinkStatusOld | 3 | Status may be out of date.
xlLinkStatusSourceNotCalculated | 4 | Not yet calculated.
xlLinkStatusSourceNotOpen | 8 | Not open.
xlLinkStatusSourceOpen | 9 | Source document is open.


XlLinkType Enumeration (Excel)

 Copy code hover
[image]

XlLinkType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of link.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLinkTypeExcelLinks | 1 | A link to a Microsoft Excel source.
xlLinkTypeOLELinks | 2 | A link to an OLE source.


XlListConflict Enumeration (Excel)

 Copy code hover
[image]

XlListConflict Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the conflict resolution options for updating a list on a Microsoft SharePoint Foundation site with the changes made to a list in a Microsoft Excel worksheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlListConflictDialog | 0 | Display a dialog box that allows the user to choose how to resolve conflicts.
xlListConflictDiscardAllConflicts | 2 | Accept the version of the data stored on the SharePoint site.
xlListConflictError | 3 | Raise an error if a conflict occurs.
xlListConflictRetryAllConflicts | 1 | Overwrite the version of the data stored on the SharePoint site.


XlListDataType Enumeration (Excel)

 Copy code hover
[image]

XlListDataType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the data type of a list column connected to a Microsoft SharePoint Foundation site.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlListDataTypeCheckbox | 9 | Check box.
xlListDataTypeChoice | 6 | Single-choice field.
xlListDataTypeChoiceMulti | 7 | Multiple-choice field.
xlListDataTypeCounter | 11 | Counter.
xlListDataTypeCurrency | 4 | Currency.
xlListDataTypeDateTime | 5 | Date/time.
xlListDataTypeHyperLink | 10 | Hyperlink.
xlListDataTypeListLookup | 8 | Lookup list.
xlListDataTypeMultiLineRichText | 12 | Rich text format with multiple lines.
xlListDataTypeMultiLineText | 2 | Plain text with multiple lines.
xlListDataTypeNone | 0 | Type not specified.
xlListDataTypeNumber | 3 | Numerical.
xlListDataTypeText | 1 | Plain text.


XlListObjectSourceType Enumeration (Excel)

 Copy code hover
[image]

XlListObjectSourceType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the current source of the list.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlSrcExternal | 0 | External data source (Microsoft SharePoint Foundation site).
xlSrcModel | 4 | PowerPivot Model
xlSrcQuery | 3 | Query
xlSrcRange | 1 | Range
xlSrcXml | 2 | XML


XlLocationInTable Enumeration (Excel)

 Copy code hover
[image]

XlLocationInTable Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the part of the PivotTable report that contains the upper-left corner of a range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColumnHeader | -4110 | Column header
xlColumnItem | 5 | Column item
xlDataHeader | 3 | Data header
xlDataItem | 7 | Data item
xlPageHeader | 2 | Page header
xlPageItem | 6 | Page item
xlRowHeader | -4153 | Row header
xlRowItem | 4 | Row item
xlTableBody | 8 | Table body


XlLookAt Enumeration (Excel)

 Copy code hover
[image]

XlLookAt Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether a match is made against the whole of the search text or any part of the search text.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPart | 2 | Match against any part of the search text.
xlWhole | 1 | Match against the whole of the search text.


XlLookFor Enumeration (Excel)

 Copy code hover
[image]

XlLookFor Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what to look for in searches.

Version Information

Version Added: Excel 2007

Name | Value | Description
LookForBlanks | 0 | Blanks
LookForErrors | 1 | Errors
LookForFormulas | 2 | Formulas


XlMailSystem Enumeration (Excel)

 Copy code hover
[image]

XlMailSystem Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the mail system that is installed on the host computer.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlMAPI | 1 | MAPI-complaint system
xlNoMailSystem | 0 | No mail system
xlPowerTalk | 2 | PowerTalk mail system


XlMarkerStyle Enumeration (Excel)

 Copy code hover
[image]

XlMarkerStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the marker style for a point or series in a line chart, scatter chart, or radar chart.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlMarkerStyleAutomatic | -4105 | Automatic markers
xlMarkerStyleCircle | 8 | Circular markers
xlMarkerStyleDash | -4115 | Long bar markers
xlMarkerStyleDiamond | 2 | Diamond-shaped markers
xlMarkerStyleDot | -4118 | Short bar markers
xlMarkerStyleNone | -4142 | No markers
xlMarkerStylePicture | -4147 | Picture markers
xlMarkerStylePlus | 9 | Square markers with a plus sign
xlMarkerStyleSquare | 1 | Square markers
xlMarkerStyleStar | 5 | Square markers with an asterisk
xlMarkerStyleTriangle | 3 | Triangular markers
xlMarkerStyleX | -4168 | Square markers with an X


XlMeasurementUnits Enumeration (Excel)

 Copy code hover
[image]

XlMeasurementUnits Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the measurement units.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCentimeters | 1 | Centimeters
xlInches | 0 | Inches
xlMillimeters | 2 | Millimeters


XlMouseButton Enumeration (Excel)

 Copy code hover
[image]

XlMouseButton Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which mouse button was pressed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlNoButton | 0 | No button was pressed.
xlPrimaryButton | 1 | The primary button (normally the left mouse button) was pressed.
xlSecondaryButton | 2 | The secondary button (normally the right mouse button) was pressed.


XlMousePointer Enumeration (Excel)

 Copy code hover
[image]

XlMousePointer Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the appearance of the mouse pointer in Excel.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDefault | -4143 | The default pointer.
xlIBeam | 3 | The I-beam pointer.
xlNorthwestArrow | 1 | The northwest-arrow pointer.
xlWait | 2 | The hourglass pointer.


XlMSApplication Enumeration (Excel)

 Copy code hover
[image]

XlMSApplication Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies a Microsoft application.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlMicrosoftAccess | 4 | Microsoft Office Access
xlMicrosoftFoxPro | 5 | Microsoft FoxPro
xlMicrosoftMail | 3 | Microsoft Office Outlook
xlMicrosoftPowerPoint | 2 | Microsoft Office PowerPoint
xlMicrosoftProject | 6 | Microsoft Office Project
xlMicrosoftSchedulePlus | 7 | Microsoft Schedule Plus
xlMicrosoftWord | 1 | Microsoft Office Word


XlOartHorizontalOverflow Enumeration (Excel)

 Copy code hover
[image]

XlOartHorizontalOverflow Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the horizontal overflow setting for a text frame.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlOartHorizontalOverflowClip | 1 | Hide text that does not fit horizontally in the text frame.
xlOartHorizontalOverflowOverflow | 0 | Allow text to overflow the text frame horizontally.


XlOartVerticalOverflow Enumeration (Excel)

 Copy code hover
[image]

XlOartVerticalOverflow Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the vertical overflow setting for a text frame.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlOartVerticalOverflowClip | 1 | Hide text that does not fit vertically within the text frame.
xlOartVerticalOverflowEllipsis | 2 | Hide text that does not fit vertically within the text frame, and add an ellipsis (...) at the end of the visible text.
xlOartVerticalOverflowOverflow | 0 | Allow text to overflow the text frame vertically (can be from the top, bottom, or both depending on the text alignment).


XlObjectSize Enumeration (Excel)

 Copy code hover
[image]

XlObjectSize Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way a chart is scaled to fit on a page.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFitToPage | 2 | Print the chart as large as possible, while retaining the chart's height-to-width ratio as shown on the screen.
xlFullPage | 3 | Print the chart to fit the page, adjusting the height-to-width ratio as necessary.
xlScreenSize | 1 | Print the chart the same size as it appears on the screen.


XlOLEType Enumeration (Excel)

 Copy code hover
[image]

XlOLEType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the OLE object type.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlOLEControl | 2 | ActiveX control
xlOLEEmbed | 1 | Embedded OLE object
xlOLELink | 0 | Linked OLE object


XlOLEVerb Enumeration (Excel)

 Copy code hover
[image]

XlOLEVerb Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the verb on which the server of the OLE object should act.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlVerbOpen | 2 | Open the object.
xlVerbPrimary | 1 | Perform the primary action for the server.


XlOrder Enumeration (Excel)

 Copy code hover
[image]

XlOrder Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the order in which cells are processed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDownThenOver | 1 | Process down the rows before processing across pages or page fields to the right.
xlOverThenDown | 2 | Process across pages or page fields to the right before moving down the rows.


XlOrientation Enumeration (Excel)

 Copy code hover
[image]

XlOrientation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the text orientation.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDownward | -4170 | Text runs downward.
xlHorizontal | -4128 | Text runs horizontally.
xlUpward | -4171 | Text runs upward.
xlVertical | -4166 | Text runs downward and is centered in the cell.


XlPageBreak Enumeration (Excel)

 Copy code hover
[image]

XlPageBreak Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies page break location in the worksheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPageBreakAutomatic | -4105 | Excel will automatically add page breaks.
xlPageBreakManual | -4135 | Page breaks are manually inserted.
xlPageBreakNone | -4142 | Page breaks are not inserted in the worksheet.


XlPageBreakExtent Enumeration (Excel)

 Copy code hover
[image]

XlPageBreakExtent Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether a page break is full screen or applies only within the print area.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPageBreakFull | 1 | Full screen.
xlPageBreakPartial | 2 | Only within print area.


XlPageOrientation Enumeration (Excel)

 Copy code hover
[image]

XlPageOrientation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the page orientation when the worksheet is printed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLandscape | 2 | Landscape mode.
xlPortrait | 1 | Portrait mode.


XlPaperSize Enumeration (Excel)

 Copy code hover
[image]

XlPaperSize Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the size of the paper.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPaper10x14 | 16 | 10 in. x 14 in.
xlPaper11x17 | 17 | 11 in. x 17 in.
xlPaperA3 | 8 | A3 (297 mm x 420 mm)
xlPaperA4 | 9 | A4 (210 mm x 297 mm)
xlPaperA4Small | 10 | A4 Small (210 mm x 297 mm)
xlPaperA5 | 11 | A5 (148 mm x 210 mm)
xlPaperB4 | 12 | B4 (250 mm x 354 mm)
xlPaperB5 | 13 | A5 (148 mm x 210 mm)
xlPaperCsheet | 24 | C size sheet
xlPaperDsheet | 25 | D size sheet
xlPaperEnvelope10 | 20 | Envelope #10 (4-1/8 in. x 9-1/2 in.)
xlPaperEnvelope11 | 21 | Envelope #11 (4-1/2 in. x 10-3/8 in.)
xlPaperEnvelope12 | 22 | Envelope #12 (4-1/2 in. x 11 in.)
xlPaperEnvelope14 | 23 | Envelope #14 (5 in. x 11-1/2 in.)
xlPaperEnvelope9 | 19 | Envelope #9 (3-7/8 in. x 8-7/8 in.)
xlPaperEnvelopeB4 | 33 | Envelope B4 (250 mm x 353 mm)
xlPaperEnvelopeB5 | 34 | Envelope B5 (176 mm x 250 mm)
xlPaperEnvelopeB6 | 35 | Envelope B6 (176 mm x 125 mm)
xlPaperEnvelopeC3 | 29 | Envelope C3 (324 mm x 458 mm)
xlPaperEnvelopeC4 | 30 | Envelope C4 (229 mm x 324 mm)
xlPaperEnvelopeC5 | 28 | Envelope C5 (162 mm x 229 mm)
xlPaperEnvelopeC6 | 31 | Envelope C6 (114 mm x 162 mm)
xlPaperEnvelopeC65 | 32 | Envelope C65 (114 mm x 229 mm)
xlPaperEnvelopeDL | 27 | Envelope DL (110 mm x 220 mm)
xlPaperEnvelopeItaly | 36 | Envelope (110 mm x 230 mm)
xlPaperEnvelopeMonarch | 37 | Envelope Monarch (3-7/8 in. x 7-1/2 in.)
xlPaperEnvelopePersonal | 38 | Envelope (3-5/8 in. x 6-1/2 in.)
xlPaperEsheet | 26 | E size sheet
xlPaperExecutive | 7 | Executive (7-1/2 in. x 10-1/2 in.)
xlPaperFanfoldLegalGerman | 41 | German Legal Fanfold (8-1/2 in. x 13 in.)
xlPaperFanfoldStdGerman | 40 | German Legal Fanfold (8-1/2 in. x 13 in.)
xlPaperFanfoldUS | 39 | U.S. Standard Fanfold (14-7/8 in. x 11 in.)
xlPaperFolio | 14 | Folio (8-1/2 in. x 13 in.)
xlPaperLedger | 4 | Ledger (17 in. x 11 in.)
xlPaperLegal | 5 | Legal (8-1/2 in. x 14 in.)
xlPaperLetter | 1 | Letter (8-1/2 in. x 11 in.)
xlPaperLetterSmall | 2 | Letter Small (8-1/2 in. x 11 in.)
xlPaperNote | 18 | Note (8-1/2 in. x 11 in.)
xlPaperQuarto | 15 | Quarto (215 mm x 275 mm)
xlPaperStatement | 6 | Statement (5-1/2 in. x 8-1/2 in.)
xlPaperTabloid | 3 | Tabloid (11 in. x 17 in.)
xlPaperUser | 256 | User-defined


XlParameterDataType Enumeration (Excel)

 Copy code hover
[image]

XlParameterDataType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the data type of a query parameter.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlParamTypeBigInt | -5 | Big integer.
xlParamTypeBinary | -2 | Binary.
xlParamTypeBit | -7 | Bit.
xlParamTypeChar | 1 | String.
xlParamTypeDate | 9 | Date.
xlParamTypeDecimal | 3 | Decimal.
xlParamTypeDouble | 8 | Double.
xlParamTypeFloat | 6 | Float.
xlParamTypeInteger | 4 | Integer.
xlParamTypeLongVarBinary | -4 | Long binary.
xlParamTypeLongVarChar | -1 | Long string.
xlParamTypeNumeric | 2 | Numeric.
xlParamTypeReal | 7 | Real.
xlParamTypeSmallInt | 5 | Small integer.
xlParamTypeTime | 10 | Time.
xlParamTypeTimestamp | 11 | Time stamp.
xlParamTypeTinyInt | -6 | Tiny integer.
xlParamTypeUnknown | 0 | Type unknown.
xlParamTypeVarBinary | -3 | Variable-length binary.
xlParamTypeVarChar | 12 | Variable-length string.
xlParamTypeWChar | -8 | Unicode character string.


XlParameterType Enumeration (Excel)

 Copy code hover
[image]

XlParameterType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to determine the value of the parameter for the specified query table.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlConstant | 1 | Uses the value specified by the Value argument.
xlPrompt | 0 | Displays a dialog box that prompts the user for the value. The Value argument specifies the text shown in the dialog box.
xlRange | 2 | Uses the value of the cell in the upper-left corner of the range. The Value argument specifies a Range object.


XlPasteSpecialOperation Enumeration (Excel)

 Copy code hover
[image]

XlPasteSpecialOperation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how numeric data will be calculated with the destinations cells in the worksheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPasteSpecialOperationAdd | 2 | Copied data will be added with the value in the destination cell.
xlPasteSpecialOperationDivide | 5 | Copied data will be divided with the value in the destination cell.
xlPasteSpecialOperationMultiply | 4 | Copied data will be multiplied with the value in the destination cell.
xlPasteSpecialOperationNone | -4142 | No calculation will be done in the paste operation.
xlPasteSpecialOperationSubtract | 3 | Copied data will be subtracted with the value in the destination cell.


XlPasteType Enumeration (Excel)

 Copy code hover
[image]

XlPasteType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the part of the range to be pasted.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPasteAll | -4104 | Everything will be pasted.
xlPasteAllExceptBorders | 7 | Everything except borders will be pasted.
xlPasteAllMergingConditionalFormats | 14 | Everything will be pasted and conditional formats will be merged.
xlPasteAllUsingSourceTheme | 13 | Everything will be pasted using the source theme.
xlPasteColumnWidths | 8 | Copied column width is pasted.
xlPasteComments | -4144 | Comments are pasted.
xlPasteFormats | -4122 | Copied source format is pasted.
xlPasteFormulas | -4123 | Formulas are pasted.
xlPasteFormulasAndNumberFormats | 11 | Formulas and Number formats are pasted.
xlPasteValidation | 6 | Validations are pasted.
xlPasteValues | -4163 | Values are pasted.
xlPasteValuesAndNumberFormats | 12 | Values and Number formats are pasted.


XlPattern Enumeration (Excel)

 Copy code hover
[image]

XlPattern Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the interior pattern of a chart or interior object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPatternAutomatic | -4105 | Excel controls the pattern.
xlPatternChecker | 9 | Checkerboard.
xlPatternCrissCross | 16 | Criss-cross lines.
xlPatternDown | -4121 | Dark diagonal lines running from the upper left to the lower right.
xlPatternGray16 | 17 | 16% gray.
xlPatternGray25 | -4124 | 25% gray.
xlPatternGray50 | -4125 | 50% gray.
xlPatternGray75 | -4126 | 75% gray.
xlPatternGray8 | 18 | 8% gray.
xlPatternGrid | 15 | Grid.
xlPatternHorizontal | -4128 | Dark horizontal lines.
xlPatternLightDown | 13 | Light diagonal lines running from the upper left to the lower right.
xlPatternLightHorizontal | 11 | Light horizontal lines.
xlPatternLightUp | 14 | Light diagonal lines running from the lower left to the upper right.
xlPatternLightVertical | 12 | Light vertical bars.
xlPatternNone | -4142 | No pattern.
xlPatternSemiGray75 | 10 | 75% dark moiré.
xlPatternSolid | 1 | Solid color.
xlPatternUp | -4162 | Dark diagonal lines running from the lower left to the upper right.
xlPatternVertical | -4166 | Dark vertical bars.


XlPhoneticAlignment Enumeration (Excel)

 Copy code hover
[image]

XlPhoneticAlignment Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the alignment for phonetic text. Used with a Phonetic or a Phonetics object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPhoneticAlignCenter | 2 | Centered
xlPhoneticAlignDistributed | 3 | Distributed
xlPhoneticAlignLeft | 1 | Left aligned
xlPhoneticAlignNoControl | 0 | Excel controls alignment


XlPhoneticCharacterType Enumeration (Excel)

 Copy code hover
[image]

XlPhoneticCharacterType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of phonetic text in a cell.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlHiragana | 2 | Hiragana
xlKatakana | 1 | Katakana
xlKatakanaHalf | 0 | Half-size Katakana
xlNoConversion | 3 | No conversion


XlPictureAppearance Enumeration (Excel)

 Copy code hover
[image]

XlPictureAppearance Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the picture should be copied.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPrinter | 2 | The picture is copied as it will look when it is printed.
xlScreen | 1 | The picture is copied to resemble its display on the screen as closely as possible.


XlPictureConvertorType Enumeration (Excel)

 Copy code hover
[image]

XlPictureConvertorType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to convert a graphic.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBMP | 1 | Windows version 2.0-compatible bitmap
xlCGM | 7 | Computer Graphics Metafile
xlDRW | 4 | DRW
xlDXF | 5 | DXF
xlEPS | 8 | Encapsulated Postscript
xlHGL | 6 | HGL
xlPCT | 13 | Bitmap Graphic (Apple PICT format)
xlPCX | 10 | PC Paintbrush Bitmap Graphic
xlPIC | 11 | PIC
xlPLT | 12 | PLT
xlTIF | 9 | Tagged Image Format File
xlWMF | 2 | Windows Metafile
xlWPG | 3 | WordPerfect/DrawPerfect Graphic


XlPieSliceIndex Enumeration (Excel)

 Copy code hover
[image]

XlPieSliceIndex Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which position on the slice to return the coordinate of.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlCenterPoint | 5 | The center point of a pie slice.
xlInnerCenterPoint | 8 | The innermost center point of a doughnut slice.
xlInnerClockwisePoint | 7 | The innermost point of the most clockwise radius of a doughnut slice.
xlInnerCounterClockwisePoint | 9 | The innermost point of the most counterclockwise radius of a doughnut slice.
xlMidClockwiseRadiusPoint | 4 | The midpoint of the most clockwise radius of a slice.
xlMidCounterClockwiseRadiusPoint | 6 | The midpoint of the most counterclockwise radius of a slice.
xlOuterCenterPoint | 2 | The outer center point of the circumference of a slice.
xlOuterClockwisePoint | 3 | The outermost clockwise point of the circumference of a slice.
xlOuterCounterClockwisePoint | 1 | The outermost counterclockwise point of the circumference of a slice.


XlPieSliceLocation Enumeration (Excel)

 Copy code hover
[image]

XlPieSliceLocation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the horizontal or vertical position of a point on a pie chart, in points, from the top or left edge of the object to the top or left edge of the chart area.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlHorizontalCoordinate | 1 | The horizontal coordinate (x)
xlVerticalCoordinate | 2 | The vertical coordinate (y)


XlPivotCellType Enumeration (Excel)

 Copy code hover
[image]

XlPivotCellType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the PivotTable entity to which the cell corresponds.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPivotCellBlankCell | 9 | A structural blank cell in the PivotTable.
xlPivotCellCustomSubtotal | 7 | A cell in the row or column area that is a custom subtotal.
xlPivotCellDataField | 4 | A data field label (not the Data button).
xlPivotCellDataPivotField | 8 | The Data button.
xlPivotCellGrandTotal | 3 | A cell in a row or column area that is a grand total.
xlPivotCellPageFieldItem | 6 | The cell that shows the selected item of a Page field.
xlPivotCellPivotField | 5 | The button for a field (not the Data button).
xlPivotCellPivotItem | 1 | A cell in the row or column area that is not a subtotal, grand total, custom subtotal, or blank line.
xlPivotCellSubtotal | 2 | A cell in the row or column area that is a subtotal.
xlPivotCellValue | 0 | Any cell in the data area (except a blank row).


XlPivotConditionScope Enumeration (Excel)

 Copy code hover
[image]

XlPivotConditionScope Enumeration (Excel)
Send feedback

Published: July 16, 2012

This enumeration specifies the conditional formatting applied for filtering values from the PivotTable object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDataFieldScope | 2 | Based on the data in the specified fields.
xlFieldsScope | 1 | Based on the specified fields.
xlSelectionScope | 0 | Based on the specified selection criteria.


XlPivotFieldCalculation Enumeration (Excel)

 Copy code hover
[image]

XlPivotFieldCalculation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of calculation performed by a data PivotField when a custom calculation is used.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDifferenceFrom | 2 | The difference from the value of the Base item in the Base field.
xlIndex | 9 | Data calculated as ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total)).
xlNoAdditionalCalculation | -4143 | No calculation.
xlPercentDifferenceFrom | 4 | Percentage difference from the value of the Base item in the Base field.
xlPercentOf | 3 | Percentage of the value of the Base item in the Base field.
xlPercentOfColumn | 7 | Percentage of the total for the column or series.
xlPercentOfParent | 12 | Percentage of the total of the specified parent Base field.
xlPercentOfParentColumn | 11 | Percentage of the total of the parent column.
xlPercentOfParentRow | 10 | Percentage of the total of the parent row.
xlPercentOfRow | 6 | Percentage of the total for the row or category.
xlPercentOfTotal | 8 | Percentage of the grand total of all the data or data points in the report.
xlPercentRunningTotal | 13 | Percentatge of the running total of the specified Base field.
xlRankAscending | 14 | Rank smallest to largest.
xlRankDecending | 15 | Rank largest to smallest.
xlRunningTotal | 5 | Data for successive items in the Base field as a running total.


XlPivotFieldDataType Enumeration (Excel)

 Copy code hover
[image]

XlPivotFieldDataType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of data in the PivotTable field.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDate | 2 | Contains a date.
xlNumber | -4145 | Contains a number.
xlText | -4158 | Contains text.

Remarks

This enumeration is used with the DataType property of the PivotField object.


XlPivotFieldOrientation Enumeration (Excel)

 Copy code hover
[image]

XlPivotFieldOrientation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the location of the field in a PivotTable report.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColumnField | 2 | Column
xlDataField | 4 | Data
xlHidden | 0 | Hidden
xlPageField | 3 | Page
xlRowField | 1 | Row


XlPivotFieldRepeatLabels Enumeration (Excel)

 Copy code hover
[image]

XlPivotFieldRepeatLabels Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether to repeat all field item labels in a PivotTable report.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlDoNotRepeatLabels | 1 | Do not repeat item labels.
xlRepeatLabels | 2 | Repeat all item labels.


XlPivotFilterType Enumeration (Excel)

 Copy code hover
[image]

XlPivotFilterType Enumeration (Excel)
Send feedback

Published: July 16, 2012

The type of filter applied.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBefore | 31 | Filters for all dates before a specified date
xlBeforeOrEqualTo | 32 | Filters for all dates on or before a specified date
xlAfter | 33 | Filters for all dates after a specified date
xlAfterOrEqualTo | 34 | Filters for all dates on or after a specified date
xlAllDatesInPeriodJanuary | 53 | Filters for all dates in January
xlAllDatesInPeriodFebruary | 54 | Filters for all dates in February
xlAllDatesInPeriodMarch | 55 | Filters for all dates in March
xlAllDatesInPeriodApril | 56 | Filters for all dates in April
xlAllDatesInPeriodMay | 57 | Filters for all dates in May
xlAllDatesInPeriodJune | 58 | Filters for all dates in June
xlAllDatesInPeriodJuly | 59 | Filters for all dates in July
xlAllDatesInPeriodAugust | 60 | Filters for all dates in August
xlAllDatesInPeriodSeptember | 61 | Filters for all dates in September
xlAllDatesInPeriodOctober | 62 | Filters for all dates in October
xlAllDatesInPeriodNovember | 63 | Filters for all dates in November
xlAllDatesInPeriodDecember | 64 | Filters for all dates in December
xlAllDatesInPeriodQuarter1 | 49 | Filters for all dates in Quarter1
xlAllDatesInPeriodQuarter2 | 50 | Filters for all dates in Quarter2
xlAllDatesInPeriodQuarter3 | 51 | Filters for all dates in Quarter3
xlAllDatesInPeriodQuarter4 | 52 | Filters for all dates in Quarter 4
xlBottomCount | 2 | Filters for the specified number of values from the bottom of a list
xlBottomPercent | 4 | Filters for the specified percentage of values from the bottom of a list
xlBottomSum | 6 | Sum of the values from the bottom of the list
xlCaptionBeginsWith | 17 | Filters for all captions beginning with the specified string
xlCaptionContains | 21 | Filters for all captions that contain the specified string
xlCaptionDoesNotBeginWith | 18 | Filters for all captions that do not begin with the specified string
xlCaptionDoesNotContain | 22 | Filters for all captions that do not contain the specified string
xlCaptionDoesNotEndWith | 20 | Filters for all captions that do not end with the specified string
xlCaptionDoesNotEqual | 16 | Filters for all captions that do not match the specified string
xlCaptionEndsWith | 19 | Filters for all captions that end with the specified string
xlCaptionEquals | 15 | Filters for all captions that match the specified string
xlCaptionIsBetween | 27 | Filters for all captions that are between a specified range of values
xlCaptionIsGreaterThan | 23 | Filters for all captions that are greater than the specified value
xlCaptionIsGreaterThanOrEqualTo | 24 | Filters for all captions that are greater than or match the specified value
xlCaptionIsLessThan | 25 | Filters for all captions that are less than the specified value
xlCaptionIsLessThanOrEqualTo | 26 | Filters for all captions that are less than or match the specified value
xlCaptionIsNotBetween | 28 | Filters for all captions that are not between a specified range of values
xlDateBetween | 32 | Filters for all dates that are between a specified range of dates
xlDateLastMonth | 41 | Filters for all dates that apply to the previous month
xlDateLastQuarter | 44 | Filters for all dates that apply to the previous quarter
xlDateLastWeek | 38 | Filters for all dates that apply to the previous week
xlDateLastYear | 47 | Filters for all dates that apply to the previous year
xlDateNextMonth | 39 | Filters for all dates that apply to the next month
xlDateNextQuarter | 42 | Filters for all dates that apply to the next quarter
xlDateNextWeek | 36 | Filters for all dates that apply to the next week
xlDateNextYear | 45 | Filters for all dates that apply to the next year
xlDateThisMonth | 40 | Filters for all dates that apply to the current month
xlDateThisQuarter | 43 | Filters for all dates that apply to the current quarter
xlDateThisWeek | 37 | Filters for all dates that apply to the current week
xlDateThisYear | 46 | Filters for all dates that apply to the current year
xlDateToday | 34 | Filters for all dates that apply to the current date
xlDateTomorrow | 33 | Filters for all dates that apply to the next day
xlDateYesterday | 35 | Filters for all dates that apply to the previous day
xlNotSpecificDate | 30 | Filters for all dates that do not match a specified date
xlSpecificDate | 29 | Filters for all dates that match a specified date
xlTopCount | 1 | Filters for the specified number of values from the top of a list
xlTopPercent | 3 | Filters for the specified percentage of values from a list
xlTopSum | 5 | Sum of the values from the top of the list
xlValueDoesNotEqual | 8 | Filters for all values that do not match the specified value
xlValueEquals | 7 | Filters for all values that match the specified value
xlValueIsBetween | 13 | Filters for all values that are between a specified range of values
xlValueIsGreaterThan | 9 | Filters for all values that are greater than the specified value
xlValueIsGreaterThanOrEqualTo | 10 | Filters for all values that are greater than or match the specified value
xlValueIsLessThan | 11 | Filters for all values that are less than the specified value
xlValueIsLessThanOrEqualTo | 12 | Filters for all values that are less than or match the specified value
xlValueIsNotBetween | 14 | Filters for all values that are not between a specified range of values
xlYearToDate | 48 | Filters for all values that are within one year of a specified date


XlPivotFormatType Enumeration (Excel)

 Copy code hover
[image]

XlPivotFormatType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of report formatting to be applied to the specified PivotTable report.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPTClassic | 20 | PivotTable classic format.
xlPTNone | 21 | Does not apply formatting to the PivotTable report.
xlReport1 | 0 | Use the xlReport1 formatting for the PivotTable.
xlReport10 | 9 | Use the xlReport10 formatting for the PivotTable.
xlReport2 | 1 | Use the xlReport2 formatting for the PivotTable.
xlReport3 | 2 | Use the xlReport3 formatting for the PivotTable.
xlReport4 | 3 | Use the xlReport4 formatting for the PivotTable.
xlReport5 | 4 | Use the xlReport5 formatting for the PivotTable.
xlReport6 | 5 | Use the xlReport6 formatting for the PivotTable.
xlReport7 | 6 | Use the xlReport7 formatting for the PivotTable.
xlReport8 | 7 | Use the xlReport8 formatting for the PivotTable.
xlReport9 | 8 | Use the xlReport9 formatting for the PivotTable.
xlTable1 | 10 | Use the xlTable1 formatting for the PivotTable.
xlTable10 | 19 | Use the xlTable10 formatting for the PivotTable.
xlTable2 | 11 | Use the xlTable2 formatting for the PivotTable.
xlTable3 | 12 | Use the xlTable3 formatting for the PivotTable.
xlTable4 | 13 | Use the xlTable4 formatting for the PivotTable.
xlTable5 | 14 | Use the xlTable5 formatting for the PivotTable.
xlTable6 | 15 | Use the xlTable6 formatting for the PivotTable.
xlTable7 | 16 | Use the xlTable7 formatting for the PivotTable.
xlTable8 | 17 | Use the xlTable8 formatting for the PivotTable.
xlTable9 | 18 | Use the xlTable9 formatting for the PivotTable.


XlPivotLineType Enumeration (Excel)

 Copy code hover
[image]

XlPivotLineType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of the PivotLine.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPivotLineBlank | 3 | Blank line after each group.
xlPivotLineGrandTotal | 2 | Grand Total line.
xlPivotLineRegular | 0 | Regular PivotLine with pivot items.
xlPivotLineSubtotal | 1 | Subtotal line.


XlPivotTableMissingItems Enumeration (Excel)

 Copy code hover
[image]

XlPivotTableMissingItems Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the maximum number of unique items allowed per PivotField.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlMissingItemsDefault | -1 | The default number of unique items per PivotField allowed.
xlMissingItemsMax | 32500 | The maximum number of unique items per PivotField allowed (32,500) for a pre-Excel 2007 PivotTable.
xlMissingItemsMax2 | 1048576 | The maximum number of unique items per PivotField allowed (10,48,576) for a pre-Excel 2007 PivotTable.
xlMissingItemsNone | 0 | No unique items per PivotField allowed (zero).


XlPivotTableSourceType Enumeration (Excel)

 Copy code hover
[image]

XlPivotTableSourceType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the source of the report data.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlConsolidation | 3 | Multiple consolidation ranges.
xlDatabase | 1 | Microsoft Excel list or database.
xlExternal | 2 | Data from another application.
xlPivotTable | -4148 | Same source as another PivotTable report.
xlScenario | 4 | Data is based on scenarios created using the Scenario Manager.


XlPivotTableVersionList Enumeration (Excel)

 Copy code hover
[image]

XlPivotTableVersionList Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the version of a PivotTable or a PivotCache. Creating PivotTables with a specific version ensures that tables created in Microsoft Excel 2013 behave in the same manner as they did in the corresponding version of Excel.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlPivotTableVersion2000 | 0 | Excel 2000
xlPivotTableVersion10 | 1 | Excel 2002
xlPivotTableVersion11 | 2 | Excel 2003
xlPivotTableVersion12 | 3 | Excel 2007
xlPivotTableVersion14 | 4 | Excel 2010
xlPivotTableVersion15 | 5 | Excel 2013
xlPivotTableVersionCurrent | -1 | Provided only for backward compatibility

Remarks

Note Note

xlPivotTableVersionCurrent is included only for backward compatibility reasons. It cannot be used with new PivotCache and PivotTable objects. There are no differences in behavior between xlPivotTableVersion11 and xlPivotTableVersion10.


XlPlacement Enumeration (Excel)

 Copy code hover
[image]

XlPlacement Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way that an object is attached to its underlying cells.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlFreeFloating | 3 | Object is free floating.
xlMove | 2 | Object is moved with the cells.
xlMoveAndSize | 1 | Object is moved and sized with the cells.


XlPlatform Enumeration (Excel)

 Copy code hover
[image]

XlPlatform Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the platform on which a text file originated.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlMacintosh | 1 | Macintosh
xlMSDOS | 3 | MS-DOS
xlWindows | 2 | Microsoft Windows


XlPortugueseReform Enumeration (Excel)

 Copy code hover
[image]

XlPortugueseReform Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the mode for checking the spelling of Portuguese.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlPortugueseBoth | 3 | The spelling checker recognizes both pre-reform and post-reform spellings.
xlPortuguesePostReform | 2 | The spelling checker recognizes only post-reform spellings.
xlPortuguesePreReform | 1 | The spelling checker recognizes only pre-reform spellings.


XlPrintErrors Enumeration (Excel)

 Copy code hover
[image]

XlPrintErrors Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of print error displayed.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPrintErrorsBlank | 1 | Print errors are blank.
xlPrintErrorsDash | 2 | Print errors are displayed as dashes.
xlPrintErrorsDisplayed | 0 | All print errors are displayed.
xlPrintErrorsNA | 3 | Print errors are displayed as not available.


XlPrintLocation Enumeration (Excel)

 Copy code hover
[image]

XlPrintLocation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way that comments are printed with the sheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPrintInPlace | 16 | Comments will be printed where they were inserted in the worksheet.
xlPrintNoComments | -4142 | Comments will not be printed.
xlPrintSheetEnd | 1 | Comments will be printed as end notes at the end of the worksheet.


XlPriority Enumeration (Excel)

 Copy code hover
[image]

XlPriority Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the priority of a SendMailer message.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlPriorityHigh | -4127 | High
xlPriorityLow | -4134 | Low
xlPriorityNormal | -4143 | Normal


XlPropertyDisplayedIn Enumeration (Excel)

 Copy code hover
[image]

XlPropertyDisplayedIn Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies where to display the property.

Name | Value | Description
xlDisplayPropertyInPivotTable | 1 | Displays member property in the PivotTable only. This is the default value.
xlDisplayPropertyInPivotTableAndTooltip | 3 | Displays member property in the tooltip only.
xlDisplayPropertyInTooltip | 2 | Displays member property in both the tooltip and the PivotTable.


XlProtectedViewCloseReason Enumeration (Excel)

 Copy code hover
[image]

XlProtectedViewCloseReason Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the Protected View window was closed.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlProtectedViewCloseEdit | 1 | The window was closed when the user clicked the Enable Editing button.
xlProtectedViewCloseForced | 2 | The window was closed because the application shut it down forcefully or stopped responding.
xlProtectedViewCloseNormal | 0 | The window was closed normally.


XlProtectedViewWindowState Enumeration (Excel)

 Copy code hover
[image]

XlProtectedViewWindowState Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the state of the Protected View window.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlProtectedViewWindowMaximized | 2 | Maximized
xlProtectedViewWindowMinimized | 1 | Minimized
xlProtectedViewWindowNormal | 0 | Normal


XlPTSelectionMode Enumeration (Excel)

 Copy code hover
[image]

XlPTSelectionMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what can be selected in a PivotTable during a structured selection. These constants can be combined to select multiple types.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlBlanks | 4 | Blanks
xlButton | 15 | Buttons
xlDataAndLabel | 0 | Data and labels
xlDataOnly | 2 | Data
xlFirstRow | 256 | First row
xlLabelOnly | 1 | Label
xlOrigin | 3 | Origin


XlQueryType Enumeration (Excel)

 Copy code hover
[image]

XlQueryType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of query used by Microsoft Excel to populate the query table or PivotTable cache.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlADORecordset | 7 | Based on an ADO recordset query
xlDAORecordset | 2 | Based on a DAO recordset query, for query tables only
xlODBCQuery | 1 | Based on an ODBC data source
xlOLEDBQuery | 5 | Based on an OLE DB query, including OLAP data sources
xlTextImport | 6 | Based on a text file, for query tables only
xlWebQuery | 4 | Based on a Web page, for query tables only


XlQuickAnalysisMode Enumeration (Excel)

 Copy code hover
[image]

XlQuickAnalysisMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Indicates for which top level button the callout user interface is displayed.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
xlLensOnly | 0 | Show the button but no callout user interface
xlFormatConditions | 1 | Conditional Formatting
xlRecommendedCharts | 2 | Charts
xlTotals | 3 | Totals
xlTables | 4 | Tables
xlSparklines | 5 | Sparklines


XlRangeAutoFormat Enumeration (Excel)

 Copy code hover
[image]

XlRangeAutoFormat Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the predefined format when a range is automatically formatted.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlRangeAutoFormat3DEffects1 | 13 | 3-D effects 1.
xlRangeAutoFormat3DEffects2 | 14 | 3-D effects 2.
xlRangeAutoFormatAccounting1 | 4 | Accounting 1.
xlRangeAutoFormatAccounting2 | 5 | Accounting 2.
xlRangeAutoFormatAccounting3 | 6 | Accounting 3.
xlRangeAutoFormatAccounting4 | 17 | Accounting 4.
xlRangeAutoFormatClassic1 | 1 | Classic 1.
xlRangeAutoFormatClassic2 | 2 | Classic 2.
xlRangeAutoFormatClassic3 | 3 | Classic 3.
xlRangeAutoFormatClassicPivotTable | 31 | Classic pivot table.
xlRangeAutoFormatColor1 | 7 | Color 1.
xlRangeAutoFormatColor2 | 8 | Color 2.
xlRangeAutoFormatColor3 | 9 | Color 3.
xlRangeAutoFormatList1 | 10 | List 1.
xlRangeAutoFormatList2 | 11 | List 2.
xlRangeAutoFormatList3 | 12 | List 3.
xlRangeAutoFormatLocalFormat1 | 15 | Local Format 1.
xlRangeAutoFormatLocalFormat2 | 16 | Local Format 2.
xlRangeAutoFormatLocalFormat3 | 19 | Local Format 3.
xlRangeAutoFormatLocalFormat4 | 20 | Local Format 4.
xlRangeAutoFormatNone | -4142 | No specified format.
xlRangeAutoFormatPTNone | 42 | No specified pivot table format.
xlRangeAutoFormatReport1 | 21 | Report 1.
xlRangeAutoFormatReport10 | 30 | Report 10.
xlRangeAutoFormatReport2 | 22 | Report 2.
xlRangeAutoFormatReport3 | 23 | Report 3.
xlRangeAutoFormatReport4 | 24 | Report 4.
xlRangeAutoFormatReport5 | 25 | Report 5.
xlRangeAutoFormatReport6 | 26 | Report 6.
xlRangeAutoFormatReport7 | 27 | Report 7.
xlRangeAutoFormatReport8 | 28 | Report 8.
xlRangeAutoFormatReport9 | 29 | Report 9.
xlRangeAutoFormatSimple | -4154 | Simple.
xlRangeAutoFormatTable1 | 32 | Table 1.
xlRangeAutoFormatTable10 | 41 | Table 10.
xlRangeAutoFormatTable2 | 33 | Table 2.
xlRangeAutoFormatTable3 | 34 | Table 3.
xlRangeAutoFormatTable4 | 35 | Table 4.
xlRangeAutoFormatTable5 | 36 | Table 5.
xlRangeAutoFormatTable6 | 37 | Table 6.
xlRangeAutoFormatTable7 | 38 | Table 7.
xlRangeAutoFormatTable8 | 39 | Table 8.
xlRangeAutoFormatTable9 | 40 | Table 9.


XlRangeValueDataType Enumeration (Excel)

 Copy code hover
[image]

XlRangeValueDataType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the range value data type.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlRangeValueDefault | 10 | Default. If the specified Range object is empty, returns the value Empty (use the IsEmpty function to test for this case). If the Range object contains more than one cell, returns an array of values (use the IsArray function to test for this case).
xlRangeValueMSPersistXML | 12 | Returns the recordset representation of the specified Range object in an XML format.
xlRangeValueXMLSpreadsheet | 11 | Returns the values, formatting, formulas, and names of the specified Range object in the XML Spreadsheet format.


XlReferenceStyle Enumeration (Excel)

 Copy code hover
[image]

XlReferenceStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the reference style.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlA1 | 1 | Default. Use xlA1 to return an A1-style reference.
xlR1C1 | -4150 | Use xlR1C1 to return an R1C1-style reference.


XlReferenceType Enumeration (Excel)

 Copy code hover
[image]

XlReferenceType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies cell reference style when a formula is being converted.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAbsolute | 1 | Convert to absolute row and column style.
xlAbsRowRelColumn | 2 | Convert to absolute row and relative column style.
xlRelative | 4 | Convert to relative row and column style.
xlRelRowAbsColumn | 3 | Convert to relative row and absolute column style.


XlRemoveDocInfoType Enumeration (Excel)

 Copy code hover
[image]

XlRemoveDocInfoType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type information to be removed from the document information.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlRDIAll | 99 | Removes all documentation information.
xlRDIComments | 1 | Removes comments from the document information.
xlRDIContentType | 16 | Removes content type data from the document information.
xlRDIDefinedNameComments | 18 | Removes defined name comments from the documentation information.
xlRDIDocumentManagementPolicy | 15 | Removes document management policy data from the document information.
xlRDIDocumentProperties | 8 | Removes document properties from the document information.
xlRDIDocumentServerProperties | 14 | Removes server properties from the document information.
xlRDIDocumentWorkspace | 10 | Removes workspace data from the document information.
xlRDIEmailHeader | 5 | Removes email headers from the document information.
xlRDIExcelDataModel | 23 | Removes Data Model data from the document information.
xlRDIInactiveDataConnections | 19 | Removes inactive data connection data from the document information.
xlRDIInkAnnotations | 11 | Removes ink annotations from the document information.
xlRDIInlineWebExtensions | 21 | Removes inline Web Extensions from the document information.
xlRDIPrinterPath | 20 | Removes printer paths from the document information.
xlRDIPublishInfo | 13 | Removes the pubish information data from the document information.
xlRDIRemovePersonalInformation | 4 | Removes personal information from the document information.
xlRDIRoutingSlip | 6 | Removes routing slip information from the document information.
xlRDIScenarioComments | 12 | Removes scenario comments from the document information.
xlRDISendForReview | 7 | Removes the send for review information from the document information.
xlRDITaskpaneWebExtensions | 22 | Removes task pane Web Extensions from the document information.


XlRgbColor Enumeration (Excel)

 Copy code hover
[image]

XlRgbColor Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the RGB color.

Version Information

Version Added: Excel 2007

Name | Value | Description
rgbAliceBlue | 16775408 | Alice Blue
rgbAntiqueWhite | 14150650 | Antique White
rgbAqua | 16776960 | Aqua
rgbAquamarine | 13959039 | Aquamarine
rgbAzure | 16777200 | Azure
rgbBeige | 14480885 | Beige
rgbBisque | 12903679 | Bisque
rgbBlack | 0 | Black
rgbBlanchedAlmond | 13495295 | Blanched Almond
rgbBlue | 16711680 | Blue
rgbBlueViolet | 14822282 | Blue Violet
rgbBrown | 2763429 | Brown
rgbBurlyWood | 8894686 | Burly Wood
rgbCadetBlue | 10526303 | Cadet Blue
rgbChartreuse | 65407 | Chartreuse
rgbCoral | 5275647 | Coral
rgbCornflowerBlue | 15570276 | Cornflower Blue
rgbCornsilk | 14481663 | Cornsilk
rgbCrimson | 3937500 | Crimson
rgbDarkBlue | 9109504 | Dark Blue
rgbDarkCyan | 9145088 | Dark Cyan
rgbDarkGoldenrod | 755384 | Dark Goldenrod
rgbDarkGray | 11119017 | Dark Gray
rgbDarkGreen | 25600 | Dark Green
rgbDarkGrey | 11119017 | Dark Grey
rgbDarkKhaki | 7059389 | Dark Khaki
rgbDarkMagenta | 9109643 | Dark Magenta
rgbDarkOliveGreen | 3107669 | Dark Olive Green
rgbDarkOrange | 36095 | Dark Orange
rgbDarkOrchid | 13382297 | Dark Orchid
rgbDarkRed | 139 | Dark Red
rgbDarkSalmon | 8034025 | Dark Salmon
rgbDarkSeaGreen | 9419919 | Dark Sea Green
rgbDarkSlateBlue | 9125192 | Dark Slate Blue
rgbDarkSlateGray | 5197615 | Dark Slate Gray
rgbDarkSlateGrey | 5197615 | Dark Slate Grey
rgbDarkTurquoise | 13749760 | Dark Turquoise
rgbDarkViolet | 13828244 | Dark Violet
rgbDeepPink | 9639167 | Deep Pink
rgbDeepSkyBlue | 16760576 | Deep Sky Blue
rgbDimGray | 6908265 | Dim Gray
rgbDimGrey | 6908265 | Dim Grey
rgbDodgerBlue | 16748574 | Dodger Blue
rgbFireBrick | 2237106 | Fire Brick
rgbFloralWhite | 15792895 | Floral White
rgbForestGreen | 2263842 | Forest Green
rgbFuchsia | 16711935 | Fuchsia
rgbGainsboro | 14474460 | Gainsboro
rgbGhostWhite | 16775416 | Ghost White
rgbGold | 55295 | Gold
rgbGoldenrod | 2139610 | Goldenrod
rgbGray | 8421504 | Gray
rgbGreen | 32768 | Green
rgbGreenYellow | 3145645 | Green Yellow
rgbGrey | 8421504 | Grey
rgbHoneydew | 15794160 | Honeydew
rgbHotPink | 11823615 | Hot Pink
rgbIndianRed | 6053069 | Indian Red
rgbIndigo | 8519755 | Indigo
rgbIvory | 15794175 | Ivory
rgbKhaki | 9234160 | Khaki
rgbLavender | 16443110 | Lavender
rgbLavenderBlush | 16118015 | Lavender Blush
rgbLawnGreen | 64636 | Lawn Green
rgbLemonChiffon | 13499135 | Lemon Chiffon
rgbLightBlue | 15128749 | Light Blue
rgbLightCoral | 8421616 | Light Coral
rgbLightCyan | 9145088 | Light Cyan
rgbLightGoldenrodYellow | 13826810 | LightGoldenrodYellow
rgbLightGray | 13882323 | Light Gray
rgbLightGreen | 9498256 | Light Green
rgbLightGrey | 13882323 | Light Grey
rgbLightPink | 12695295 | Light Pink
rgbLightSalmon | 8036607 | Light Salmon
rgbLightSeaGreen | 11186720 | Light Sea Green
rgbLightSkyBlue | 16436871 | Light Sky Blue
rgbLightSlateGray | 10061943 | Light Slate Gray
rgbLightSteelBlue | 14599344 | Light Steel Blue
rgbLightYellow | 14745599 | Light Yellow
rgbLime | 65280 | Lime
rgbLimeGreen | 3329330 | Lime Green
rgbLinen | 15134970 | Linen
rgbMaroon | 128 | Maroon
rgbMediumAquamarine | 11206502 | Medium Aquamarine
rgbMediumBlue | 13434880 | Medium Blue
rgbMediumOrchid | 13850042 | Medium Orchid
rgbMediumPurple | 14381203 | Medium Purple
rgbMediumSeaGreen | 7451452 | Medium Sea Green
rgbMediumSlateBlue | 15624315 | Medium Slate Blue
rgbMediumSpringGreen | 10156544 | Medium Spring Green
rgbMediumTurquoise | 13422920 | Medium Turquoise
rgbMediumVioletRed | 8721863 | Medium Violet Red
rgbMidnightBlue | 7346457 | Midnight Blue
rgbMintCream | 16449525 | Mint Cream
rgbMistyRose | 14804223 | Misty Rose
rgbMoccasin | 11920639 | Moccasin
rgbNavajoWhite | 11394815 | Navajo White
rgbNavy | 8388608 | Navy
rgbNavyBlue | 8388608 | Navy Blue
rgbOldLace | 15136253 | Old Lace
rgbOlive | 32896 | Olive
rgbOliveDrab | 2330219 | Olive Drab
rgbOrange | 42495 | Orange
rgbOrangeRed | 17919 | Orange Red
rgbOrchid | 14053594 | Orchid
rgbPaleGoldenrod | 7071982 | Pale Goldenrod
rgbPaleGreen | 10025880 | Pale Green
rgbPaleTurquoise | 15658671 | Pale Turquoise
rgbPaleVioletRed | 9662683 | Pale Violet Red
rgbPapayaWhip | 14020607 | Papaya Whip
rgbPeachPuff | 12180223 | Peach Puff
rgbPeru | 4163021 | Peru
rgbPink | 13353215 | Pink
rgbPlum | 14524637 | Plum
rgbPowderBlue | 15130800 | Powder Blue
rgbPurple | 8388736 | Purple
rgbRed | 255 | Red
rgbRosyBrown | 9408444 | Rosy Brown
rgbRoyalBlue | 14772545 | Royal Blue
rgbSalmon | 7504122 | Salmon
rgbSandyBrown | 6333684 | Sandy Brown
rgbSeaGreen | 5737262 | Sea Green
rgbSeashell | 15660543 | Seashell
rgbSienna | 2970272 | Sienna
rgbSilver | 12632256 | Silver
rgbSkyBlue | 15453831 | Sky Blue
rgbSlateBlue | 13458026 | Slate Blue
rgbSlateGray | 9470064 | Slate Gray
rgbSnow | 16448255 | Snow
rgbSpringGreen | 8388352 | Spring Green
rgbSteelBlue | 11829830 | Steel Blue
rgbTan | 9221330 | Tan
rgbTeal | 8421376 | Teal
rgbThistle | 14204888 | Thistle
rgbTomato | 4678655 | Tomato
rgbTurquoise | 13688896 | Turquoise
rgbViolet | 15631086 | Violet
rgbWheat | 11788021 | Wheat
rgbWhite | 16777215 | White
rgbWhiteSmoke | 16119285 | White Smoke
rgbYellow | 65535 | Yellow
rgbYellowGreen | 3329434 | Yellow Green


XlRobustConnect Enumeration (Excel)

 Copy code hover
[image]

XlRobustConnect Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the PivotTable cache or a query table connects to its data source.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAlways | 1 | The PivotTable cache or query table always uses external source information (as defined by the SourceConnectionFile or SourceDataFile property) to reconnect.
xlAsRequired | 0 | The PivotTable cache or query table uses external source information to reconnect, using the Connection property.
xlNever | 2 | The PivotTable cache or query table never uses source information to reconnect.


XlRoutingSlipDelivery Enumeration (Excel)

 Copy code hover
[image]

XlRoutingSlipDelivery Enumeration (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


XlRoutingSlipStatus Enumeration (Excel)

 Copy code hover
[image]

XlRoutingSlipStatus Enumeration (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


XlRowCol Enumeration (Excel)

 Copy code hover
[image]

XlRowCol Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether the values corresponding to a particular data series are in rows or columns.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlColumns | 2 | Data series is in a row.
xlRows | 1 | Data series is in a column.


XlRunAutoMacro Enumeration (Excel)

 Copy code hover
[image]

XlRunAutoMacro Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the automatic macro to run.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAutoActivate | 3 | Auto_Activate macros
xlAutoClose | 2 | Auto_Close macros
xlAutoDeactivate | 4 | Auto_Deactivate macros
xlAutoOpen | 1 | Auto_Open macros


XlSaveAction Enumeration (Excel)

 Copy code hover
[image]

XlSaveAction Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies during file close if the file will be saved.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDoNotSaveChanges | 2 | Changes will not be saved.
xlSaveChanges | 1 | Changes will be saved.


XlSaveAsAccessMode Enumeration (Excel)

 Copy code hover
[image]

XlSaveAsAccessMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the access mode for the Save As function.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlExclusive | 3 | Exclusive mode
xlNoChange | 1 | Default (does not change the access mode)
xlShared | 2 | Share list


XlSaveConflictResolution Enumeration (Excel)

 Copy code hover
[image]

XlSaveConflictResolution Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the way that conflicts are to be resolved whenever a shared workbook is updated.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLocalSessionChanges | 2 | The local user's changes are always accepted.
xlOtherSessionChanges | 3 | The local user's changes are always rejected.
xlUserResolution | 1 | A dialog box asks the user to resolve the conflict.


XlScaleType Enumeration (Excel)

 Copy code hover
[image]

XlScaleType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the scale type of the value axis.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlScaleLinear | -4132 | Linear
xlScaleLogarithmic | -4133 | Logarithmic


XlSearchDirection Enumeration (Excel)

 Copy code hover
[image]

XlSearchDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the search direction when searching a range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlNext | 1 | Search for next matching value in range.
xlPrevious | 2 | Search for previous matching value in range.


XlSearchOrder Enumeration (Excel)

 Copy code hover
[image]

XlSearchOrder Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the order in which to search the range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlByColumns | 2 | Searches down through a column, then moves to the next column.
xlByRows | 1 | Searches across a row, then moves to the next row.


XlSearchWithin Enumeration (Excel)

 Copy code hover
[image]

XlSearchWithin Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the extent of the search for the range.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlWithinSheet | 1 | Limit search to current sheet.
xlWithinWorkbook | 2 | Search whole workbook.


XlSeriesNameLevel Enumeration (Excel)

 Copy code hover
[image]

XlSeriesNameLevel Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the series labels for the series label levels.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
XlSeriesNameLevelAll (default) | -1 (&HFFFFFFFF) | Set series names to all series name levels w/in range on the chart.
xlSeriesNameLevelCustom | -2 (&HFFFFFFFE) | Indicates literal data in the series names.
xlSeriesNameLevelNone | -3 (&HFFFFFFFD) | Set no category labels in the chart. Defaults to automatic indexed labels.
xlSeriesNameLevelAll | -1 |


XlSheetType Enumeration (Excel)

 Copy code hover
[image]

XlSheetType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the worksheet type.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlChart | -4109 | Chart
xlDialogSheet | -4116 | Dialog sheet
xlExcel4IntlMacroSheet | 4 | Excel version 4 international macro sheet
xlExcel4MacroSheet | 3 | Excel version 4 macro sheet
xlWorksheet | -4167 | Worksheet


XlSheetVisibility Enumeration (Excel)

 Copy code hover
[image]

XlSheetVisibility Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether the object is visible.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSheetHidden | 0 | Hides the worksheet which the user can unhide via menu.
xlSheetVeryHidden | 2 | Hides the object so that the only way for you to make it visible again is by setting this property to True (the user cannot make the object visible).
xlSheetVisible | -1 | Displays the sheet.


XlSizeRepresents Enumeration (Excel)

 Copy code hover
[image]

XlSizeRepresents Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies what the bubble size represents on a bubble chart.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSizeIsArea | 1 | Area of the bubble.
xlSizeIsWidth | 2 | Width of the bubble.


XlSlicerCacheType Enumeration (Excel)

 Copy code hover
[image]

XlSlicerCacheType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Designates the type of slicer or slicer cache.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
xlSlicer | 1 | Slicer cache represents a Slicer.
xlTimeline | 2 | Slicer cache represents a Timeline.


XlSlicerCrossFilterType Enumeration (Excel)

 Copy code hover
[image]

XlSlicerCrossFilterType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of cross filtering used by the specified slicer cache and how it is visualized.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlSlicerCrossFilterHideButtonsWithNoData | 4 | Cross filtering is turned on for this slicer cache, any tile with no data for a filtering selection in other slicers connected to the same data source will be dimmed. Additionally, buttons will be hidden.
xlSlicerCrossFilterShowItemsWithDataAtTop | 2 | Cross filtering is turned on for this slicer cache, any tile with no data for a filtering selection in other slicers connected to the same data source will be dimmed. Additionally, tiles with data are moved to the top in the slicer. (Default)
xlSlicerCrossFilterShowItemsWithNoData | 3 | Cross filtering is turned on for this slicer cache, any tile with no data for a filtering selection in other slicers connected to the same data source will be dimmed.
xlSlicerNoCrossFilter | 1 | Cross filtering is turned off entirely, so all tiles are displayed and active (not dimmed) regardless of filtering selections in other slicers.


XlSlicerSort Enumeration (Excel)

 Copy code hover
[image]

XlSlicerSort Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether items displayed in the slicer are sorted, and if they are sorted, whether they are sorted in ascending or descending order by item captions.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlSlicerSortAscending | 2 | Slicer items are sorted in ascending order by item captions.
xlSlicerSortDataSourceOrder | 1 | Slicer items are displayed in the order provided by the data source.
xlSlicerSortDescending | 3 | Slicer items are sorted in descending order by item captions.


XlSmartTagControlType Enumeration (Excel)

 Copy code hover
[image]

XlSmartTagControlType Enumeration (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


XlSmartTagDisplayMode Enumeration (Excel)

 Copy code hover
[image]

XlSmartTagDisplayMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.


XlSortDataOption Enumeration (Excel)

 Copy code hover
[image]

XlSortDataOption Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to sort text.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSortNormal | 0 | default. Sorts numeric and text data separately.
xlSortTextAsNumbers | 1 | Treat text as numeric data for the sort.


XlSortMethod Enumeration (Excel)

 Copy code hover
[image]

XlSortMethod Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of sort.

Name | Value | Description
xlPinYin | 1 | Phonetic Chinese sort order for characters. This is the default value.
xlStroke | 2 | Sort by the quantity of strokes in each character.


XlSortMethodOld Enumeration (Excel)

 Copy code hover
[image]

XlSortMethodOld Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to sort when using East Asian sorting methods.

Name | Value | Description
xlCodePage | 2 | Sort by code page.
xlSyllabary | 1 | Sort phonetically.


XlSortOn Enumeration (Excel)

 Copy code hover
[image]

XlSortOn Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the parameter on which the data should be sorted.

Version Information

Version Added: Excel 2007

Name | Value | Description
SortOnCellColor | 1 | Cell color.
SortOnFontColor | 2 | Font color.
SortOnIcon | 3 | Icon.
SortOnValues | 0 | Values.


XlSortOrder Enumeration (Excel)

 Copy code hover
[image]

XlSortOrder Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the sort order for the specified field or range.

Name | Value | Description
xlAscending | 1 | Sorts the specified field in ascending order. This is the default value.
xlDescending | 2 | Sorts the specified field in descending order.


XlSortOrientation Enumeration (Excel)

 Copy code hover
[image]

XlSortOrientation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the sort orientation.

Name | Value | Description
xlSortColumns | 1 | Sorts by column.
xlSortRows | 2 | Sorts by row. This is the default value.


XlSortType Enumeration (Excel)

 Copy code hover
[image]

XlSortType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which elements are to be sorted. Use this argument only when sorting PivotTable reports.

Name | Value | Description
xlSortLabels | 2 | Sorts the PivotTable report by labels.
xlSortValues | 1 | Sorts the PivotTable report by values.


XlSourceType Enumeration (Excel)

 Copy code hover
[image]

XlSourceType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Identifies the source object.

Name | Value | Description
xlSourceAutoFilter | 3 | An AutoFilter range
xlSourceChart | 5 | A chart
xlSourcePivotTable | 6 | A PivotTable report
xlSourcePrintArea | 2 | A range of cells selected for printing
xlSourceQuery | 7 | A query table (external data range)
xlSourceRange | 4 | A range of cells
xlSourceSheet | 1 | An entire worksheet
xlSourceWorkbook | 0 | A workbook


XlSpanishModes Enumeration (Excel)

 Copy code hover
[image]

XlSpanishModes Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the mode for checking the spelling of Spanish.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlSpanishTuteoAndVoseo | 1 | Tuteo and Voseo verb forms.
xlSpanishTuteoOnly | 0 | Tuteo verb forms only.
xlSpanishVoseoOnly | 2 | Voseo verb forms only.


XlSparklineRowCol Enumeration (Excel)

 Copy code hover
[image]

XlSparklineRowCol Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how to plot the sparkline when the data on which it is based is in a square-shaped range.

Version Information

Version Added: Excel 2010

Name | Value | Description
SparklineColumnsSquare | 2 | Plot the data by columns.
SparklineNonSquare | 0 | The sparkline is not bound to data in a square-shaped range.
SparklineRowsSquare | 1 | Plot the data by rows.

Remarks

The XlSparklineRowCol enumeration is used by the PlotBy property of the SparklineGroup object to determine how to plot chart in a sparkline when data on which it based is in a square-shaped range, such as A1:B2.


XlSparkScale Enumeration (Excel)

 Copy code hover
[image]

XlSparkScale Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the minimum or maximum value of the vertical axis of the sparkline is scaled relative to other sparklines in the group.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlSparkScaleCustom | 3 | The minimum or maximum value for the vertical axis of the sparkline has a user-defined value.
xlSparkScaleGroup | 1 | The minimum or maximum value for the vertical axes of all of the sparklines in the group have the same value.
xlSparkScaleSingle | 2 | The minimum or maximum value for the vertical axis of each sparkline in the group is automatically set to its own calculated value.

Remarks

The constants of the XlSparkScale enumeration correspond to the settings of the Vertical Axis Minimum Value Options and the Vertical Axis Maximum Value Options on the Axis drop-down list on the Sparkline Tools Design tab of the ribbon.


XlSparkType Enumeration (Excel)

 Copy code hover
[image]

XlSparkType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of sparkline.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlSparkColumn | 2 | A column chart sparkline.
xlSparkColumnStacked100 | 3 | A win/loss chart sparkline.
xlSparkLine | 1 | A line chart sparkline.


XlSpeakDirection Enumeration (Excel)

 Copy code hover
[image]

XlSpeakDirection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the order in which the cells are spoken.

Name | Value | Description
xlSpeakByColumns | 1 | Reads down a column, then moves to the next column.
xlSpeakByRows | 0 | Reads across a row, then moves to the next row.


XlSpecialCellsValue Enumeration (Excel)

 Copy code hover
[image]

XlSpecialCellsValue Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies cells with a particular type of value to include in the result.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlErrors | 16 | Cells with errors.
xlLogical | 4 | Cells with logical values.
xlNumbers | 1 | Cells with numeric values.
xlTextValues | 2 | Cells with text.


XlStdColorScale Enumeration (Excel)

 Copy code hover
[image]

XlStdColorScale Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the standard color scale.

Version Information

Version Added: Excel 2007

Name | Value | Description
ColorScaleBlackWhite | 3 | Black over White.
ColorScaleGYR | 2 | GYR.
ColorScaleRYG | 1 | RYG.
ColorScaleWhiteBlack | 4 | White over Black.


XlSubscribeToFormat Enumeration (Excel)

 Copy code hover
[image]

XlSubscribeToFormat Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the format to use when subscribing to a published edition.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSubscribeToPicture | -4147 | Picture
xlSubscribeToText | -4158 | Text


XlSubtototalLocationType Enumeration (Excel)

 Copy code hover
[image]

XlSubtototalLocationType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies where the subtotal will be displayed on the worksheet.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAtBottom | 2 | Subtotal will be at the bottom.
xlAtTop | 1 | Subtotal will be at the top.


XlSummaryColumn Enumeration (Excel)

 Copy code hover
[image]

XlSummaryColumn Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the location of the summary columns in the outline.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSummaryOnLeft | -4131 | The summary column will be positioned to the left of the detail columns in the outline.
xlSummaryOnRight | -4152 | The summary column will be positioned to the right of the detail columns in the outline.


XlSummaryReportType Enumeration (Excel)

 Copy code hover
[image]

XlSummaryReportType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of summary to be created for scenarios.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlStandardSummary | 1 | List scenarios side by side.
xlSummaryPivotTable | -4148 | Display scenarios in a PivotTable report.


XlSummaryRow Enumeration (Excel)

 Copy code hover
[image]

XlSummaryRow Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the location of the summary rows in the outline.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlSummaryAbove | 0 | The summary row will be positioned above the detail rows in the outline.
xlSummaryBelow | 1 | The summary row will be positioned below the detail rows in the outline.


XlTableStyleElementType Enumeration (Excel)

 Copy code hover
[image]

XlTableStyleElementType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the table style element used.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlBlankRow | 19 | Blank row
xlColumnStripe1 | 7 | Column Stripe1
xlColumnStripe2 | 8 | Column Stripe2
xlColumnSubheading1 | 20 | Column Subheading1
xlColumnSubheading2 | 21 | Column Subheading2
xlColumnSubheading3 | 22 | Column Subheading3
xlFirstColumn | 3 | First column
xlFirstHeaderCell | 9 | First header cell
xlFirstTotalCell | 11 | First total cell
xlGrandTotalColumn | 4 | Grand total column
xlGrandTotalRow | 2 | Grand total row
xlHeaderRow | 1 | Header row
xlLastColumn | 4 | Last column
xlLastHeaderCell | 10 | Last header cell
xlLastTotalCell | 12 | Last total cell
xlPageFieldLabels | 26 | Page field labels
xlPageFieldValues | 27 | Page field values
xlRowStripe1 | 5 | Row Stripe1
xlRowStripe2 | 6 | Row Stripe2
xlRowSubheading1 | 23 | Row Subheading1
xlRowSubheading2 | 24 | Row Subheading2
xlRowSubheading3 | 25 | Row Subheading3
xlSlicerHoveredSelectedItemWithData | 33 | A selected item, hovered over by the user, that contains data.
xlSlicerHoveredSelectedItemWithNoData | 35 | A selected item, hovered over by the user, that does not contain data.
xlSlicerHoveredUnselectedItemWithData | 32 | An item, hovered over by the user, that is not selected and that contains data.
xlSlicerHoveredUnselectedItemWithNoData | 34 | A selected item, hovered over by the user, that is not selected and that does not contain data.
xlSlicerSelectedItemWithData | 30 | A selected item that contains data.
xlSlicerSelectedItemWithNoData | 31 | A selected item that does not contain data.
xlSlicerUnselectedItemWithData | 28 | An item that is not selected that contains data.
xlSlicerUnselectedItemWithNoData | 29 | An item that is not selected that does not contain data.
xlSubtotalColumn1 | 13 | Subtotal Column1
xlSubtotalColumn2 | 14 | Subtotal Column2
xlSubtotalColumn3 | 15 | Subtotal Column3
xlSubtotalRow1 | 16 | Subtotal Row1
xlSubtotalRow2 | 17 | Subtotal Row2
xlSubtotalRow3 | 18 | Subtotal Row3
xlTimelinePeriodLabels1 | 38 | Timeline Period Label
xlTimelinePeriodLabels2 | 39 | Additional Timeline Period Label
xlTimelineSelectedTimeBlock | 40 | Selected Timeline Time Block
xlTimelineSelectedTimeBlockSpace | 42 | Selected Timeline Time Block space
xlTimelineSelectionLabel | 36 | Timeline Selection Label
xlTimelineTimeLevel | 37 | Timeline Level
xlTimelineUnselectedTimeBlock | 41 | Unselected Timeline Time Block
xlTotalRow | 2 | Total Row
xlWholeTable | 0 | Whole Table


XlTabPosition Enumeration (Excel)

 Copy code hover
[image]

XlTabPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the first or last tab position.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTabPositionFirst | 0 | First tab position.
xlTabPositionLast | 1 | Last tab position.


XlTextParsingType Enumeration (Excel)

 Copy code hover
[image]

XlTextParsingType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the column format for the data in the text file that you are importing into a query table.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDelimited | 1 | Default. Indicates that the file is delimited by delimiter characters.
xlFixedWidth | 2 | Indicates that the data in the file is arranged in columns of fixed widths.


XlTextQualifier Enumeration (Excel)

 Copy code hover
[image]

XlTextQualifier Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the delimiter to use to specify text.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTextQualifierDoubleQuote | 1 | Double quotation mark (").
xlTextQualifierNone | -4142 | No delimiter.
xlTextQualifierSingleQuote | 2 | Single quotation mark (').


XlTextVisualLayoutType Enumeration (Excel)

 Copy code hover
[image]

XlTextVisualLayoutType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether the visual layout of the text being imported is left-to-right or right-to-left.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTextVisualLTR | 1 | Left-to-right
xlTextVisualRTL | 2 | Right-to-left


XlThemeColor Enumeration (Excel)

 Copy code hover
[image]

XlThemeColor Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the theme color to be used.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlThemeColorAccent1 | 5 | Accent1
xlThemeColorAccent2 | 6 | Accent2
xlThemeColorAccent3 | 7 | Accent3
xlThemeColorAccent4 | 8 | Accent4
xlThemeColorAccent5 | 9 | Accent5
xlThemeColorAccent6 | 10 | Accent6
xlThemeColorDark1 | 1 | Dark1
xlThemeColorDark2 | 3 | Dark2
xlThemeColorFollowedHyperlink | 12 | Followed hyperlink
xlThemeColorHyperlink | 11 | Hyperlink
xlThemeColorLight1 | 2 | Light1
xlThemeColorLight2 | 4 | Light2


XlThemeFont Enumeration (Excel)

 Copy code hover
[image]

XlThemeFont Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the theme font to use.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlThemeFontMajor | 2 | Major.
xlThemeFontMinor | 1 | Minor.
xlThemeFontNone | 0 | Do not use any theme font.


XlThreadMode Enumeration (Excel)

 Copy code hover
[image]

XlThreadMode Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the control over the multi-threaded calculation mode.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlThreadModeAutomatic | 0 | Multi-threaded calculation mode is automatic.
xlThreadModeManual | 1 | Multi-threaded calculation mode is manual.


XlTickLabelOrientation Enumeration (Excel)

 Copy code hover
[image]

XlTickLabelOrientation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the text orientation for tick-mark labels.

Name | Value | Description
xlTickLabelOrientationAutomatic | -4105 | Text orientation set by Excel.
xlTickLabelOrientationDownward | -4170 | Text runs down.
xlTickLabelOrientationHorizontal | -4128 | Characters run horizontally.
xlTickLabelOrientationUpward | -4171 | Text runs up.
xlTickLabelOrientationVertical | -4166 | Characters run vertically.


XlTickLabelPosition Enumeration (Excel)

 Copy code hover
[image]

XlTickLabelPosition Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the position of tick-mark labels on the specified axis.

Name | Value | Description
xlTickLabelPositionHigh | -4127 | Top or right side of the chart.
xlTickLabelPositionLow | -4134 | Bottom or left side of the chart.
xlTickLabelPositionNextToAxis | 4 | Next to axis (where axis is not at either side of the chart).
xlTickLabelPositionNone | -4142 | No tick marks.


XlTickMark Enumeration (Excel)

 Copy code hover
[image]

XlTickMark Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the position of major and minor tick marks for an axis.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTickMarkCross | 4 | Crosses the axis
xlTickMarkInside | 2 | Inside the axis
xlTickMarkNone | -4142 | No mark
xlTickMarkOutside | 3 | Outside the axis


XlTimelineLevel Enumeration (Excel)

 Copy code hover
[image]

XlTimelineLevel Enumeration (Excel)
Send feedback

Published: July 16, 2012

One of the built-in hierarchy levels that Timeline supports.

Version information

Version Added: Excel 2013

Members

Name | Value | Description
xlTimelineLevelYears | 0 | Years level
xlTimelineLevelQuarters | 1 | Quarters level
xlTimelineLevelMonths | 2 | Months level
xlTimelineLevelDays | 3 | Days level


XlTimePeriods Enumeration (Excel)

 Copy code hover
[image]

XlTimePeriods Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the time period.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlLast7Days | 2 | Last 7 days
xlLastMonth | 5 | Last month
xlLastWeek | 4 | Last week
xlNextMonth | 8 | Next month
xlNextWeek | 7 | Next week
xlThisMonth | 9 | This month
xlThisWeek | 3 | This week
xlToday | 0 | Today
xlTomorrow | 6 | Tomorrow
xlYesterday | 1 | Yesterday


XlTimeUnit Enumeration (Excel)

 Copy code hover
[image]

XlTimeUnit Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the unit of time for chart axes and data series.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlDays | 0 | Days
xlMonths | 1 | Months
xlYears | 2 | Years


XlToolbarProtection Enumeration (Excel)

 Copy code hover
[image]

XlToolbarProtection Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies which properties of a toolbar are restricted. Options can be combined using Or.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlNoButtonChanges | 1 | No button changes permitted.
xlNoChanges | 4 | No changes of any kind.
xlNoDockingChanges | 3 | No changes to toolbar's docking position.
xlNoShapeChanges | 2 | No changes to toolbar shape.
xlToolbarProtectionNone | -4143 | All changes permitted.


XlTopBottom Enumeration (Excel)

 Copy code hover
[image]

XlTopBottom Enumeration (Excel)
Send feedback

Specifies the top 10 values from the top or bottom of a series of values.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTop10Bottom | 0 | Top 10 bottom values
xlTop10Top | 1 | Top 10 values


XlTotalsCalculation Enumeration (Excel)

 Copy code hover
[image]

XlTotalsCalculation Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of calculation in the Totals row of a list column.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlTotalsCalculationAverage | 2 | Average
xlTotalsCalculationCount | 3 | Count of non-empty cells
xlTotalsCalculationCountNums | 4 | Count of cells with numeric values
xlTotalsCalculationCustom | 9 | Custom calculation
xlTotalsCalculationMax | 6 | Maximum value in the list
xlTotalsCalculationMin | 5 | Minimum value in the list
xlTotalsCalculationNone | 0 | No calculation
xlTotalsCalculationStdDev | 7 | Standard deviation value
xlTotalsCalculationSum | 1 | Sum of all values in the list column
xlTotalsCalculationVar | 8 | Variable


XlTrendlineType Enumeration (Excel)

 Copy code hover
[image]

XlTrendlineType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the trendline that smoothes out fluctuations in the data is calculated.

Name | Value | Description
xlExponential | 5 | Uses an equation to calculate the least squares fit through points, for example, y=ab^x .
xlLinear | -4132 | Uses the linear equation y = mx + b to calculate the least squares fit through points.
xlLogarithmic | -4133 | Uses the equation y = c ln x + b to calculate the least squares fit through points.
xlMovingAvg | 6 | Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series less the number specified for the period.
xlPolynomial | 3 | Uses an equation to calculate the least squares fit through points, for example, y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g.
xlPower | 4 | Uses an equation to calculate the least squares fit through points, for example, y = ax^b.


XlUnderlineStyle Enumeration (Excel)

 Copy code hover
[image]

XlUnderlineStyle Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of underline applied to a font.

Name | Value | Description
xlUnderlineStyleDouble | -4119 | Double thick underline.
xlUnderlineStyleDoubleAccounting | 5 | Two thin underlines placed close together.
xlUnderlineStyleNone | -4142 | No underlining.
xlUnderlineStyleSingle | 2 | Single underlining.
xlUnderlineStyleSingleAccounting | 4 | Not supported.


XlUpdateLinks Enumeration (Excel)

 Copy code hover
[image]

XlUpdateLinks Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies a workbook's setting for updating embedded OLE links.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlUpdateLinksAlways | 3 | Embedded OLE links are always updated for the specified workbook.
xlUpdateLinksNever | 2 | Embedded OLE links are never updated for the specified workbook.
xlUpdateLinksUserSetting | 1 | Embedded OLE links are updated according to the user's settings for the specified workbook.


XlVAlign Enumeration (Excel)

 Copy code hover
[image]

XlVAlign Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the vertical alignment for the object.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlVAlignBottom | -4107 | Bottom
xlVAlignCenter | -4108 | Center
xlVAlignDistributed | -4117 | Distributed
xlVAlignJustify | -4130 | Justify
xlVAlignTop | -4160 | Top


XlWBATemplate Enumeration (Excel)

 Copy code hover
[image]

XlWBATemplate Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the type of workbook to create. The new workbook contains a single sheet of the specified type.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlWBATChart | -4109 | Chart
xlWBATExcel4IntlMacroSheet | 4 | Excel version 4 macro
xlWBATExcel4MacroSheet | 3 | Excel version 4 international macro
xlWBATWorksheet | -4167 | Worksheet


XlWebFormatting Enumeration (Excel)

 Copy code hover
[image]

XlWebFormatting Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how much formatting from a Web page, if any, is applied when a Web page is imported into a query table.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlWebFormattingAll | 1 | All formatting is imported.
xlWebFormattingNone | 3 | No formatting is imported.
xlWebFormattingRTF | 2 | Rich Text Format-compatible formatting is imported.


XlWebSelectionType Enumeration (Excel)

 Copy code hover
[image]

XlWebSelectionType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether an entire Web page, all tables on the Web page, or only a specific table is imported into a query table.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlAllTables | 2 | All tables
xlEntirePage | 1 | Entire page
xlSpecifiedTables | 3 | Specified tables


XlWindowState Enumeration (Excel)

 Copy code hover
[image]

XlWindowState Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the state of the window.

Name | Value | Description
xlMaximized | -4137 | Maximized
xlMinimized | -4140 | Minimized
xlNormal | -4143 | Normal


XlWindowType Enumeration (Excel)

 Copy code hover
[image]

XlWindowType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how the chart is displayed.

Name | Value | Description
xlChartAsWindow | 5 | The chart will open in a new window.
xlChartInPlace | 4 | The chart will be displayed on the current worksheet.
xlClipboard | 3 | The chart is copied to the clipboard.
xlInfo | -4129 | This constant has been deprecated.
xlWorkbook | 1 | This constant applies to Macintosh only.


XlWindowView Enumeration (Excel)

 Copy code hover
[image]

XlWindowView Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the view showing in the window.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlNormalView | 1 | Normal.
xlPageBreakPreview | 2 | Page break preview.
xlPageLayoutView | 3 | Page layout view.


XlXLMMacroType Enumeration (Excel)

 Copy code hover
[image]

XlXLMMacroType Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies, in a Microsoft Excel version 4 macro worksheet, what type of macro a name refers to or whether the name refers to a macro.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlCommand | 2 | Custom command.
xlFunction | 1 | Custom function.
xlNotXLM | 3 | Not a macro.


XlXmlExportResult Enumeration (Excel)

 Copy code hover
[image]

XlXmlExportResult Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the results of the save or export operation.

Name | Value | Description
xlXmlExportSuccess | 0 | The XML data file was successfully exported.
xlXmlExportValidationFailed | 1 | The contents of the XML data file do not match the specified schema map.


XlXmlImportResult Enumeration (Excel)

 Copy code hover
[image]

XlXmlImportResult Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies the results of the refresh or import operation.

Name | Value | Description
xlXmlImportElementsTruncated | 1 | The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.
xlXmlImportSuccess | 0 | The XML data file was successfully imported.
xlXmlImportValidationFailed | 2 | The contents of the XML data file do not match the specified schema map.


XlXmlLoadOption Enumeration (Excel)

 Copy code hover
[image]

XlXmlLoadOption Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies how Excel opens the XML data file.

Name | Value | Description
xlXmlLoadImportToList | 2 | Places the contents of the XML data file in an XML table.
xlXmlLoadMapXml | 3 | Displays the schema of the XML data file in the XML Structure task pane.
xlXmlLoadOpenXml | 1 | Opens the XML data file. The contents of the file will be flattened.
xlXmlLoadPromptUser | 0 | Prompts the user to choose how to open the file.


XlYesNoGuess Enumeration (Excel)

 Copy code hover
[image]

XlYesNoGuess Enumeration (Excel)
Send feedback

Published: July 16, 2012

Specifies whether or not the first row contains headers. Cannot be used when sorting PivotTable reports.

Version Information

Version Added: Excel 2007

Name | Value | Description
xlGuess | 0 | Excel determines whether there is a header, and where it is, if there is one.
xlNo | 2 | Default. The entire range should be sorted.
xlYes | 1 | The entire range should not be sorted.


XlModelChangeSource Enumeration (Excel)

 Copy code hover
[image]

XlModelChangeSource Enumeration (Excel)
Send feedback

Specifies the source of the change to the data model.

Version Information

Version Added: Excel 2013

Name | Value | Description
xlChangeByExcel | 0 | Excel
xlChangeByPowerPivotAddIn | 1 | PowerPivot add-in


Microsoft Graph Visual Basic reference

 Copy code hover
[image]

Microsoft Graph Visual Basic reference
Send feedback

Published: July 16, 2012

Welcome to the Microsoft Graph Visual Basic Reference. This reference contains information about the collections, objects, methods, properties, and enumerations of the Microsoft Graph object model.

This reference contains the following sections:

  • Concepts Provides important concepts about developing custom Microsoft Graph solutions.

  • Collections Provides reference information about the collections in the object model.

  • Objects Provides reference information about the objects in the object model.

  • Methods Provides reference information about the methods in the object model.

  • Properties Provides reference information about the properties in the object model.

  • Enumerations Provides reference information about the enumerations in the object model.


Collections (Graph Visual Basic reference)

 Copy code hover
[image]

Collections (Graph Visual Basic reference)
Send feedback

Published: July 16, 2012

This section provides reference information about the collections in the Microsoft Graph object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar button [image] in the Help window. Click a topic in the table of contents to view it.

If Connected to Office.com appears in the lower-right corner of the Help window, you are searching Help from the Office Web site. If Offline appears, you are searching Help from the files stored on your computer.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents located to the left of the topic to navigate through the documentation.


Axes Collection

 Copy code hover
[image]

Axes Collection
Send feedback

Published: July 16, 2012

A collection of all the Axis objects in the specified chart.

Using the Axes Collection

Use the Axes method to return the Axes collection. The following example displays the number of axes in the chart.

Copy code Copy code
With myChart
 MsgBox .Axes.Count
End With

Use Axes(type, group), where type is the axis type and group is the axis group, to return a single Axis object.

Type can be one of the following
XlAxisType
constants.

XlAxisType can be one of these XlAxisType constants.

xlCategory

xlSeriesxlValue

Group can be either of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

The following example sets the title text for the category axis.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With


ChartGroups Collection (Excel)

 Copy code hover
[image]

ChartGroups Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the ChartGroup objects in the specified chart. Each ChartGroup object represents one or more series plotted with the same format in a chart. A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format.

Using the ChartGroups Collection

Use the ChartGroups method to return the ChartGroups collection. The following example displays the number of chart groups in the chart

Copy code Copy code
MsgBox myChart.ChartGroups.Count

Use ChartGroups(index), where index is the chart group's index number, to return a single ChartGroup object. The following example adds drop lines to chart group one in the chart.

Copy code Copy code
myChart.ChartGroups(1).HasDropLines = True

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named chart-group shortcut methods to return a particular chart group. The PieGroups method returns the collection of pie chart groups in the specified chart, the LineGroups method returns the collection of line chart groups, and so on. Each of these methods can be used with an index number to return a single ChartGroup object, or used without an index number to return a ChartGroups collection. The following methods are available for chart groups:

  • AreaGroups method

  • BarGroups method

  • ColumnGroups method

  • DoughnutGroups method

  • LineGroups method

  • PieGroups method


DataLabels Collection (Excel)

 Copy code hover
[image]

DataLabels Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the DataLabel objects for the specified series. Each DataLabel object represents a data label for a point or trendline. For a series without definable points (such as an area series), the DataLabels collection contains a single data label.

Using the DataLabels Collection

Use the DataLabels method to return the DataLabels collection. The following example sets the number format for data labels in series one in the chart.

Copy code Copy code
With myChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.NumberFormat = "##.##"
End With

Use DataLabels(index), where index is the data label's index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in the chart.

Copy code Copy code
myChart.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"


HiLoLines Object

 Copy code hover
[image]

HiLoLines Object
Send feedback

Published: July 16, 2012

Represents the high-low lines in the specified chart group. High-low lines connect the highest point with the lowest point in every category in the chart group. Only 2-D line groups can have high-low lines. This object isn't a collection. There's no object that represents a single high-low line; either you have high-low lines turned on for all points in a chart group or you have them turned off.

Using the HiLoLines Object

Use the HiLoLines property to return the HiLoLines object. The following example makes the high-low lines in chart group one in the chart blue.

Copy code Copy code
myChart.ChartGroups(1).HiLoLines.Border.Color = RGB(0, 0, 255)

Remarks

If the HasHiLoLines property is False, most properties of the HiLoLines object are disabled.


LegendEntries Collection (Excel)

 Copy code hover
[image]

LegendEntries Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the LegendEntry objects in the specified chart legend. Each legend entry has two parts: the text of the entry, which is the name of the series or trendline associated with the entry; and the entry marker, which visually links the legend entry with its associated series or trendline in the chart. The formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

Using the LegendEntries Collection

Use the LegendEntries method to return the LegendEntries collection. The following example loops through the collection of legend entries in the chart and changes their font color to blue.

Copy code Copy code
With myChart.Legend
 For i = 1 To .LegendEntries.Count
 .LegendEntries(i).Font.ColorIndex = 5
 Next
End With

Use LegendEntries(index), where index is the legend entry's index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend; LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style to italic for the text of the legend entry at the top of the legend (this is usually the legend for series one) in is at the top of the legend; LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style to italic for the text of the legend entry at the top of the legend (this is usually the legend for series one) in myChart .

Copy code Copy code
myChart.Legend.LegendEntries(1).Font.Italic = True


Points Collection (Excel)

 Copy code hover
[image]

Points Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Point objects in the specified series in a chart.

Using the Points Collection

Use the Points method to return the Points collection. The following example adds a data label to the last point in series one in the chart.

Copy code Copy code
Dim pts As Points
Set pts = myChart.SeriesCollection(1).Points
pts(pts.Count).ApplyDataLabels Type:=xlShowValue

Use Points(index), where index is the point's index number, to return a single Point object. Points are numbered from left to right in the series. Points(1) is the leftmost point, and is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one in the chart. The specified series must be a 2-D line, scatter, or radar series.

Copy code Copy code
myChart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond


SeriesCollection Collection (Excel)

 Copy code hover
[image]

SeriesCollection Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Series objects in the specified chart or chart group.

Using the SeriesCollection Collection

Use the SeriesCollection method to return the SeriesCollection collection. The following example adjusts the interior color for each series in the collection:

Copy code Copy code
For X = 1 To myChart.SeriesCollection.Count
 With myChart.SeriesCollection(X)
 .Interior.Color = RGB(X * 75, 50, X * 50)
 End With
Next X

Use SeriesCollection(index), where index is the series' index number or name, to return a single Series object. The following example sets the color of the interior for series one in the chart to red.

Copy code Copy code
myChart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)


Trendlines Collection (Excel)

 Copy code hover
[image]

Trendlines Collection (Excel)
Send feedback

Published: July 16, 2012

A collection of all the Trendline objects for the specified series. Each Trendline object represents a trendline in a chart. A trendline shows the trend, or direction, of data in a series.

Using the Trendlines Collection

Use the Trendlines method to return the Trendlines collection. The following example displays the number of trendlines for series one in the chart.

Copy code Copy code
MsgBox myChart.SeriesCollection(1).Trendlines.Count

Use the Add method to create a new trendline and add it to the series. The following example adds a linear trendline to series one in the chart.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines
 .Add Type:=xlLinear, Name:="Linear Trend"
End With

Use Trendlines(index), where index is the trendline's index number, to return a single TrendLine object. The following example changes the trendline type for series one in the chart. If the series has no trendline, this example will fail.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

The index number denotes the order in which the trendlines are added to the series. Trendlines(1) is the first trendline added to the series, and is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.


Objects (Graph Visual Basic reference)

 Copy code hover
[image]

Objects (Graph Visual Basic reference)
Send feedback

Published: July 16, 2012

This section provides reference information about the objects in the Microsoft Graph object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar button [image] in the Help window. Click a topic in the table of contents to view it.

If Connected to Office.com appears in the lower-right corner of the Help window, you are searching Help from the Office Web site. If Offline appears, you are searching Help from the files stored on your computer.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents located to the left of the topic to navigate through the documentation.


Application Object

 Copy code hover
[image]

Application Object
Send feedback

Published: July 16, 2012

Represents the entire Microsoft Graph application. The Application object represents the top level of the object hierarchy and contains all of the objects, properties, and methods for the application.

Using the Application Object

Use the Application property to return the Application object. The following example applies the DataSheet property to the Application object.

Copy code Copy code
myChart.Application.DataSheet.Range("A1").Value = 32


AutoCorrect Object

 Copy code hover
[image]

AutoCorrect Object
Send feedback

Published: July 16, 2012

Contains Microsoft Graph AutoCorrect attributes (capitalization of names of days, correction of two initial capital letters, automatic correction list, and so on).

Using the AutoCorrect Object

Use the AutoCorrect property to return the AutoCorrect object. The following example sets Microsoft Graph to correct words that begin with two initial capital letters.

Copy code Copy code
With myChart.Application.AutoCorrect
 .TwoInitialCapitals = True
 .ReplaceText = True
End With


Axis Object

 Copy code hover
[image]

Axis Object
Send feedback

Published: July 16, 2012

Represents a single axis in a chart. The Axis object is a member of the Axes collection.

Using the Axis Object

Use Axes(type, group), where type is the axis type and group is the axis group, to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. Group can be either of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

The following example sets the text of the category axis title in the chart.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With


AxisTitle Object

 Copy code hover
[image]

AxisTitle Object
Send feedback

Published: July 16, 2012

Represents the title of an axis in a chart.

Using the AxisTitle Object

Use the AxisTitle property to return an AxisTitle object. The following example sets the text of the value axis title and sets the font to 10-point Bookman.

Copy code Copy code
With myChart.Axes(xlValue)
 .HasTitle = True
 With .AxisTitle
 .Caption = "Revenue (millions)"
 .Font.Name = "bookman"
 .Font.Size = 10
 End With
End With

Remarks

The AxisTitle object doesn't exist and cannot be used unless the HasTitle property for the specified axis is True.


Border Object

 Copy code hover
[image]

Border Object
Send feedback

Published: July 16, 2012

Represents the border of the specified object.

Using the Border Object

An object's border is treated as a single entity and is always returned as a unit (in its entirety), regardless of how many sides it has. Use the Border property to return the Border object. The following example places a dashed border around the chart area and places a dotted border around the plot area.

Copy code Copy code
With myChart
 .ChartArea.Border.LineStyle = xlDash
 .PlotArea.Border.LineStyle = xlDot
End With


Chart Object

 Copy code hover
[image]

Chart Object
Send feedback

Published: July 16, 2012

Represents the specified Microsoft Graph chart.

Using the Chart Object

Use the Chart property to return a Chart object. Most of the time, you'll create a reference to a Microsoft Graph chart and then use the reference in your code.


ChartArea Object

 Copy code hover
[image]

ChartArea Object
Send feedback

Published: July 16, 2012

Represents the chart area of the specified chart. The chart area in a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area in a 3-D chart contains the chart title and the legend; it doesn't include the plot area (the area within the chart area where the data is plotted). For information about formatting the plot area, see the PlotArea object.

Using the ChartArea Object

Use the ChartArea property to return the ChartArea object. The following example sets the pattern for the chart area.

Copy code Copy code
myChart.ChartArea.Interior.Pattern = xlLightDown


ChartColorFormat Object

 Copy code hover
[image]

ChartColorFormat Object
Send feedback

Published: July 16, 2012

Represents a foreground or background color.

Using the ChartColorFormat Object

Use the ForeColor property to return a ChartColorFormat object that represents the foreground fill color. Use the BackColor property to return the background fill color. Use the RGB property to return the color as an explicit red-green-blue value, and use the SchemeColor property to return or set the color as one of the colors in the current color scheme. The following example sets the foreground color, background color, and gradient for the chart area fill in myChart.

Copy code Copy code
With myChart.ChartArea.Fill
    .Visible = True
    .ForeColor.SchemeColor = 15
    .BackColor.SchemeColor = 17
    .TwoColorGradient msoGradientHorizontal, 1
End With


ChartFillFormat Object

 Copy code hover
[image]

ChartFillFormat Object
Send feedback

Published: July 16, 2012

Represents fill formatting.

Using the ChartFillFormat Object

Use the Fill property to return the ChartFillFormat object. The following example sets the foreground color, background color, and gradient for the chart area fill in myChart.

Copy code Copy code
With myChart.ChartArea.Fill
    .Visible = True
    .ForeColor.SchemeColor = 15
    .BackColor.SchemeColor = 17
    .TwoColorGradient msoGradientHorizontal, 1
End With


ChartGroup Object

 Copy code hover
[image]

ChartGroup Object
Send feedback

Published: July 16, 2012

Represents one or more series of points plotted in a chart with the same format. A chart contains one or more chart groups, each chart group contains one or more series , and each series contains one or more points . For example, a single chart might contain both a line chart group, which contains all the series plotted with the line chart format, and a bar chart group, which contains all the series plotted with the bar chart format. The ChartGroup object is a member of the ChartGroups collection.

Using the ChartGroup Object

Use ChartGroups(index), where index is the chart group's index number, to return a single ChartGroup object. The following example adds drop lines to chart group one in the chart.

Copy code Copy code
myChart.ChartGroups(1).HasDropLines = True

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named shortcut methods for chart groups to return a particular chart group. The PieGroups method returns the collection of pie chart groups in a chart, the LineGroups method returns the collection of all the line chart groups, and so on. You can use each of these methods with an index number to return a single ChartGroup object, or you can use each one without an index number to return a ChartGroups collection. The following methods are available for chart groups:

  • AreaGroups method

  • BarGroups method

  • ColumnGroups method

  • DoughnutGroups method

  • LineGroups method

  • PieGroups method


ChartTitle Object

 Copy code hover
[image]

ChartTitle Object
Send feedback

Published: July 16, 2012

Represents the title of the specified chart.

Using the ChartTitle Object

Use the ChartTitle property to return the ChartTitle object. The following example adds a title to the chart.

Copy code Copy code
With myChart
 .HasTitle = True
 .ChartTitle.Text = "February Sales"
End With

Remarks

The ChartTitle object doesn't exist and cannot be used unless the HasTitle property for the chart is True.


Corners Object

 Copy code hover
[image]

Corners Object
Send feedback

Published: July 16, 2012

Represents the corners of the specified 3-D chart. This object isn't a collection.

Using the Corners Object

Use the Corners property to return the Corners object. The following example selects the corners of the chart.

Copy code Copy code
myChart.Corners.Select

If the chart isn't a 3-D chart, the Corners property fails.


DataLabel Object

 Copy code hover
[image]

DataLabel Object
Send feedback

Published: July 16, 2012

Represents the data label for the specified point or trendline in a chart. For a series, the DataLabel object is a member of the DataLabels collection, which contains a DataLabel object for each point. For a series without definable points (such as an area series), the DataLabels collection contains a single DataLabel object.

Using the DataLabel Object

Use DataLabels(index), where index is the data label's index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in the chart.

Copy code Copy code
myChart.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"

Use the DataLabel property to return the DataLabel object for a single point. The following example turns on the data label for the second point in series one in the chart, and sets the data label text to "Saturday."

Copy code Copy code
With myChart
 With .SeriesCollection(1).Points(2)
 .HasDataLabel = True
 .DataLabel.Text = "Saturday"
 End With
End With

For a trendline, the DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text to show only the equation and then places the data label text in cell A1 on the datasheet.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = False
 .DisplayEquation = True
 x = .DataLabel.Text
End With
With myChart.Application.DataSheet
 .Range("A1").Value = x
End With


DataSheet Object

 Copy code hover
[image]

DataSheet Object
Send feedback

Published: July 16, 2012

Represents the Microsoft Graph datasheet.

Using the DataSheet Object

After you've established a reference to a chart, you can use the Application property of the chart to retrieve the datasheet. The following example applies the DataSheet property to the Application object, and then it applies the Range property to the datasheet to set the value of cell A1 to 32.

Copy code Copy code
myChart.Application.DataSheet.Range("A1").Value = 32

Remarks

On the datasheet, the first column heading (starting on the left) is A, followed by B, C, D, and so on. The first row heading (starting on the left) is 1, followed by 2, 3, 4, and so on. Neither the leftmost column nor the top row has a heading. In other words, column A is actually the second column from the left; likewise, row 1 is the second row from the top. The leftmost column and the top row, which are commonly used for legend text or axis labels, are referred to as column 0 (zero) and row 0 (zero). Thus, the following example inserts the text "Annual Sales" in the top cell in column A (the second column).

Copy code Copy code
myChart.Application.DataSheet.Range("A0").Value = "Annual Sales"

And the following example inserts the text "District 1" in the leftmost cell in row 2 (the third row).

Copy code Copy code
myChart.Application.DataSheet.Range("02").Value = "District 1"


DataTable Object

 Copy code hover
[image]

DataTable Object
Send feedback

Published: July 16, 2012

Represents a data table in the specified chart.

Using the DataTable Object

Use the DataTable property to return a DataTable object. The following example adds a data table with an outline border to the embedded chart.

Copy code Copy code
With myChart
 .HasDataTable = True
 .DataTable.HasBorderOutline = True
End With


DisplayUnitLabel Object

 Copy code hover
[image]

DisplayUnitLabel Object
Send feedback

Published: July 16, 2012

Represents a unit label on the value axis in the specified chart. Unit labels are useful for charting large values—for example, numbers in the millions or billions. You can make the chart more readable by using a single unit label instead of large numbers with strings of zeros next to the tick marks on the axis. This way, you need never have numbers of more than one or two digits by the tick marks.

Using the DisplayUnitLabel Object

Use the DisplayUnitLabel property to return the DisplayUnitLabel object. The following example sets the caption for the value axis in myChart to "Millions" and turns off automatic font scaling.

Copy code Copy code
With myChart.Axes(xlValue).DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
End With


DownBars Object

 Copy code hover
[image]

DownBars Object
Send feedback

Published: July 16, 2012

Represents the down bars in the specified chart group. Down bars connect points in the first series in the chart group with lower values in the last series (the lines go down from the first series). Only 2-D line groups that contain at least two series can have down bars. This object isn't a collection. There's no object that represents a single down bar; either you have up bars and down bars turned on for all points in a chart group or you have them turned off.

Using the DownBars Object

Use the DownBars property to return the DownBars object. The following example turns on up and down bars for chart group one in the chart. The example then sets the up-bar color to blue and the down-bar color to red.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
End With

Remarks

If the HasUpDownBars property is False, most properties of the DownBars object are disabled.


DropLines Object

 Copy code hover
[image]

DropLines Object
Send feedback

Published: July 16, 2012

Represents the drop lines in the specified chart group. Drop lines connect the points in the chart with the x-axis. Only line and area chart groups can have drop lines. This object isn't a collection. There's no object that represents a single drop line; either you have drop lines turned on for all points in a chart group or you have them turned off.

Using the DropLines Object

Use the DropLines property to return the DropLines object. The following example turns on drop lines for chart group one in the chart and then sets the drop-line color to red.

Copy code Copy code
myChart.ChartGroups(1).HasDropLines = True
myChart.ChartGroups(1).DropLines.Border.ColorIndex = 3

Remarks

If the HasDropLines property is False, most properties of the DropLines object are disabled.


ErrorBars Object

 Copy code hover
[image]

ErrorBars Object
Send feedback

Published: July 16, 2012

Represents the error bars for the specified chart series. Error bars indicate the degree of uncertainty for chart data. Only series in area, bar, column, line, and scatter groups in a 2-D chart can have error bars. Only series in scatter groups can have x and y error bars.

This object isn't a collection. There's no object that represents a single error bar; either you have x error bars or y error bars turned on for all points in a series or you have them turned off.

Using the ErrorBars Object

Use the ErrorBars property to return the ErrorBars object. The following example turns on error bars for series one in myChart and then sets the end style for the error bars.

Copy code Copy code
myChart.SeriesCollection(1).HasErrorBars = True
myChart.SeriesCollection(1).ErrorBars.EndStyle = xlNoCap

Remarks

The ErrorBar method changes the format and type of error bars.


Floor Object

 Copy code hover
[image]

Floor Object
Send feedback

Published: July 16, 2012

Represents the floor of the specified 3-D chart.

Using the Floor Object

Use the Floor property to return the Floor object. The following example sets the floor color for the chart to cyan. If the chart isn't a 3-D chart, this example will fail.

Copy code Copy code
myChart.Floor.Interior.Color = RGB(0, 255, 255)


Font Object

 Copy code hover
[image]

Font Object
Send feedback

Published: July 16, 2012

Contains the font attributes (font name, font size, color, and so on) for the specified object.

Using the Font Object

Use the Font property to return the Font object. The following example sets the title text for the value axis, sets the font to 10-point Bookman, and formats the word "millions" as italic.

Copy code Copy code
With myChart.Axes(xlValue)
 .HasTitle = True
 With .AxisTitle
 .Caption = "Revenue (millions)"
 .Font.Name = "bookman"
 .Font.Size = 10
 .Characters(10, 8).Font.Italic = True
Copy code Copy code
 End With
End With


Gridlines Object

 Copy code hover
[image]

Gridlines Object
Send feedback

Published: July 16, 2012

Represents major or minor gridlines on the specified chart axis. Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. This object isn't a collection. There's no object that represents a single gridline; either you have all gridlines for an axis turned on or you have them all turned off.

Using the Gridlines Object

Use the MajorGridlines property to return the GridLines object that represents the major gridlines for the axis. Use the MinorGridlines property to return the GridLines object that represents the minor gridlines for the axis. It's possible to return both major and minor gridlines at the same time.

The following example turns on major gridlines for the category axis on the chart and then formats the gridlines to be blue dashed lines.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasMajorGridlines = True
 .MajorGridlines.Border.Color = RGB(0, 0, 255)
 .MajorGridlines.Border.LineStyle = xlDash
End With


Interior Object

 Copy code hover
[image]

Interior Object
Send feedback

Published: July 16, 2012

Represents the interior of the specified object.

Using the Interior Object

Use the Interior property to return the Interior object. The following example sets the chart area color to gray and the plot area color to green.

Copy code Copy code
With myChart
 .PlotArea.Interior.Color = RGB(0, 100, 150)
 .ChartArea.Interior.Color = RGB(50, 10, 50)
End With


LeaderLines Object

 Copy code hover
[image]

LeaderLines Object
Send feedback

Published: July 16, 2012

Represents leader lines in the specified chart. Leader lines connect data labels to data points. This object isn't a collection; there's no object that represents a single leader line.

Using the LeaderLines Object

Use the LeaderLines property to return the LeaderLines object. The following example adds data labels and blue leader lines to series one in the chart.

Copy code Copy code
With myChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With


Legend Object

 Copy code hover
[image]

Legend Object
Send feedback

Published: July 16, 2012

Represents the legend in the specified chart. Each chart can have only one legend. The Legend object contains one or more LegendEntry objects; each LegendEntry object contains a LegendKey object.

Using the Legend Object

Use the Legend property to return the Legend object. The following example sets the font style for the legend to bold.

Copy code Copy code
myChart.Legend.Font.Bold = True

Remarks

The chart legend isn't visible unless the HasLegend property is True. If this property is False, properties and methods of the Legend object will fail.


LegendEntry Object

 Copy code hover
[image]

LegendEntry Object
Send feedback

Published: July 16, 2012

Represents a legend entry in the specified chart legend. The LegendEntry object is a member of the LegendEntries collection, which contains all the LegendEntry objects in the legend.

Each legend entry has two parts: the text of the entry, which is the name of the series associated with the entry; and an entry marker, which visually links the legend entry with its associated series or trendline in the chart. Formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

You cannot change the text of a legend entry. LegendEntry objects support font formatting, and they can be deleted. No pattern formatting is supported for legend entries. The position and size of entries is fixed.

Using the LegendEntry Object

Use LegendEntries(index), where index is the legend entry's index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend, and is at the top of the legend, and LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style for the text of the legend entry at the top of the legend (this is usually the legend for series one).

Copy code Copy code
myChart.Legend.LegendEntries(1).Font.Italic = True

Remarks

There's no direct way to return the series or trendline that corresponds to a particular legend entry.

After legend entries have been deleted, the only way to restore them is to remove and then recreate the legend that contained them by setting the HasLegend property for the chart to False and then back to True.


LegendKey Object

 Copy code hover
[image]

LegendKey Object
Send feedback

Published: July 16, 2012

Represents a legend key in the specified chart legend. Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.

Using the LegendKey Object

Use the LegendKey property to return the LegendKey object. The following example changes the marker background color to blue for the legend entry at the top of the legend in the chart. This simultaneously changes the formatting of every point in the series associated with this legend entry (if, that is, the associated series supports data markers).

Copy code Copy code
myChart.Legend.LegendEntries(1) _
 .LegendKey.MarkerBackgroundColorIndex = 5


PlotArea Object

 Copy code hover
[image]

PlotArea Object
Send feedback

Published: July 16, 2012

Represents the plot area of the specified chart. This is the area where your chart data is plotted. The plot area in a 2-D chart contains the data markers, gridlines, data labels, trendlines, and optional chart items placed in the chart area. The plot area in a 3-D chart contains all the above items plus the walls, floor, axes, axis titles, and tick-mark labels in the chart.

The plot area is surrounded by the chart area. The chart area in a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area in a 3-D chart contains the chart title and the legend. For information about formatting the chart area, see the ChartArea object.

Using the PlotArea Object

Use the PlotArea property to return the PlotArea object. The following example places a dashed border around the chart area and places a dotted border around the plot area.

Copy code Copy code
With myChart
 .ChartArea.Border.LineStyle = xlDash
 .PlotArea.Border.LineStyle = xlDot
End With


Point Object

 Copy code hover
[image]

Point Object
Send feedback

Published: July 16, 2012

Represents a single point in a series on the specified chart. The Point object is a member of the Points collection, which contains all the points in the specified series.

Using the Point Object

Use Points(index), where index is the point's index number, to return a single Point object. Points are numbered from left to right in the series. Points(1) is the leftmost point, and is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one. For this example to work, series one must be a 2-D line, scatter, or radar series.

Copy code Copy code
myChart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond


Range Object

 Copy code hover
[image]

Range Object
Send feedback

Published: July 16, 2012

Represents a cell, a row, a column, or a selection of cells that contains one or more contiguous blocks of cells.

Using the Range Object

The following properties for returning a Range object are described in this section:

  • Range property

  • Cells property

Range Property

Use Range(arg), where arg is the name of the range, to return a Range object that represents a single cell or a range of cells. The following example places the value of cell A1 in cell A5.

Copy code Copy code
myChart.Application.DataSheet.Range("A5").Value = _
    myChart.Application.DataSheet.Range("A1").Value

The following example fills the range A1:H8 with the value 20.

Copy code Copy code
myChart.Application.DataSheet.Range("A1:H8").Value = 20

Cells Property

Use Cells(row, column), where row is the row's index number and column is the column's index number, to return a single cell. The following example sets the value of cell A1 to 24 (column A is the second column on the datasheet, and row 1 is the second row on the datasheet).

Copy code Copy code
myChart.Application.DataSheet.Cells(2, 2).Value = 24

Although you can also use Range("A1") to return cell A1, there may be times when the Cells property is more convenient because you can use a variable for the row or column. The following example creates column and row headings on the datasheet.

Copy code Copy code
Sub SetUpTable()
With myChart.Application.DataSheet
    For theYear = 1 To 5
        .Cells(1, theYear + 1).Value = 1990 + theYear
    Next theYear
    For theQuarter = 1 To 4
        .Cells(theQuarter + 1, 1).Value = "Q" & theQuarter
    Next theQuarter
End With
End Sub

Although you can use Visual Basic string functions to alter A1-style references, it's much easier (and much better programming practice) to use the Cells(1, 1) notation.

Use expression.Cells(row, column), where expression is an expression that returns a Range object, and row and column are relative to the upper-left corner of the range, to return part of a range. The following example sets the value for cell C5.

Copy code Copy code
myChart.Application.Range("C5:C10").Cells(1, 1).Value = 35


Series Object

 Copy code hover
[image]

Series Object
Send feedback

Published: July 16, 2012

Represents a series in the specified chart. The Series object is a member of the SeriesCollection collection.

Using the Series Object

Use SeriesCollection(index), where index is the series' index number or name, to return a single Series object. The following example sets the color of the interior for series one in the chart.

Copy code Copy code
myChart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)

The series index number indicates the order in which the series are added to the chart. SeriesCollection(1) is the first series added to the chart, and is the first series added to the chart, and SeriesCollection(SeriesCollection.Count) is the last one added.


SeriesLines Object

 Copy code hover
[image]

SeriesLines Object
Send feedback

Published: July 16, 2012

Represents series lines in the specified chart group. Series lines connect the data values in each series. Only 2-D stacked-bar or column chart groups can have series lines. This object isn't a collection. There's no object that represents a single series line; either you have series lines turned on for all points in a chart group or you have them turned off.

Using the SeriesLines Object

Use the SeriesLines property to return the SeriesLines object. The following example adds series lines to chart group one in the chart. The chart must be a 2-D stacked-bar or column chart.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasSeriesLines = True
 .SeriesLines.Border.Color = RGB(0, 0, 255)
End With

Remarks

If the HasSeriesLines property is False, most properties of the SeriesLines object are disabled.


TickLabels Object

 Copy code hover
[image]

TickLabels Object
Send feedback

Published: July 16, 2012

Represents the tick-mark labels associated with tick marks on the specified chart axis. This object isn't a collection. There's no object that represents a single tick-mark label; you must return all the tick-mark labels as a unit.

Tick-mark label text for the category axis comes from the name of the associated category in the chart. The default tick-mark label text for the category axis is the number that indicates the position of the category relative to the left end of this axis. To change the number of unlabeled tick marks between tick-mark labels, you must change the TickLabelSpacing property for the category axis.

Tick-mark label text for the value axis is calculated based on the MajorUnit, MinimumScale, and MaximumScale properties of the value axis. To change the tick-mark label text for the value axis, you must change the values of these properties.

Using the TickLabels Object

Use the TickLabels property to return the TickLabels object. The following example sets the number format for the tick-mark labels on the value axis in the chart.

Copy code Copy code
myChart.Axes(xlValue).TickLabels.NumberFormat = "0.00"


Trendline Object

 Copy code hover
[image]

Trendline Object
Send feedback

Published: July 16, 2012

Represents a trendline in the specified chart. A trendline shows the trend, or direction, of data in a series. The Trendline object is a member of the Trendlines collection, which contains all the Trendline objects for a single series.

Using the Trendline Object

Use Trendlines(index), where index is the trendline's index number, to return a single Trendline object. The following example changes the trendline type for series one in the chart. If the series has no trendline, this example will fail.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

The index number denotes the order in which the trendlines are added to the series. Trendlines(1) is the first trendline added to the series, and is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.


UpBars Object

 Copy code hover
[image]

UpBars Object
Send feedback

Published: July 16, 2012

Represents the up bars in a chart group. Up bars connect points in series one with higher values in the last series in the chart group (the lines go up from series one). Only 2-D line groups that contain at least two series can have up bars. This object isn't a collection. There's no object that represents a single up bar; either you have up bars turned on for all points in a chart group or you have them turned off.

Using the UpBars Object

Use the UpBars property to return the UpBars object. The following example turns on up and down bars for chart group one in the chart. The example then sets the up-bar color to blue and sets the down-bar color to red.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
End With

Remarks

If the HasUpDownBars property is False, most properties of the UpBars object are disabled.


Walls Object

 Copy code hover
[image]

Walls Object
Send feedback

Published: July 16, 2012

Represents the walls of the specified 3-D chart. This object isn't a collection. There's no object that represents a single wall; you must return all the walls as a unit.

Using the Walls Object

Use the Walls property to return the Walls object. The following example sets the pattern on the walls for the chart. If the chart isn't a 3-D chart, this example will fail.

Copy code Copy code
myChart.Walls.Interior.Pattern = xlGray75


Methods (Graph Visual Basic reference)

 Copy code hover
[image]

Methods (Graph Visual Basic reference)
Send feedback

Published: July 16, 2012

This section provides reference information about the methods in the Microsoft Graph object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar button [image] in the Help window. Click a topic in the table of contents to view it.

If Connected to Office.com appears in the lower-right corner of the Help window, you are searching Help from the Office Web site. If Offline appears, you are searching Help from the files stored on your computer.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents located to the left of the topic to navigate through the documentation.


Activate Method

 Copy code hover
[image]

Activate Method
Send feedback

Published: July 16, 2012

Activates the object.

expression.Activate

expression Required. An expression that returns an object in the Applies To list.

Example

This example activates the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Activate


Add Method

 Copy code hover
[image]

Add Method
Send feedback

Published: July 16, 2012

Creates a new trend line. Returns a Trendline object.

expression.Add(Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

expression Required. An expression that returns one of the objects in the Applies To list.

TypeOptional
XlTrendlineType
. The type of trendline.

XlTrendlineType can be one of these XlTrendlineType constants.

xlExponential

xlLinear default

xlLogarithmic

xlMovingAvg

xlPolynomial

xlPower

Order Optional Variant. Required if Type is xlPolynomial. The trendline order. Must be an integer from 2 through 6.

Period Optional Variant. Required if Type is xlMovingAvg. The trendline period. Must be an integer greater than 1 and less than the number of data points in the series you're adding a trendline to.

Forward Optional Variant. The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward Optional Variant. The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept Optional Variant. The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.

DisplayEquation Optional Variant. True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default value is False.

DisplayRSquared Optional Variant. True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default value is False.

Name Optional Variant. The name of the trendline, as text. If this argument is omitted, Microsoft Graph generates a name.

Example

This example creates a new linear trendline on the chart.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines.Add


AddChartAutoFormat Method

 Copy code hover
[image]

AddChartAutoFormat Method
Send feedback

Published: July 16, 2012

Adds a custom chart autoformat to the list of available chart autoformats.

expression.AddChartAutoFormat(Name, Description)

expression Required. An expression that returns an Application object.

Name Required String. The name of the autoformat.

Description Optional String. A description of the custom autoformat.

Example

This example adds a new autoformat.

Copy code Copy code
myChart.Application.AddChartAutoFormat _
 Name:="Presentation Chart"


AddReplacement Method

 Copy code hover
[image]

AddReplacement Method
Send feedback

Published: July 16, 2012

Adds an entry to the array of AutoCorrect replacements.

expression.AddReplacement(What, Replacement)

expression Required. An expression that returns an AutoCorrect object.

What Required String. The text to be replaced. If this string already exists in the array of AutoCorrect replacements, the existing substitute text is replaced by the new text.

Replacement Required String. The replacement text.

Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

Copy code Copy code
With myChart.Application.AutoCorrect
 .AddReplacement "Temperature", "Temp."
End With


ApplyCustomType Method

 Copy code hover
[image]

ApplyCustomType Method
Send feedback

Published: July 16, 2012

ApplyCustomType method as it applies to the Series object.

Applies a standard or custom chart type to a series.

expression.ApplyCustomType(ChartType)

expression Required. An expression that returns one of the above objects.

ChartTypeRequired
XlChartType
. A standard chart type.

XlChartType can be one of these XlChartType constants.

xl3DAreaStacked

xlConeCol

xlConeColStacked

xlCylinderBarClustered

xlCylinderBarStacked100

xlCylinderColClustered

xlCylinderColStacked100

xlDoughnutExploded

xlLineMarkers

xlLineMarkersStacked100

xlLineStacked100

xlPieExploded

xlPyramidBarClustered

xlPyramidBarStacked100

xlPyramidColClustered

xlPyramidColStacked100

xlRadarFilled

xlStockHLC

xlStockVHLC

xlSurface

xlSurfaceTopViewWireframe

xlXYScatter

xlXYScatterLinesNoMarkers

xlXYScatterSmoothNoMarkers

xl3DArea

xl3DAreaStacked100

xl3DBarClustered

xl3DBarStacked

xl3DBarStacked100

xl3DColumn

xl3DColumnClustered

xl3DColumnStacked

xl3DColumnStacked100

xl3DLine

xl3DPie

xl3DPieExploded

xlArea

xlAreaStacked

xlAreaStacked100

xlBarClustered

xlBarOfPie

xlBarStacked

xlBarStacked100

xlBubble

xlBubble3DEffect

xlColumnClustered

xlColumnStacked

xlColumnStacked100

xlConeBarClustered

xlConeBarStacked

xlConeBarStacked100

xlConeColClustered

xlConeColStacked100

xlCylinderBarStacked

xlCylinderCol

xlCylinderColStacked

xlDoughnut

xlLine

xlLineMarkersStacked

xlLineStacked

xlPie

xlPieOfPie

xlPyramidBarStacked

xlPyramidCol

xlPyramidColStacked

xlRadar

xlRadarMarkers

xlStockOHLC

xlStockVOHLC

xlSurfaceTopView

xlSurfaceWireframe

xlXYScatterLines

xlXYScatterSmooth

ApplyCustomType method as it applies to the Chart object.

Applies a standard or custom chart type to a chart.

expression.ApplyCustomType(ChartType, TypeName)

expression Required. An expression that returns one of the above objects.

ChartTypeRequired
XlChartType
. A standard chart type.

XlChartType can be one of these XlChartType constants.

xl3DAreaStacked

xlConeCol

xlConeColStacked

xlCylinderBarClustered

xlCylinderBarStacked100

xlCylinderColClustered

xlCylinderColStacked100

xlDoughnutExploded

xlLineMarkers

xlLineMarkersStacked100

xlLineStacked100

xlPieExploded

xlPyramidBarClustered

xlPyramidBarStacked100

xlPyramidColClustered

xlPyramidColStacked100

xlRadarFilled

xlStockHLC

xlStockVHLC

xlSurface

xlSurfaceTopViewWireframe

xlXYScatter

xlXYScatterLinesNoMarkers

xlXYScatterSmoothNoMarkers

xl3DArea

xl3DAreaStacked100

xl3DBarClustered

xl3DBarStacked

xl3DBarStacked100

xl3DColumn

xl3DColumnClustered

xl3DColumnStacked

xl3DColumnStacked100

xl3DLine

xl3DPie

xl3DPieExploded

xlArea

xlAreaStacked

xlAreaStacked100

xlBarClustered

xlBarOfPie

xlBarStacked

xlBarStacked100

xlBubble

xlBubble3DEffect

xlColumnClustered

xlColumnStacked

xlColumnStacked100

xlConeBarClustered

xlConeBarStacked

xlConeBarStacked100

xlConeColClustered

xlConeColStacked100

xlCylinderBarStacked

xlCylinderCol

xlCylinderColStacked

xlDoughnut

xlLine

xlLineMarkersStacked

xlLineStacked

xlPie

xlPieOfPie

xlPyramidBarStacked

xlPyramidCol

xlPyramidColStacked

xlRadar

xlRadarMarkers

xlStockOHLC

xlStockVOHLC

xlSurfaceTopView

xlSurfaceWireframe

xlXYScatterLines

xlXYScatterSmooth

TypeNameOptional Variant. A String naming the custom chart type when ChartType specifies a custom chart gallery.

Example

This example applies the line with the markers chart type.

Copy code Copy code
myChart.ApplyCustomType xlLineMarkers


ApplyDataLabels Method

 Copy code hover
[image]

ApplyDataLabels Method
Send feedback

Published: July 16, 2012

ApplyDataLabels method as it applies to the Chart object.

Applies data labels to a point, a series, or all the series in a chart.

expression.ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines)

expression Required. An expression that returns a Chart object.

TypeOptional
Variant
. The data label type.

XlDataLabelsType can be one of these XlDataLabelsType constants.

xlDataLabelsShowBubbleSizes The bubble size for the data label.

xlDataLabelsShowLabel. Category for the point.

xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.

xlDataLabelsShowNone. No data labels.

xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowValue default. Value for the point.

LegendKey Optional Variant. True to show the legend key next to the point. The default value is False.

AutoText Optional Variant. True if the object automatically generates appropriate text based on content.

HasLeaderLinesOptional Variant. True if the series has leader lines.

ApplyDataLabels method as it applies to the Point and Series objects.

Applies data labels to a point, a series, or all the series in a chart.

expression.ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression Required. An expression that returns one of the above objects.

TypeOptional
XlDataLabelsType
. The data label type.

XlDataLabelsType can be one of these XlDataLabelsType constants.

xlDataLabelsShowBubbleSizes The bubble size for the data label.

xlDataLabelsShowLabel. Category for the point.

xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.

xlDataLabelsShowNone. No data labels.

xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowValue default. Value for the point.

LegendKey Optional Variant. True to show the legend key next to the point. The default value is False.

AutoText Optional Variant. True if the object automatically generates appropriate text based on content.

HasLeaderLinesOptional Variant. True if the series has leader lines.

ShowSeriesNameOptional Variant. The series name for the data label.

ShowCategoryNameOptional Variant. The category name for the data label.

ShowValueOptional Variant. The value for the data label.

ShowPercentageOptional Variant. The percentage for the data label.

ShowBubbleSizeOptional Variant. The bubble size for the data label.

SeparatorOptional Variant. The separator for the data label.

Example

ApplyDataLabels method as it applies to the Series object.

This example applies category labels to series one.

Copy code Copy code
myChart.SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel


AreaGroups Method

 Copy code hover
[image]

AreaGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, this method returns an object that represents a single area chart group or a collection of all the area chart groups.

expression.AreaGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The index number of the specified chart group.

Example

This example turns on drop lines for the 2-D area chart group.

Copy code Copy code
myChart.AreaGroups(1).HasDropLines = True


AutoFit Method

 Copy code hover
[image]

AutoFit Method
Send feedback

Published: July 16, 2012

Changes the width of the columns in the specified range to achieve the best fit.

expression.AutoFit

expression Required. An expression that returns a Range object. Must be a row or a range of rows, or a column or a range of columns. Otherwise, this method causes an error.

Remarks

One unit of column width is equal to the width of one character in the Normal style.

Example

This example changes the width of columns A through I on the datasheet to achieve the best fit.

Copy code Copy code
myChart.Application.DataSheet.Columns("A:I").AutoFit

This example changes the width of columns A through E on the datasheet to achieve the best fit, based only on the contents of cells A1:E1.

Copy code Copy code
myChart.Application.DataSheet.Range("A1:E1").Columns.AutoFit


Axes Method

 Copy code hover
[image]

Axes Method
Send feedback

Published: July 16, 2012

Returns an object that represents either a single axis or a collection of the axes on the chart.

expression.Axes(Type, AxisGroup)

expression Required. An expression that returns one of the objects in the Applies To list.

Type Optional
XlAxisType
. Specifies the axis to return. The reference style of the formula.

XlAxisType can be one of these XlAxisType constants.

xlValue

xlCategoryxlSeriesAxis (valid only for 3-D charts)

AxisGroup Optional
XlAxisGroup
. The reference style of the formula.

XlAxisGroup can be one of these XlAxisGroup constants.

xlPrimary

xlSecondary If this argument is omitted, the primary group is used. 3-D charts have only one axis group.

Example

This example adds an axis label to the category axis.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
End With

This example turns off major gridlines for the category axis.

Copy code Copy code
myChart.Axes(xlCategory).HasMajorGridlines = False

This example turns off all gridlines for all axes.

Copy code Copy code
For Each a In myChart.Axes
 a.HasMajorGridlines = False
 a.HasMinorGridlines = False
Next a


BarGroups Method

 Copy code hover
[image]

BarGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, this method returns an object that represents either a single bar chart group or a collection of all the bar chart groups.

expression.BarGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The index number of the specified bar chart group.

Example

This example sets the space between bar clusters in the 2-D bar chart group to be 50 percent of the bar width.

Copy code Copy code
myChart.BarGroups(1).GapWidth = 50


Chart Method

 Copy code hover
[image]

Chart Method
Send feedback

Published: July 16, 2012

Returns a Chart object that represents the Microsoft Graph chart.


ChartGroups Method

 Copy code hover
[image]

ChartGroups Method
Send feedback

Published: July 16, 2012

Returns an object that represents either a single chart group or a collection of all the chart groups in the chart. The returned collection includes every type of group.

expression.ChartGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The chart group number.

Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that intersect at one or more data points.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With


Clear Method

 Copy code hover
[image]

Clear Method
Send feedback

Published: July 16, 2012

Clear method as it applies to the ChartArea and Legend objects.

Clears the entire chart area.

expression.Clear

expression Required. An expression that returns one of the above objects.

Clear method as it applies to the Range object.

Clears the entire range.

expression.Clear

expression Required. An expression that returns one of the above objects.

Example

This example clears the formulas and formatting in cells A1:G37 on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Range("A1:G37").Clear

This example clears the chart area (the chart data and formatting) of Chart1.

Copy code Copy code
myChart.ChartArea.Clear


ClearContents Method

 Copy code hover
[image]

ClearContents Method
Send feedback

Published: July 16, 2012

ClearContents method as it applies to the ChartArea object.

Clears the data from a chart but leaves the formatting.

expression.ClearContents

expression Required. An expression that returns one of the above objects.

ClearContents method as it applies to the Range object.

Clears the formulas from the range.

expression.ClearContents

expression Required. An expression that returns one of the above objects.

Example

This example clears the formulas from cells A1:G37 on the datasheet but leaves the formatting intact.

Copy code Copy code
myChart.Application.DataSheet.Range("A1:G37").ClearContents

This example clears the chart data from a chart but leaves the formatting intact.

Copy code Copy code
myChart.ChartArea.ClearContents


ClearFormats Method

 Copy code hover
[image]

ClearFormats Method
Send feedback

Published: July 16, 2012

Clears the formatting of the object.

expression.ClearFormats

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example clears all formatting from cells A1:G37 on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Range("A1:G37").ClearFormats

This example clears the formatting from the chart.

Copy code Copy code
myChart.ChartArea.ClearFormats


ColumnGroups Method

 Copy code hover
[image]

ColumnGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single column chart group or a collection of the column chart groups.

expression.ColumnGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The index number of the specified column chart group.

Example

This example sets the space between column clusters in the 2-D column chart group to be 50 percent of the column width.

Copy code Copy code
myChart.ColumnGroups(1).GapWidth = 50


Copy Method

 Copy code hover
[image]

Copy Method
Send feedback

Published: July 16, 2012

Copy method as it applies to the ChartArea object.

Copies a picture of the point or series to the Clipboard.

expression.Copy

expression Required. An expression that returns one of the above objects.

Copy method as it applies to the Range object.

Copies the Range to the specified range or to the Clipboard.

expression.Copy(Destination)

expression Required. An expression that returns one of the above objects.

Destination Optional Variant. Specifies the new range to which the specified range will be copied. If this argument is omitted, Microsoft Graph copies the range to the Clipboard.

Example

This example copies the formulas in cells A1:D4 on the datasheet into cells E5:H8.

Copy code Copy code
Set mySheet = myChart.Application.DataSheet
mySheet.Range("A1:D4").Copy _
 Destination:= mySheet.Range("E5")


Cut Method

 Copy code hover
[image]

Cut Method
Send feedback

Published: July 16, 2012

Cuts the specified range to the Clipboard or pastes it into a specified destination.

expression.Cut(Destination)

expression Required. An expression that returns a Range object.

Destination Optional Variant. The range where the object should be pasted. If this argument is omitted, the object is cut to the Clipboard.

Example

This example cuts the range A1:G37 on the datasheet and places it on the Clipboard.

Copy code Copy code
Set mySheet = myChart.Application.DataSheet
mySheet.Range("A1:G37").Cut


DataLabels Method

 Copy code hover
[image]

DataLabels Method
Send feedback

Published: July 16, 2012

Returns an object that represents either a single data label or a collection of all the data labels for the series.

expression.DataLabels(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The number of the data label.

Example

This example sets the data labels for series one to show their key, assuming that their values are visible when the example runs.

Copy code Copy code
With myChart.SeriesCollection(1)
 .HasDataLabels = True
 With .DataLabels
 .ShowLegendKey = True
 .Type = xlValue
 End With
End With


Delete Method (Graph)

 Copy code hover
[image]

Delete Method (Graph)
Send feedback

Published: July 16, 2012

Delete method as it applies to all objects in the Applies To list except the Range object.

Deletes the specified object.

expression.Delete

expression Required. An expression that returns one of the above objects.

Delete method as it applies to the Range object.

Deletes the specified object.

expression.Delete(Shift)

expression Required. An expression that returns one of the above objects.

Shift Optional
XlDeleteShiftDirection
. Used only with Range objects. Specifies how to shift cells to replace deleted cells.

XlDeleteShiftDirection can be one of these XlDeleteShiftDirection constants.

xlShiftToLeft

xlShiftUp If this argument is omitted, Microsoft Graph decides how to shift cells based on the shape of the specified range.

Remarks

Deleting a Point or LegendKey object deletes the entire series.

Example

This example deletes cells A1:D10 on the datasheet and shifts the remaining cells to the left.

Copy code Copy code
Set mySheet = myChart.Application.DataSheet
mySheet.Range("A1:D10").Delete Shift:=xlShiftToLeft

This example deletes the chart title.

Copy code Copy code
myChart.ChartTitle.Delete


DeleteChartAutoFormat Method

 Copy code hover
[image]

DeleteChartAutoFormat Method
Send feedback

Published: July 16, 2012

Removes a custom chart autoformat from the list of available chart autoformats.

expression.DeleteChartAutoFormat(Name)

expression Required. An expression that returns an Application object.

Name Required String. The name of the custom autoformat to be removed.

Example

This example deletes the custom autoformat named "Presentation Chart."

Copy code Copy code
myChart.Application.DeleteChartAutoFormat _
 name:="Presentation Chart"


DeleteReplacement Method

 Copy code hover
[image]

DeleteReplacement Method
Send feedback

Published: July 16, 2012

Deletes an entry from the array of AutoCorrect replacements.

expression.DeleteReplacement(What)

expression Required. An expression that returns an AutoCorrect object.

What Required String. The text to be replaced, as it appears in the row to be deleted from the array of AutoCorrect replacements. If this string doesn't exist in the array of AutoCorrect replacements, this method fails.

Example

This example removes the word "Temperature" from the array of AutoCorrect replacements.

Copy code Copy code
With myChart.Application.AutoCorrect
 .DeleteReplacement "Temperature"
End With


Deselect Method

 Copy code hover
[image]

Deselect Method
Send feedback

Published: July 16, 2012

Cancels the selection for the chart.

expression.Deselect

expression Required. An expression that returns a Chart object.

Example

This example is equivalent to pressing ESC while working on the chart. The example should be run on a chart that has a component (such as an axis) selected.

Copy code Copy code
myChart.Deselect


DoughnutGroups Method

 Copy code hover
[image]

DoughnutGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single doughnut chart group or a collection of the doughnut chart groups.

expression.DoughnutGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. Specifies the chart group.

Example

This example sets the starting angle for doughnut group one.

Copy code Copy code
myChart.DoughnutGroups(1).FirstSliceAngle = 45


ErrorBar Method

 Copy code hover
[image]

ErrorBar Method
Send feedback

Published: July 16, 2012

Applies error bars to the specified series. Variant.

expression.ErrorBar(Direction, Include, Type, Amount, MinusValues)

expression Required. An expression that returns one of the objects in the Applies To list.

DirectionRequired
XlErrorBarDirection
. The error bar direction.

XlErrorBarDirection can be one of these XlErrorBarDirection constants.

xlX Can only be used with scatter charts.

xlY default.

IncludeRequired
XlErrorBarInclude
. The error bar parts to be included.

XlErrorBarInclude can be one of these XlErrorBarInclude constants.

xlErrorBarIncludeBoth default.

xlErrorBarIncludeMinusValues

xlErrorBarIncludeNone

xlErrorBarIncludePlusValues

TypeRequired
XlErrorBarType
. The error bar type.

XlErrorBarType can be one of these XlErrorBarType constants.

xlErrorBarTypeCustom

xlErrorBarTypeFixedValue

xlErrorBarTypePercent

xlErrorBarTypeStDev

xlErrorBarTypeStError

Amount Optional Variant. The error amount. Used for only the positive error amount when Type is xlErrorBarTypeCustom.

MinusValues Optional Variant. The negative error amount when Type is xlErrorBarTypeCustom.

Example

This example applies standard error bars in the Y direction for series one. The error bars are applied in the positive and negative directions. The example should be run on a 2-D line chart.

Copy code Copy code
myChart.SeriesCollection(1).ErrorBar _
 Direction:=xlY, Include:=xlErrorBarIncludeBoth, _
 Type:=xlErrorBarTypeStError


Evaluate Method

 Copy code hover
[image]

Evaluate Method
Send feedback

Published: July 16, 2012

Converts a Microsoft Graph name to an object or a value.

expression.Evaluate(Name)

expression Required. An expression that returns a Microsoft Graph Application object.

Name Required String. The name of the specified object, using the Microsoft Graph naming convention.

Remarks

You can use the following types of names in Microsoft Graph with this method:

  • A1-style references. You can use any reference to a single cell in A1-style notation. All references are considered to be absolute references.

  • Ranges. You can use the range, intersect, and union operators (colon, space, and comma, respectively) with references.

  • Defined names. You can specify any name in the language of the macro.

Note Note

Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument. For example, the following expressions are equivalent:

Copy code Copy code
myChart.Application.[a1].Value = 25
myChart.Application.Evaluate("A1").Value = 25

The advantage of using square brackets is that the code is shorter. The advantage of using Evaluate is that the argument is a string, so you can either construct the string in your code or use a Visual Basic variable.

Example

This example clears cell A1 on the datasheet.

Copy code Copy code
clearCell = "A1"
myChart.Application.Evaluate(clearCell).Clear


Export Method

 Copy code hover
[image]

Export Method
Send feedback

Published: July 16, 2012

Exports the chart in a graphic format. Returns a value of type Boolean.

expression.Export(FileName, FilterName, Interactive)

expression Required. An expression that returns a Chart object.

FileName Required String. The name of the exported file.

FilterName Optional Variant. The language-independent name of the graphic filter as it appears in the registry.

Interactive Optional Variant. True to display the dialog box that contains the filter-specific options. If this argument is False, Microsoft Graph uses the default values for the filter. The default value is False.

Example

This example exports the chart as a GIF file.

Copy code Copy code
myChart.Export _
 FileName:="current_sales.gif", FilterName:="GIF"


FileImport Method

 Copy code hover
[image]

FileImport Method
Send feedback

Published: July 16, 2012

Imports a specified file or range, or an entire sheet of data.

expression.FileImport(FileName, Password, ImportRange, WorksheetName, OverwriteCells)

expression Required. An expression that returns an Application object.

FileName Required String. The file that contains the data to be imported.

Password Optional Variant. The password for the file to be imported, if the file is password protected.

ImportRange Optional Variant. The range of cells to be imported, if the file to be imported is a Microsoft Excel worksheet or workbook. If this argument is omitted, the complete contents of the worksheet are imported.

WorksheetName Optional Variant. The name of the worksheet to be imported, if the file to be imported is a Microsoft Excel workbook.

OverwriteCells Optional Variant. True to specify that the user be notified before imported data overwrites existing data on the specified datasheet. The default value is True.

Example

This example imports data from the range A2:D5 on the worksheet named "MySheet" in the Microsoft Excel workbook named "mynums.xls."

Copy code Copy code
With myChart.Application
 .FileImport FileName:="C:\mynums.xls", _
 ImportRange:="A2:D5", WorksheetName:="MySheet", _
 OverwriteCells:=False
End With


Insert Method

 Copy code hover
[image]

Insert Method
Send feedback

Published: July 16, 2012

Inserts a cell or a range of cells into the datasheet and shifts other cells away to make space.

expression.Insert(Shift)

expression Required. An expression that returns one of the objects in the Applies To list.

Shift Optional
XlInsertShiftDirection
. Specifies which way to shift the cells.

XlInsertShiftDirection can be one of these XlInsertShiftDirection constants.

xlShiftToRight

xlShiftDown If this argument is omitted, Microsoft Graph decides based on the shape of the range.

Example

This example inserts a new row before row four on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Rows(4).Insert

This example inserts new cells at the range A1:C5 on the datasheet and shifts cells downward.

Copy code Copy code
Set mySheet = myChart.Application.DataSheet
mySheet.Range("A1:C5").Insert Shift:=xlShiftDown


Item Method

 Copy code hover
[image]

Item Method
Send feedback

Published: July 16, 2012

Item method as it applies to the Axes object.

Returns a single Axis object from an Axes collection.

expression.Item(Type, AxisGroup)

expression Required. An expression that returns an Axes collection.

TypeRequired
XlAxisType
. The axis type.

XlAxisType can be one of these XlAxisType constants.

xlCategory

xlSeriesAxis Valid only for 3-D charts.

xlValue

AxisGroupOptional
XlAxisGroup
. The axis group.

XlAxisGroup can be one of these XlAxisGroup constants.

xlSecondary

xlPrimary default

Item method as it applies to the ChartGroups object.

Returns a single ChartGroup object from a ChartGroups collection.

expression.Item(Index)

expression Required. An expression that returns a ChartGroups collection.

IndexRequired Variant. The index number of the chart group.

Item method as it applies to the DataLabels object.

Returns a single DataLabel object from a DataLabels collection.

expression.Item(Index)

expression Required. An expression that returns a DataLabels collection.

IndexRequired Variant. The name or index number of the data label.

Item method as it applies to the LegendEntries object.

Returns a single LegendEntry object from a LegendEntries collection.

expression.Item(Index)

expression Required. An expression that returns a LegendEntries collection.

IndexRequired Variant. The index number of the legend entry.

Item method as it applies to the Points object.

Returns a single Point object from a Points collection.

expression.Item(Index)

expression Required. An expression that returns a Points collection.

IndexRequired Long. The index number of the point.

Item method as it applies to the SeriesCollection object.

Returns a single Series object from a SeriesCollection collection.

expression.Item(Index)

expression Required. An expression that returns a SeriesCollection collection.

IndexRequired Variant. The name or index number of the series.

Item method as it applies to the Trendlines object.

Returns a single Trendline object from a Trendlines collection.

expression.Item(Index)

expression Required. An expression that returns a Trendlines collection.

IndexOptional Variant. The name or index number of the trendline.

Example

As it applies to the Axes object.

This example sets the title text for the category axis on Chart1.

Copy code Copy code
With Charts("chart1").Axes.Item(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
End With

As it applies to the ChartGroups object.

This example adds drop lines to chart group one on chart sheet one.

Copy code Copy code
Charts(1).ChartGroups.Item(1).HasDropLines = True

As it applies to the DataLabels object.

This example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.

Copy code Copy code
Worksheets(1).ChartObjects(1).Chart _
 .SeriesCollection(1).DataLabels.Item(5).NumberFormat = "0.000"

As it applies to the LegendEntries object.

This example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one on Sheet1.

Copy code Copy code
Worksheets("sheet1").ChartObjects(1).Chart _
 .Legend.LegendEntries.Item(1).Font.Italic = True

As it applies to the Points object.

This example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2-D line, scatter, or radar series.

Copy code Copy code
Worksheets(1).ChartObjects(1).Chart. _
 SeriesCollection(1).Points.Item(3).MarkerStyle = xlDiamond

As it applies to the SeriesCollection object.

This example provides two lines of code that are equivalent:

Copy code Copy code
myChart.SeriesCollection.Item(1)
myChart.SeriesCollection(1)

As it applies to the Trendlines object.

This example sets the number of units that the trendline on Chart1 extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
With Charts("Chart1").SeriesCollection(1).Trendlines.Item(1)
 .Forward = 5
 .Backward = .5
End With


LegendEntries Method

 Copy code hover
[image]

LegendEntries Method
Send feedback

Published: July 16, 2012

Returns an object that represents either a single legend entry or a collection of legend entries for the legend.

expression.LegendEntries(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The number of the legend entry.

Example

This example sets the font for legend entry one.

Copy code Copy code
myChart.Legend.LegendEntries(1).Font.Name = "Arial"


LineGroups Method

 Copy code hover
[image]

LineGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single line chart group or a collection of the line chart groups.

expression.LineGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. Specifies the chart group.

Example

This example sets line group one to use a different color for each data marker. The example should be run on a 2-D chart.

Copy code Copy code
myChart.LineGroups(1).VaryByCategories = True


OneColorGradient Method

 Copy code hover
[image]

OneColorGradient Method
Send feedback

Published: July 16, 2012

Sets the specified fill to a one-color gradient.

expression.OneColorGradient(Style, Variant, Degree)

expression Required. An expression that returns one of the objects in the Applies To list.

StyleRequired
MsoGradientStyle
. The gradient style for the specified fill.

MsoGradientStyle can be one of these MsoGradientStyle constants.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientMixed

msoGradientVertical

VariantRequired Long. The gradient variant for the specified fill. Can be a value from 1 through 4, corresponding to the four variants listed on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.

DegreeRequired Single. The gradient degree for the specified fill. Can be a value from 0.0 (dark) through 1.0 (light).

Example

This example sets the chart's fill format.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientOneColor Then
 .OneColorGradient Style:=msoGradientFromCorner, _
 Variant:=1, Degree:=0.3
 End If
 End If
End With


Paste Method

 Copy code hover
[image]

Paste Method
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into the specified range on the datasheet.

expression.Paste(Link)

expression Required. An expression that returns a Range object.

Link Optional Variant. True to establish a link to the source of the pasted data. The default value is False.

Example

This example pastes the contents of the Clipboard into cell A1 on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Range("A1").Paste


Patterned Method

 Copy code hover
[image]

Patterned Method
Send feedback

Published: July 16, 2012

Sets a pattern for the specified fill.

expression.Patterned(Pattern)

expression Required. An expression that returns one of the objects in the Applies To list.

PatternRequired
MsoPatternType
. The type of pattern.

MsoPatternType can be one of these MsoPatternType constants.

msoPattern10Percent

msoPattern20Percent

msoPattern25Percent

msoPattern30Percent

msoPattern40Percent

msoPattern50Percent

msoPattern5Percent

msoPattern60Percent

msoPattern70Percent

msoPattern75Percent

msoPattern80Percent

msoPattern90Percent

msoPatternDarkDownwardDiagonal

msoPatternDarkHorizontal

msoPatternDarkUpwardDiagonal

msoPatternDarkVertical

msoPatternDashedDownwardDiagonal

msoPatternDashedHorizontal

msoPatternDashedUpwardDiagonal

msoPatternDashedVertical

msoPatternDiagonalBrick

msoPatternDivot

msoPatternDottedDiamond

msoPatternDottedGrid

msoPatternHorizontalBrick

msoPatternLargeCheckerBoard

msoPatternLargeConfetti

msoPatternLargeGrid

msoPatternLightDownwardDiagonal

msoPatternLightHorizontal

msoPatternLightUpwardDiagonal

msoPatternLightVertical

msoPatternMixed

msoPatternNarrowHorizontal

msoPatternNarrowVertical

msoPatternOutlinedDiamond

msoPatternPlaid

msoPatternShingle

msoPatternSmallCheckerBoard

msoPatternSmallConfetti

msoPatternSmallGrid

msoPatternSolidDiamond

msoPatternSphere

msoPatternTrellis

msoPatternWave

msoPatternWeave

msoPatternWideDownwardDiagonal

msoPatternWideUpwardDiagonal

msoPatternZigZag

Example

This example sets the fill pattern.

Copy code Copy code
With myChart.ChartArea.Fill
 .Patterned msoPatternDiagonalBrick
 .Visible = True
End With


PieGroups Method

 Copy code hover
[image]

PieGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single pie chart group or a collection of the pie chart groups.

expression.PieGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. Specifies the chart group.

Example

This example sets pie group one to use a different color for each data marker. The example should be run on a 2-D chart.

Copy code Copy code
myChart.PieGroups(1).VaryByCategories = True


Points Method

 Copy code hover
[image]

Points Method
Send feedback

Published: July 16, 2012

Returns an object that represents a single point or a collection of all the points in the series. Read-only.

expression.Points(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The name or number of the point.

Example

This example applies a data label to point one in series one.

Copy code Copy code
myChart.SeriesCollection(1).Points(1).ApplyDataLabels


PresetGradient Method

 Copy code hover
[image]

PresetGradient Method
Send feedback

Published: July 16, 2012

Sets the specified fill to a preset gradient.

expression.PresetGradient(Style, Variant, PresetGradientType)

expression Required. An expression that returns one of the objects in the Applies To list.

StyleRequired
MsoGradientStyle
. The gradient style for the specified fill.

MsoGradientStyle can be one of these MsoGradientStyle constants.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientMixed

msoGradientVertical

VariantRequired Long. The gradient variant for the specified fill. Can be a value from 1 through 4, corresponding to the four variants listed on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.

PresetGradientTypeRequired
MsoPresetGradientType
. The gradient type for the specified fill.

MsoPresetGradientType can be one of these MsoPresetGradientType constants.

msoGradientBrass

msoGradientChrome

msoGradientDaybreak

msoGradientEarlySunset

msoGradientFog

msoGradientGoldII

msoGradientLateSunset

msoGradientMoss

msoGradientOcean

msoGradientPeacock

msoGradientRainbowII

msoGradientSilver

msoGradientWheat

msoPresetGradientMixed

msoGradientCalmWater

msoGradientChromeII

msoGradientDesert

msoGradientFire

msoGradientGold

msoGradientHorizon

msoGradientMahogany

msoGradientNightfall

msoGradientParchment

msoGradientRainbow

msoGradientSapphire

Example

This example sets the chart's fill format to the preset brass color.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .PresetGradient msoGradientDiagonalDown, 3, msoGradientBrass
End With


PresetTextured Method

 Copy code hover
[image]

PresetTextured Method
Send feedback

Published: July 16, 2012

Sets the format of the specified fill to a preset texture.

expression.PresetTextured(PresetTexture)

expression Required. An expression that returns one of the objects in the Applies To list.

PresetTextureRequired
MsoPresetTexture
. The preset texture for the specified fill.

MsoPresetTexture can be one of these MsoPresetTexture constants.

msoPresetTextureMixed

msoTextureBouquet

msoTextureCanvas

msoTextureDenim

msoTextureGranite

msoTextureMediumWood

msoTextureOak

msoTexturePapyrus

msoTexturePinkTissuePaper

msoTextureRecycledPaper

msoTextureStationery

msoTextureWaterDroplets

msoTextureWovenMat

msoTextureBlueTissuePaper

msoTextureBrownMarble

msoTextureCork

msoTextureFishFossil

msoTextureGreenMarble

msoTextureNewsprint

msoTexturePaperBag

msoTextureParchment

msoTexturePurpleMesh

msoTextureSand

msoTextureWalnut

msoTextureWhiteMarble

Example

This example changes the chart's textured fill format from oak to walnut.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillTextured Then
 If .TextureType = msoTexturePreset Then
 If .PresetTexture = msoTextureOak Then
 .PresetTextured msoTextureWalnut
 End If
 End If
 End If
End With


Quit Method

 Copy code hover
[image]

Quit Method
Send feedback

Published: July 16, 2012

Quits Microsoft Graph.

expression.Quit

expression Required. An expression that returns an Application object.

Example

This example quits Microsoft Graph.

Copy code Copy code
myChart.Application.Quit


RadarGroups Method

 Copy code hover
[image]

RadarGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single radar chart group or a collection of the radar chart groups.

expression.RadarGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. Specifies the chart group.

Example

This example sets radar group one to use a different color for each data marker. The example should be run on a 2-D chart.

Copy code Copy code
myChart.RadarGroups(1).VaryByCategories = True


Refresh Method (Graph)

 Copy code hover
[image]

Refresh Method (Graph)
Send feedback

Published: July 16, 2012

Causes the specified chart to be redrawn immediately.

expression.Refresh

expression Required. An expression that returns a Chart object.

Example

This example refreshes the first chart in the application. This example assumes a chart exists in the application.

Copy code Copy code
Sub RefeshChart()

 Application.Charts(1).Refresh

End Sub


SaveAs Method

 Copy code hover
[image]

SaveAs Method
Send feedback

Published: July 16, 2012

Saves changes to the graph in a different file.

expression.SaveAs(FileName)

expression Required. An expression that returns one of the objects in the Applies To list.

FileNameRequired String. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.

Example

This example creates a new workbook, prompts the user for a file name, and then saves the workbook.

Copy code Copy code
Set NewBook = Workbooks.Add
Do
 fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.SaveAs Filename:=fName


SaveAsOldFileFormat Method

 Copy code hover
[image]

SaveAsOldFileFormat Method
Send feedback

Published: July 16, 2012

In a host application such as Microsoft PowerPoint, saves a chart in the specified older file format.

expression.SaveAsOldFileFormat(MajorVersion, MinorVersion)

expression Required. An expression that returns an Application object.

MajorVersion Optional Variant. Specifies the major version number of the file format you want to use.

MinorVersion Optional Variant. Specifies the minor version number of the file format you want to use.

Example

This example saves the chart in Microsoft Graph version 5.0 file format.

Copy code Copy code
myChart.Application.SaveAsOldFileFormat MajorVersion:=5


SeriesCollection Method

 Copy code hover
[image]

SeriesCollection Method
Send feedback

Published: July 16, 2012

Returns an object that represents either a single series or a collection of all the series in the chart or chart group.

expression.SeriesCollection(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The name or number of the series.

Example

This example turns on data labels for series one.

Copy code Copy code
myChart.SeriesCollection(1).HasDataLabels = True


SetDefaultChart Method

 Copy code hover
[image]

SetDefaultChart Method
Send feedback

Published: July 16, 2012

Specifies the name of the chart template that Microsoft Graph will use when creating new charts.

expression.SetDefaultChart(FormatName, Gallery)

expression Required. An expression that returns one of the objects in the Applies To list.

FormatName Optional Variant. The name of the specified custom autoformat. This name can be a string that denotes the custom autoformat, or it can be the special constant xlBuiltIn to specify the built-in chart template.

GalleryOptional Variant.

Example

This example sets the default chart template to the custom autoformat named "Monthly Sales."

Copy code Copy code
myChart.Application.SetDefaultChart FormatName:="Monthly Sales"


SetEchoOn Method

 Copy code hover
[image]

SetEchoOn Method
Send feedback

Published: July 16, 2012

Returns a Chart object.

expression.SetEchoOn(EchoOn)

expression Required. An expression that returns a Chart object.

EchoOnOptional Variant.

Example

This example sets the echo on for the first object in the application.

Copy code Copy code
Sub UseEchoOn()

 Dim grpOne As Graph.Chart

 Set grpOne = Application.ActiveSheet.OLEObjects(1).Object

 grpOne.SetEchoOn

End Sub


Solid Method

 Copy code hover
[image]

Solid Method
Send feedback

Published: July 16, 2012

Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.

expression.Solid

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example converts the chart area fill to a solid color.

Copy code Copy code
myChart.ChartArea.Fill.Solid


Trendlines Method

 Copy code hover
[image]

Trendlines Method
Send feedback

Published: July 16, 2012

Returns an object that represents a single trendline or a collection of all the trendlines for the series.

expression.Trendlines(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. The name or number of the trendline.

Example

This example adds a linear trendline to series one.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines.Add Type:=xlLinear


TwoColorGradient Method

 Copy code hover
[image]

TwoColorGradient Method
Send feedback

Published: July 16, 2012

Sets the specified fill to a two-color gradient.

expression.TwoColorGradient(Style, Variant)

expression Required. An expression that returns one of the objects in the Applies To list.

StyleRequired
MsoGradientStyle
. Specifies the gradient style.

MsoGradientStyle can be one of these MsoGradientStyle constants.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientMixed

msoGradientVertical

Variant Required Long. Specifies the gradient variant. Can be a value from 1 through 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be either 1 or 2.

Example

This example sets the gradient, background color, and foreground color for the chart area fill on the chart.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .ForeColor.SchemeColor = 15
 .BackColor.SchemeColor = 17
 .TwoColorGradient msoGradientHorizontal, 1
End With


Update Method

 Copy code hover
[image]

Update Method
Send feedback

Published: July 16, 2012

Updates the specified embedded object in the host file.

expression.Update

expression Required. An expression that returns an Application object.

Example

This example updates the application.

Copy code Copy code
Sub UseUpdate()

 Application.Update

End Sub


UserPicture Method

 Copy code hover
[image]

UserPicture Method
Send feedback

Published: July 16, 2012

Fills the specified shape with an image.

expression.UserPicture(PictureFile, PictureFormat, PictureStackUnit, PicturePlacement)

expression Required. An expression that returns one of the objects in the Applies To list.

PictureFile Required Variant. The name of the specified picture file.

PictureFormat Optional
XlChartPictureType
. The format of the specified picture.

XlChartPictureType can be one of these XlChartPictureType constants.

xlScale

xlStackScalexlStackxlStretch

PictureStackUnit Optional Variant. The stack or scale unit for the specified picture (depends on the PictureFormat argument).

PicturePlacement Optional
XlChartPicturePlacement
. The placement of the specified picture.

XlChartPicturePlacement can be one of these XlChartPicturePlacement constants.

xlSides

xlEndxlEndSidesxlFrontxlFrontSidesxlFrontEndxlAllFaces

Example

This example sets the chart's fill format so that it's based on a user-supplied picture.

Copy code Copy code
With myChart.ChartArea.Fill
 .UserPicture PictureFile:="C:\My Documents\brick.bmp"
 .Visible = True
End With


UserTextured Method

 Copy code hover
[image]

UserTextured Method
Send feedback

Published: July 16, 2012

Fills the specified shape with small tiles of an image. If you want to fill the shape with one large image, use the UserPicture method.

expression.UserTextured(TextureFile)

expression Required. An expression that returns a ChartFillFormat object.

TextureFile Required String. The name of the specified picture file.

Example

This example changes the user-defined texture type for the chart's fill format.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillTextured Then
 If .TextureType = msoTextureUserDefined Then
 If .TextureName = "C:\brick.bmp" Then
 .UserTextured "C:\stone.bmp"
 End If
 End If
 End If
End With


XYGroups Method

 Copy code hover
[image]

XYGroups Method
Send feedback

Published: July 16, 2012

On a 2-D chart, returns an object that represents either a single scatter chart group or a collection of the scatter chart groups.

expression.XYGroups(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Optional Variant. Specifies the chart group.

Example

This example sets X-Y group (scatter group) one to use a different color for each data marker. The example should be run on a 2-D chart.

Copy code Copy code
myChart.XYGroups(1).VaryByCategories = True


Properties (Graph Visual Basic reference)

 Copy code hover
[image]

Properties (Graph Visual Basic reference)
Send feedback

Published: July 16, 2012

This section provides reference information about the properties in the Microsoft Graph object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar button [image] in the Help window. Click a topic in the table of contents to view it.

If Connected to Office.com appears in the lower-right corner of the Help window, you are searching Help from the Office Web site. If Offline appears, you are searching Help from the files stored on your computer.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents located to the left of the topic to navigate through the documentation.


Application Property

 Copy code hover
[image]

Application Property
Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Graph application. Read-only Application object.

expression.Application

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

Copy code Copy code
With myChart.Application.AutoCorrect
 .AddReplacement "Temperature", "Temp."
End With


ApplyPictToEnd Property

 Copy code hover
[image]

ApplyPictToEnd Property
Send feedback

Published: July 16, 2012

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.

expression.ApplyPictToEnd

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example applies pictures to the end of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

Copy code Copy code
myChart.SeriesCollection(1).ApplyPictToEnd = True


ApplyPictToFront Property

 Copy code hover
[image]

ApplyPictToFront Property
Send feedback

Published: July 16, 2012

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.

expression.ApplyPictToFront

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example applies pictures to the front of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

Copy code Copy code
myChart.SeriesCollection(1).ApplyPictToFront = True


ApplyPictToSides Property

 Copy code hover
[image]

ApplyPictToSides Property
Send feedback

Published: July 16, 2012

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.

Example

This example applies pictures to the sides of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

Copy code Copy code
myChart.SeriesCollection(1).ApplyPictToSides = True


Area3DGroup Property

 Copy code hover
[image]

Area3DGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the specified area chart group on a 3-D chart. Read-only ChartGroup object.

expression.Area3DGroup

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example turns on drop lines for the 3-D area chart group.

Copy code Copy code
myChart.Area3DGroup.HasDropLines = True


AutoCorrect Property

 Copy code hover
[image]

AutoCorrect Property
Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that represents the Microsoft Graph AutoCorrect attributes. Read-only.

Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

Copy code Copy code
With myChart.Application.AutoCorrect
 .AddReplacement "Temperature", "Temp."
End With


AutoScaleFont Property

 Copy code hover
[image]

AutoScaleFont Property
Send feedback

Published: July 16, 2012

True if the text in the object changes font size when the object size changes. The default value is True. Read/write Variant.

Example

This example adds a title to the chart, and it causes the title font to remain the same size whenever the chart size changes.

Copy code Copy code
With myChart
 .HasTitle = True
 .ChartTitle.Text = "1996 sales"
 .ChartTitle.AutoScaleFont = False
End With


AutoScaling Property

 Copy code hover
[image]

AutoScaling Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.

expression.AutoScaling

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example automatically scales the chart. The example should be run on a 3-D chart.

Copy code Copy code
With myChart
 .RightAngleAxes = True
 .AutoScaling = True
End With


AutoText Property

 Copy code hover
[image]

AutoText Property
Send feedback

Published: July 16, 2012

True if the object automatically generates appropriate text based on context. Read/write Boolean.

Example

This example sets the data labels for series one to automatically generate appropriate text.

Copy code Copy code
myChart.SeriesCollection(1).DataLabels.AutoText = True


AxisBetweenCategories Property

 Copy code hover
[image]

AxisBetweenCategories Property
Send feedback

Published: July 16, 2012

True if the value axis crosses the category axis between categories. Read/write Boolean.

expression.AxisBetweenCategories

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property applies only to category axes, and it doesn't apply to 3-D charts.

Example

This example causes the value axis to cross the category axis between categories.

Copy code Copy code
myChart.Axes(xlCategory).AxisBetweenCategories = True


AxisGroup Property

 Copy code hover
[image]

AxisGroup Property
Send feedback

Published: July 16, 2012

AxisGroup property as it applies to the ChartGroup and Series objects.

Returns the group for the specified chart group or series. Read/write XlAxisGroup .

XlAxisGroup can be one of these XlAxisGroup constants.

xlPrimary

xlSecondary

expression.AxisGroup

expression Required. An expression that returns one of the above objects.

AxisGroup property as it applies to the Axis object.

Returns the group for the specified axis. Read-only XlAxisGroup .

XlAxisGroup can be one of these XlAxisGroup constants.

xlPrimary

xlSecondary

expression.AxisGroup

expression Required. An expression that returns one of the above objects.

Remarks

For 3-D charts, only xlPrimary is valid.

Example

This example deletes the value axis if it's in the secondary group.

Copy code Copy code
With myChart.Axes(xlValue)
 If .AxisGroup = xlSecondary Then .Delete
End With


AxisTitle Property

 Copy code hover
[image]

AxisTitle Property
Send feedback

Published: July 16, 2012

Returns an AxisTitle object that represents the title of the specified axis. Read-only AxisTitle object.

expression.AxisTitle

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example adds an axis label to the category axis in myChart.

Copy code Copy code
With myChart.Axes(xlCategory)
    .HasTitle = True
    .AxisTitle.Text = "July Sales"
End With


BackColor Property (Graph)

 Copy code hover
[image]

BackColor Property (Graph)
Send feedback

Published: July 16, 2012

Returns a ChartColorFormat object that represents the fill background color.

Example

This example sets the gradient, background color, and foreground color for the chart area fill.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .ForeColor.SchemeColor = 15
 .BackColor.SchemeColor = 17
 .TwoColorGradient msoGradientHorizontal, 1
End With


Background Property

 Copy code hover
[image]

Background Property
Send feedback

Published: July 16, 2012

Returns or sets the text background type. This property is used only for text on charts. Read/write
XlBackground
.

XlBackground can be one of these XlBackground constants.

xlBackgroundAutomatic

xlBackgroundOpaquexlBackgroundTransparent

expression.Background

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example adds a chart title and then sets the font size and background type for the title.

Copy code Copy code
With myChart
 .HasTitle = True
 .ChartTitle.Text = "1995 Rainfall Totals by Month"
 With .ChartTitle.Font
 .Size = 10
 .Background = xlBackgroundTransparent
 End With
End With


Backward Property

 Copy code hover
[image]

Backward Property
Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Long.

Example

This example sets the number of units that the trendline extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 .Forward = 5
 .Backward = .5
End With


Bar3DGroup Property

 Copy code hover
[image]

Bar3DGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the specified bar chart group on a 3-D chart. Read-only.

Example

This example sets the space between bar clusters in the 3-D bar chart group to be 50 percent of the bar width.

Copy code Copy code
myChart.BarGroup3DGroup.GapWidth = 50


BarShape Property

 Copy code hover
[image]

BarShape Property
Send feedback

Published: July 16, 2012

Returns or sets the shape used with the specified 3-D bar or column chart. Read/write XlBarShape .

XlBarShape can be one of these XlBarShape constants.

xlConeToMax

xlCylinder

xlPyramidToPoint

xlBox

xlConeToPoint

xlPyramidToMax

expression.BarShape

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the shape used with series one on the chart.

Copy code Copy code
myChart.SeriesCollection(1).BarShape = xlConeToPoint


BaseUnit Property

 Copy code hover
[image]

BaseUnit Property
Send feedback

Published: July 16, 2012

Returns or sets the base unit for the specified category axis Read/write XlTimeUnit .

XlTimeUnit can be one of these XlTimeUnit constants.

xlDays

xlMonths

xlYears

expression.BaseUnit

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Setting this property has no visible effect if the CategoryType property for the specified axis is set to xlCategoryScale. The set value is retained, however, and takes effect when the CategoryType property is set to xlTimeScale.

You cannot set this property for a value axis.

Example

This example sets the category axis on the chart to use a time scale, with months as the base unit.

Copy code Copy code
With myChart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnit = xlMonths
 End With
End With


BaseUnitIsAuto Property

 Copy code hover
[image]

BaseUnitIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph chooses appropriate base units for the specified category axis. The default value is True. Read/write Boolean.

expression.BaseUnitIsAuto

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

You cannot set this property for a value axis.

Example

This example sets the category axis on the chart to use a time scale with automatic base units.

Copy code Copy code
With myChart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnitIsAuto = True
 End With
End With


Bold Property

 Copy code hover
[image]

Bold Property
Send feedback

Published: July 16, 2012

True if the font style is bold. Read/write Variant.

expression.Bold

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the font style to bold for the chart title.

Copy code Copy code
myChart.ChartTitle.Font.Bold = True


Border Property

 Copy code hover
[image]

Border Property
Send feedback

Published: July 16, 2012

Returns a Border object that represents the border of the specified object. Read-only Border object.

expression.Border

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the color of the chart area border to red.

Copy code Copy code
myChart.ChartArea.Border.ColorIndex = 3


BubbleScale Property

 Copy code hover
[image]

BubbleScale Property
Send feedback

Published: July 16, 2012

Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. Read/write Long.

expression.BubbleScale

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the bubble size in chart group one to 200 percent of the default size.

Copy code Copy code
With myChart
 .ChartGroups(1).BubbleScale = 200
End With


CapitalizeNamesOfDays Property

 Copy code hover
[image]

CapitalizeNamesOfDays Property
Send feedback

Published: July 16, 2012

True if the first letter of day names is capitalized automatically. Read/write Boolean.

expression.CapitalizeNamesOfDays

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets Microsoft Graph to capitalize the first letter of the names of days.

Copy code Copy code
With myChart.Application.AutoCorrect
 .CapitalizeNamesOfDays = True
 .ReplaceText = True
End With


Caption Property (Graph)

 Copy code hover
[image]

Caption Property (Graph)
Send feedback

Published: July 16, 2012

Returns or sets the title text for the object. Read/write String.

expression.Caption

expression Required. An expression that returns one of the above objects.

Example

This example adds the title "Annual Salary Figures" to the chart.

Copy code Copy code
myChart.HasTitle = True
myChart.ChartTitle.Caption = "Annual Salary Figures"


CategoryType Property

 Copy code hover
[image]

CategoryType Property
Send feedback

Published: July 16, 2012

Returns or sets the category axis type. Read/write XlCategoryType .

XlCategoryType can be one of these XlCategoryType constants.

xlCategoryScale

xlAutomaticScale

xlTimeScale

expression.CategoryType

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

You cannot set this property for a value axis.

Example

This example sets the category axis on the chart to use a time scale, with months as the base unit.

Copy code Copy code
With myChart
 With .Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnit = xlMonths
 End With
End With


CellDragAndDrop Property

 Copy code hover
[image]

CellDragAndDrop Property
Send feedback

Published: July 16, 2012

True if dragging and dropping cells is enabled. Read/write Boolean.

Example

This example enables dragging and dropping cells.

Copy code Copy code
myChart.Application.CellDragAndDrop = True


Cells Property

 Copy code hover
[image]

Cells Property
Send feedback

Published: July 16, 2012

Returns a Range object that represents the cells in the specified range, as it applies to the Range object. Also, returns a Range object that represents all the cells on the datasheet (not just the cells that are currently in use), as it applies to the DataSheet object. Read-only Range object.

expression.Cells

expression Required. An expression that returns an object in the Applies To List.

Example

This example clears the formula in cell A1 on the datasheet. Note that on the datasheet, column A is the second column and row 1 is the second row.

Copy code Copy code
myChart.Application.DataSheet.Cells(2,2).ClearContents

This example loops through cells A1:I3 on the datasheet. If any of these cells contains a value less than 0.001, the example replaces that value with 0 (zero).

Copy code Copy code
Set mySheet = myChart.Application.DataSheet
For rwIndex = 2 to 4
 For colIndex = 2 to 10
 If mySheet.Cells(rwIndex, colIndex) < .001 Then
 mySheet.Cells(rwIndex, colIndex).Value = 0
 End If
 Next colIndex
Next rwIndex


ChartArea Property

 Copy code hover
[image]

ChartArea Property
Send feedback

Published: July 16, 2012

Returns a ChartArea object that represents the complete chart area for the chart. Read-only.

Example

This example sets the chart area interior color of myChart to red and sets the border color to blue.

Copy code Copy code
With myChart.ChartArea
    .Interior.ColorIndex = 3
    .Border.ColorIndex = 5
End With


ChartTitle Property

 Copy code hover
[image]

ChartTitle Property
Send feedback

Published: July 16, 2012

Returns a ChartTitle object that represents the title of the specified chart. Read-only.

Example

This example sets the text for the title of the chart.

Copy code Copy code
With myChart
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With


ChartType Property

 Copy code hover
[image]

ChartType Property
Send feedback

Published: July 16, 2012

Returns or sets the chart type. Read/write XlChartType .

XlChartType can be one of these XlChartType constants.

xl3DArea. 3-D Area

xl3DAreaStacked. 3-D Stacked Area

xl3DAreaStacked100. 3-D Stacked Area

xl3DBarClustered. 3-D Clustered Bar

xl3DBarStacked. 3-D Stacked Bar

xl3DBarStacked100. 3-D 100% Stacked Bar

xl3DColumn. 3-D Column

xl3DColumnClustered. 3-D Clustered Column

xl3DColumnStacked. 3-D Stacked Column

xl3DColumnStacked100. 3-D 100% Stacked Column

xl3DLine. 3-D Line

xl3DPie. 3-D Pie

xl3DPieExploded. Exploded 3-D Pie

xlArea. Area

xlAreaStacked. Stacked Area

xlAreaStacked100. 100% Stacked Area

xlBarClustered. Clustered Bar

xlBarOfPie. Bar of Pie

xlBarStacked. Stacked Bar

xlBarStacked100. 100% Stacked Bar

xlBubble. Bubble

xlBubble3DEffect. Bubble with 3-D Effects

xlColumnClustered. Clustered Column

xlColumnStacked. Stacked Column

xlColumnStacked100. 100% Stacked Column

xlConeBarClustered. Clustered Cone Bar

xlConeBarStacked. Stacked Cone Bar

xlConeBarStacked100. 100% Stacked Cone Bar

xlConeCol. 3-D Cone Column

xlConeColClustered. Clustered Cone Column

xlConeColStacked. Stacked Cone Column

xlConeColStacked100. 100% Stacked Cone Column

xlCylinderBarStacked. Stacked Cylinder Bar

xlCylinderCol. 3-D Cylinder Column

xlCylinderColStacked. Stacked Cylinder Column

xlCylinderBarClustered. Clustered Cylinder Bar

xlCylinderBarStacked100. 100% Stacked Cylinder Bar

xlCylinderColClustered. Clustered Cylinder Column

xlCylinderColStacked100. 100% Stacked Cylinder Column

xlDoughnut. Doughnut

xlDoughnutExploded. Exploded Doughnut

xlLineMarkers. Line with Data Markers

xlLineMarkersStacked100. 100% Stacked Line with Markers

xlLineStacked100. 100% Stacked Line

xlLine. Line

xlLineMarkersStacked. Stacked Line with Data Markers

xlLineStacked. Stacked Line

xlPie. Pie

xlPieExploded. Exploded Pie

xlPieOfPie. Pie of Pie

xlPyramidBarClustered. Clustered Pyramid Bar

xlPyramidBarStacked. Stacked Pyramid Bar

xlPyramidBarStacked100. 100% Stacked Pyramid Bar

xlPyramidCol. 3-D Pyramid Column

xlPyramidColStacked. Stacked Pyramid Column

xlPyramidColClustered. Clustered Pyramid Column

xlPyramidColStacked100. 100% Stacked Pyramid Column

xlRadar. Radar

xlRadarFilled. Filled Radar

xlRadarMarkers. Radar with Data Markers

xlStockHLC. High-Low-Close

xlStockOHLC. Open-High-Low-Close

xlStockVHLC. Volume-High-Low-Close

xlStockVOHLC. Volume-Open-High-Low-Close

xlSurface. 3-D Surface

xlSurfaceTopView. Surface (Top View)

xlSurfaceTopViewWireframe. Surface (Top View wire-frame)

xlSurfaceWireframe. 3-D Surface(wire-frame)

xlXYScatter. Scatter

xlXYScatterLines. Scatter with Lines

xlXYScatterLinesNoMarkers. Scatter with Lines and No Data Markers

xlXYScatterSmooth. Scatter with SmoothedLines

xlXYScatterSmoothNoMarkers. Scatter with Smoothed Lines and No Data Markers

expression.ChartType

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the bubble size in chart group one to 200 percent of the default size if the chart is a 2-D bubble chart.

Copy code Copy code
With myChart
 If .ChartType = xlBubble Then
 .ChartGroups(1).BubbleScale = 200
 End If
End With


Color Property

 Copy code hover
[image]

Color Property
Send feedback

Published: July 16, 2012

Returns or sets the primary color of the Border object, Font object, or the Interior object. Use the RGB function to create a color value. Read/write Variant.

expression.Color

expression Required. An expression that returns an object in the Applies To List.

Example

This example sets the color of the tick-mark labels on the value axis.

Copy code Copy code
myChart.Axes(xlValue).TickLabels.Font.Color = RGB(0, 255, 0)


ColorIndex Property

 Copy code hover
[image]

ColorIndex Property
Send feedback

Published: July 16, 2012

Returns or sets the color of the border, font or interior, as shown in the following table. The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Variant.

Object | Description
Border | The color of the border.
Font | The color of the font.
Interior | The color of the interior fill. Set ColorIndex to xlColorIndexNone to specify that you don't want an interior fill. Set ColorIndex to xlColorIndexAutomatic to specify the automatic fill (for drawing objects).

expression.ColorIndex

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property specifies a color as an index into the color palette. The following illustration shows the color-index values in the default color palette.

Example

The following examples assume that you're using the default color palette.

This example sets the color of the major gridlines for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 If .HasMajorGridlines Then
 'Set color to blue
 .MajorGridlines.Border.ColorIndex = 5
 End If
End With

This example sets the color of the chart area interior to red and sets the border color to blue.

Copy code Copy code
With myChart.ChartArea
 .Interior.ColorIndex = 3
 .Border.ColorIndex = 5
End With


Colors Property

 Copy code hover
[image]

Colors Property
Send feedback

Published: July 16, 2012

Returns or sets colors in the palette for a Chart object. The palette has 56 entries, each represented by an RGB value. Read/write Variant.

expression.Colors(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

IndexOptional Variant. The color number (from 1 to 56). If this argument isn't specified, this method returns an array that contains all 56 of the colors in the palette.

Example

This example sets color five in the color palette for the active chart.

Copy code Copy code
ActiveChart.Colors(5) = RGB(255, 0, 0)


Column3DGroup Property

 Copy code hover
[image]

Column3DGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the specified column chart group on a 3-D chart. Read-only ChartGroup object.

expression.Column3DGroup

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the space between column clusters in the 3-D column chart group to be 50 percent of the column width.

Copy code Copy code
myChart.Column3DGroup.GapWidth = 50


Columns Property

 Copy code hover
[image]

Columns Property
Send feedback

Published: July 16, 2012

Returns a Range object that represents the columns in the specified range or all the columns on the datasheet. Read-only Range object.

expression.Range

expression Required. An expression that returns an object in the Applies To List.

For information about returning a single member of a collection, see Returning an Object from a Collection .

Example

This example clears column A of the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Columns(2).ClearContents


ColumnWidth Property

 Copy code hover
[image]

ColumnWidth Property
Send feedback

Published: July 16, 2012

Returns or sets the width of all columns in the specified range. Read/write Variant.

expression.ColumnWidth

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

If all columns in the range have the same width, the ColumnWidth property returns the width. If columns in the range have different widths, this property returns Null.

Example

This example doubles the width of column A on the datasheet.

Copy code Copy code
With myChart.Application.DataSheet.Columns("A")
 .ColumnWidth = .ColumnWidth * 2
End With


CommandBars Property

 Copy code hover
[image]

CommandBars Property
Send feedback

Published: July 16, 2012

Returns a CommandBars object that represents the Microsoft Graph command bars. Read-only CommandBars object.

expression.CommandBars

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example deletes all custom command bars that aren't visible.

Copy code Copy code
For Each bar In myChart.Application.CommandBars
 If Not bar.BuiltIn And Not bar.Visible Then bar.Delete
Next


Corners Property

 Copy code hover
[image]

Corners Property
Send feedback

Published: July 16, 2012

Returns a Corners object that represents the corners of the specified 3-D chart. Read-only.


CorrectCapsLock Property

 Copy code hover
[image]

CorrectCapsLock Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph automatically corrects accidental use of the CAPS LOCK key. Read/write Boolean.

Example

This example enables Microsoft Graph to automatically correct accidental use of the CAPS LOCK key.

Copy code Copy code
myChart.Application.AutoCorrect.CorrectCapsLock = True


CorrectSentenceCap Property

 Copy code hover
[image]

CorrectSentenceCap Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph automatically corrects sentence (first word) capitalization. Read/write Boolean.

Example

This example enables Microsoft Graph to automatically correct sentence capitalization.

Copy code Copy code
myChart.Application.AutoCorrect.CorrectSentenceCap = True


Count Property (Graph)

 Copy code hover
[image]

Count Property (Graph)
Send feedback

Published: July 16, 2012

Returns the number of objects in the specified collection. Read-only Long.

Example

This example displays the number of chart groups in the chart.

Copy code Copy code
MsgBox "The chart contains " & _
 myChart.ChartGroups.Count & _
 " chart groups."


Creator Property

 Copy code hover
[image]

Creator Property
Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. If the object was created in Microsoft Graph, this property returns the string MSGR, which is equivalent to the hexadecimal number 4D534752. Read-only XlCreator.

XlCreator can be one of these XlCreator constants.

xlCreatorCode

expression.Creator

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example displays a message about the creator of myChart.

Copy code Copy code
If myChart.Creator = &h4D534752 Then
    MsgBox "This is a Microsoft Graph object"
Else
    MsgBox "This is not a Microsoft Graph object"
End If


Crosses Property

 Copy code hover
[image]

Crosses Property
Send feedback

Published: July 16, 2012

Returns or sets the point on the specified axis where the other axis crosses. Read/write XlAxisCrosses .

XlAxisCrosses can be one of these XlAxisCrosses constants.

xlAxisCrossesCustom. The CrossesAt property specifies the axis crossing point.

xlAxisCrossesMinimum. The axis crosses at the minimum value.

xlAxisCrossesAutomatic. Microsoft Graph sets the axis crossing point.

xlAxisCrossesMaximum. The axis crosses at the maximum value.

expression.Crosses

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property isn't available for radar charts. For 3-D charts, this property indicates where the plane defined by the category axis crosses the value axis.

This property can be used for both category and value axes. On the category axis, xlMinimum sets the value axis to cross at the first category, and xlMaximum sets the value axis to cross at the last category.

Note that xlMinimum and xlMaximum can have different meanings, depending on the axis.

Example

This example sets the value axis to cross the category axis at the maximum x value.

Copy code Copy code
myChart.Axes(xlCategory).Crosses = xlMaximum


CrossesAt Property

 Copy code hover
[image]

CrossesAt Property
Send feedback

Published: July 16, 2012

Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.

Remarks

Setting this property causes the Crosses property to change to xlAxisCrossesCustom.

This property cannot be used on 3-D charts or radar charts.

Example

This example sets the category axis in the ActiveChart to cross the value axis at value 3.

Copy code Copy code
Sub Chart()

 ' Create a sample source of data.
 Range("A1") = "2"
 Range("A2") = "4"
 Range("A3") = "6"
 Range("A4") = "3"

 ' Create a chart based on the sample source of data.
 Charts.Add
Copy code Copy code
 With ActiveChart
 .ChartType = xlLineMarkersStacked
 .SetSourceData Source:=Sheets("Sheet1").Range("A1:A4"), PlotBy:= xlColumns
 .Location Where:=xlLocationAsObject, Name:="Sheet1"
 End With
Copy code Copy code
Copy code Copy code
 ' Set the category axis to cross the value axis at value 3.
 ActiveChart.Axes(xlValue).Select
 Selection.CrossesAt = 3
Copy code Copy code
Copy code Copy code
End Sub


DataLabel Property

 Copy code hover
[image]

DataLabel Property
Send feedback

Published: July 16, 2012

Returns a DataLabel object that represents the data label associated with the specified point or trendline. Read-only.

Example

This example turns on the data label for point seven in series three, and then it sets the data label color to blue.

Copy code Copy code
With myChart.SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels type:=xlValue
 .DataLabel.Font.ColorIndex = 5
End With


DataSheet Property

 Copy code hover
[image]

DataSheet Property
Send feedback

Published: July 16, 2012

Returns the DataSheet object. Read-only.

Example

This example sets the value of cell A1 on the datasheet to 3.14159.

Copy code Copy code
With myChart.Application
 .DataSheet.Range("A1").Value = 3.14159
End With


DataTable Property

 Copy code hover
[image]

DataTable Property
Send feedback

Published: July 16, 2012

Returns a DataTable object that represents the chart data table. Read-only.

Example

This example adds a data table with an outline border to the chart.

Copy code Copy code
With myChart
 .HasDataTable = True
 .DataTable.HasBorderOutline = True
End With


DepthPercent Property

 Copy code hover
[image]

DepthPercent Property
Send feedback

Published: July 16, 2012

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.

Example

This example sets the depth of the chart to be 50 percent of its width. The example should be run on a 3-D chart (the DepthPercent property fails on 2-D charts).

Copy code Copy code
myChart.DepthPercent = 50


DisplayAlerts Property

 Copy code hover
[image]

DisplayAlerts Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph displays certain alerts and messages while a macro is running. Read/write Boolean.

Remarks

The default value is True. Set this property to False if you don't want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Graph chooses the default response.

If you set this property to False, Microsoft Graph doesn't automatically set it back to True when your macro stops running. Write your macro such that it always sets this property back to True when it stops running.


DisplayAutoCorrectOptions Property

 Copy code hover
[image]

DisplayAutoCorrectOptions Property
Send feedback

Published: July 16, 2012

Allows the user to display or hide the AutoCorrect Options button. The default value is True. Read/write Boolean.

expression.DisplayAutoCorrectOptions

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The DisplayAutoCorrectOptions property is a Microsoft Office-wide setting. Changing this property in Microsoft Graph will affect the other Office applications also.

Example

This example determines if the AutoCorrect Options button can be displayed and notifies the user.

Copy code Copy code
Sub CheckDisplaySetting()

 'Determine setting and notify user.
 If Application.AutoCorrect.DisplayAutoCorrectOptions = True Then
 MsgBox "The AutoCorrect Options button can be displayed."
 Else
 MsgBox "The AutoCorrect Options button cannot be displayed."
 End If

End Sub


DisplayBlanksAs Property

 Copy code hover
[image]

DisplayBlanksAs Property
Send feedback

Published: July 16, 2012

Returns or sets the way that blank cells are plotted on a chart. Read/write XlDisplayBlanksAs .

XlDisplayBlanksAs can be one of these XlDisplayBlanksAs constants.

xlInterpolated

xlNotPlotted

xlZero

expression.DisplayBlanksAs

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets Microsoft Graph to not plot blank cells.

Copy code Copy code
myChart.DisplayBlanksAs = xlNotPlotted


DisplayEquation Property

 Copy code hover
[image]

DisplayEquation Property
Send feedback

Published: July 16, 2012

True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. Read/write Boolean.

Example

This example displays the R-squared value and equation for trendline one. The example should be run on a 2-D column chart that has a trendline for the first series.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
End With


DisplayRSquared Property

 Copy code hover
[image]

DisplayRSquared Property
Send feedback

Published: July 16, 2012

True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. Read/write Boolean.

Example

This example displays the R-squared value and equation for trendline one. The example should be run on a 2-D column chart that has a trendline for the first series.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
End With


DisplayUnit Property

 Copy code hover
[image]

DisplayUnit Property
Send feedback

Published: July 16, 2012

Returns or sets the units displayed for the value axis in the specified chart. If the value is xlCustom, the DisplayUnitCustom property returns or sets the value of the units displayed for the value axis. Read/write XlDisplayUnit .

XlDisplayUnit can be one of these XlDisplayUnit constants.

xlHundredMillions

xlHundreds

xlHundredThousands

xlMillionMillions

xlMillions

xlTenMillions

xlTenThousands

xlThousandMillions

xlThousands

expression.DisplayUnit

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Using unit labels for the value axis when charting large values makes the incremental labels on the axis more readable and the data easier to track. In other words, if you label your value axis in thousands (for example), you can use smaller numeric values next to the tick marks on the axis.

Example

This example sets the units displayed on the value axis in myChart to hundreds.

Copy code Copy code
With myChart.Axes(xlValue)
 .DisplayUnit = xlHundreds
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
End With


DisplayUnitCustom Property

 Copy code hover
[image]

DisplayUnitCustom Property
Send feedback

Published: July 16, 2012

If the value returned or set by the DisplayUnit property is xlCustom, the DisplayUnitCustom property returns or sets the value of the units displayed for the value axis in the specified chart. The value must be a number from 0 through 10E307. Read/write Double.

Remarks

Using unit labels for the value axis when charting large values makes the incremental labels on the axis more readable and the data easier to track. In other words, if you label your value axis in thousands (for example), you can use smaller numeric values next to the tick marks on the axis.

Example

This example sets the units displayed on the value axis in myChart to increments of 500.

Copy code Copy code
With myChart.Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
End With


DisplayUnitLabel Property

 Copy code hover
[image]

DisplayUnitLabel Property
Send feedback

Published: July 16, 2012

Returns the DisplayUnitLabel object for the value axis in the specified chart. Returns Null if the HasDisplayUnitLabel property is False. Read-only.

Example

This example sets the caption for the value axis in myChart to "Millions" and turns off automatic font scaling.

Copy code Copy code
With myChart.Axes(xlValue).DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
End With


DoughnutHoleSize Property

 Copy code hover
[image]

DoughnutHoleSize Property
Send feedback

Published: July 16, 2012

Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. Read/write Long.

Example

This example sets the hole size for doughnut group one. The example should be run on a 2-D doughnut chart.

Copy code Copy code
myChart.DoughnutGroups(1).DoughnutHoleSize = 10


DownBars Property

 Copy code hover
[image]

DownBars Property
Send feedback

Published: July 16, 2012

Returns a DownBars object that represents the down bars on a line chart. Applies only to line charts. Read-only.

Example

This example turns on up bars and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart that has two series that cross each other at one or more data points.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With


DropLines Property

 Copy code hover
[image]

DropLines Property
Send feedback

Published: July 16, 2012

Returns a DropLines object that represents the drop lines for a series on a line chart or area chart. Applies only to line charts or area charts. Read-only.

Example

This example turns on drop lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


Elevation Property

 Copy code hover
[image]

Elevation Property
Send feedback

Published: July 16, 2012

Returns or sets the elevation of the 3-D chart view, in degrees. Read/write Long.

Remarks

The chart elevation is the height at which you view the chart, in degrees. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.

Example

This example sets the chart elevation to 34 degrees. The example should be run on a 3-D chart (the Elevation property fails on 2-D charts).

Copy code Copy code
myChart.Elevation = 34


EndStyle Property

 Copy code hover
[image]

EndStyle Property
Send feedback

Published: July 16, 2012

Returns or sets the end style for the error bars. Read/write XlEndStyleCap.

XlEndStyleCap can be one of these XlEndStyleCap constants.

xlCap

xlNoCap

expression. EndStyle

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the end style for the error bars for series one. The example should be run on a 2-D line chart that has Y error bars for the first series.

Copy code Copy code
myChart.SeriesCollection(1).ErrorBars. EndStyle = xlCap


ErrorBars Property

 Copy code hover
[image]

ErrorBars Property
Send feedback

Published: July 16, 2012

Returns an ErrorBars object that represents the error bars for the series. Read-only.

Example

This example sets the error bar color for series one. The example should be run on a 2-D line chart that has error bars for series one.

Copy code Copy code
With myChart.SeriesCollection(1)
    .ErrorBars.Border.ColorIndex = 8
End With


Explosion Property

 Copy code hover
[image]

Explosion Property
Send feedback

Published: July 16, 2012

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.

Example

This example sets the explosion value for point two. The example should be run on a pie chart.

Copy code Copy code
myChart.SeriesCollection(1).Points(2). Explosion = 20


Fill Property

 Copy code hover
[image]

Fill Property
Send feedback

Published: July 16, 2012

Returns a ChartFillFormat object that contains fill formatting properties for the specified chart. Read-only.

Example

This example sets the fill format for the chart to the preset brass color.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .PresetGradient msoGradientDiagonalDown, 3, msoGradientBrass
End With


FirstSliceAngle Property

 Copy code hover
[image]

FirstSliceAngle Property
Send feedback

Published: July 16, 2012

Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Read/write Long.

Example

This example sets the angle for the first slice in chart group one. The example should be run on a 2-D pie chart.

Copy code Copy code
myChart.ChartGroups(1).FirstSliceAngle = 15


Floor Property

 Copy code hover
[image]

Floor Property
Send feedback

Published: July 16, 2012

Returns a Floor object that represents the floor of the 3-D chart. Read-only.

Example

This example sets the floor color to blue. The example should be run on a 3-D chart (the Floor property fails on 2-D charts).

Copy code Copy code
myChart.Floor.Interior.ColorIndex = 5


Font Property

 Copy code hover
[image]

Font Property
Send feedback

Published: July 16, 2012

Returns a Font object that represents the font of the specified object. Read/write Font object only for the DataSheet object, for all other objects, read-only Font object.

expression.Font

expression Required. An expression that returns one of the above objects.

Example

This example sets the font in the chart title to 14-point bold italic.

Copy code Copy code
With myChart.ChartTitle.Font
 .Size = 14
 .Bold = True
 .Italic = True
End With


FontStyle Property

 Copy code hover
[image]

FontStyle Property
Send feedback

Published: July 16, 2012

Returns or sets the font style. Read/write Variant.

expression.FontStyle

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Changing this property may affect other Font properties (such as Bold and Italic).

Example

This example sets the font style for the chart title to bold and italic.

Copy code Copy code
myChart.ChartTitle.Font.FontStyle = "Bold Italic"


ForeColor Property

 Copy code hover
[image]

ForeColor Property
Send feedback

Published: July 16, 2012

Returns a ChartColorFormat object that represents the foreground fill color.

Example

This example sets the gradient, background color, and foreground color for the chart area fill.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .ForeColor.SchemeColor = 15
 .BackColor.SchemeColor = 17
 .TwoColorGradient msoGradientHorizontal, 1
End With


Forward Property

 Copy code hover
[image]

Forward Property
Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Long.

Example

This example sets the number of units that the trendline extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 .Forward = 5
 .Backward = .5
End With


GapDepth Property

 Copy code hover
[image]

GapDepth Property
Send feedback

Published: July 16, 2012

Returns or sets the distance between the data series on a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500. Read/write Long.

Example

This example sets the distance between the data series to 200 percent of the marker width. The example should be run on a 3-D chart (the GapDepth property fails on 2-D charts).

Copy code Copy code
myChart.GapDepth = 200


GapWidth Property

 Copy code hover
[image]

GapWidth Property
Send feedback

Published: July 16, 2012

Bar and Column charts: Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500. Read/write Long.

Pie of Pie and Bar of Pie charts: Returns or sets the space between the primary and secondary sections of the specified chart. The value of this property must be between 5 and 200. Read/write Long.

Example

This example sets the space between column clusters to be 50 percent of the column width.

Copy code Copy code
myChart.ChartGroups(1).GapWidth = 50


GradientColorType Property

 Copy code hover
[image]

GradientColorType Property
Send feedback

Published: July 16, 2012

Returns the gradient color type for the specified fill. Read-only MsoGradientColorType .

MsoGradientColorType can be one of these MsoGradientColorType constants.

msoGradientColorMixed

msoGradientOneColor

msoGradientPresetColors

msoGradientTwoColors

expression.GradientColorType

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the fill format for the chart if its chart area has a one-color gradient fill.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientOneColor Then
 .OneColorGradient Style:= msoGradientFromCorner, _
 Variant:= 1, Degree:= 0.3
 End If
 End If
End With


GradientDegree Property

 Copy code hover
[image]

GradientDegree Property
Send feedback

Published: July 16, 2012

Returns the gradient degree of the specified one-color shaded fill as a floating-point value from 0.0 (dark) through 1.0 (light). Read-only Single.

This property is read-only. Use the OneColorGradient method to set the gradient degree for the fill.

expression.GradientDegree

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the chart's fill format so that its gradient degree is at least 0.3.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientOneColor Then
 If .GradientDegree < 0.3 Then
 .OneColorGradient .GradientStyle, _
 .GradientVariant, 0.3
 End If
 End If
 End If
End With


GradientStyle Property

 Copy code hover
[image]

GradientStyle Property
Send feedback

Published: July 16, 2012

Returns the gradient style for the specified fill. Read-only MsoGradientStyle .

MsoGradientStyle can be one of these MsoGradientStyle constants.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientMixed

msoGradientVertical This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient style for the fill.

expression.GradientStyle

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the chart's fill format so that its gradient style is changed to msoGradientDiagonalUp if it was originally msoGradientDiagonalDown.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientOneColor Then
 If .GradientStyle = msoGradientDiagonalDown Then
 .OneColorGradient msoGradientDiagonalUp, _
 .GradientVariant, .GradientDegree
 End If
 End If
 End If
End With


GradientVariant Property

 Copy code hover
[image]

GradientVariant Property
Send feedback

Published: July 16, 2012

Returns the shade variant for the specified fill as an integer value from 1 through 4. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) listed on the Gradient tab in the Fill Effects dialog box. Read-only Long.

This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient variant for the fill

expression.GradientVariant

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the chart's fill format so that it's displayed using the second shade variant if it's currently using the first shade variant.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientOneColor Then
 If .GradientVariant = 1 Then
 .OneColorGradient .GradientStyle, 2, _
 .GradientDegree
 End If
 End If
 End If
End With


Has3DEffect Property

 Copy code hover
[image]

Has3DEffect Property
Send feedback

Published: July 16, 2012

True if the series has a three-dimensional appearance. Applies only to bubble charts. Read/write Boolean.

Example

This example gives series one on the bubble chart a three-dimensional appearance.

Copy code Copy code
With myChart
 .SeriesCollection(1).Has3DEffect = True
End With


Has3DShading Property

 Copy code hover
[image]

Has3DShading Property
Send feedback

Published: July 16, 2012

True if the chart group has three-dimensional shading. Read/write Boolean.

Example

This example adds three-dimensional shading to chart group one on the chart.

Copy code Copy code
Charts(1).ChartGroups(1).Has3DShading = True


HasAxis Property

 Copy code hover
[image]

HasAxis Property
Send feedback

Published: July 16, 2012

Returns or sets which axes exist on the chart. Read/write Variant.

expression.HasAxis(Index1, Index2)

expression Required. An expression that returns one of the objects in the Applies To list.

Index1Optional
XlAxisType
. The type of axis.

XlAxisType can be one of these XlAxisType constants.

xlCategory

xlValuexlSeriesAxis. Series axes apply only to 3-D charts.

Index2Optional
XlAxisGroup
. The axis priority.

XlAxisGroup can be one of these XlAxisGroup constants.

xlPrimary

xlSecondary 3-D charts have only one set of axes.

Remarks

Microsoft Graph may create or delete axes if you change the chart type or change the AxisGroup property.

Example

This example turns on the primary value axis.

Copy code Copy code
myChart.HasAxis(xlValue, xlPrimary) = True


HasBorderHorizontal Property

 Copy code hover
[image]

HasBorderHorizontal Property
Send feedback

Published: July 16, 2012

True if the chart data table has horizontal cell borders. Read/write Boolean.

Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

Copy code Copy code
With myChart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With


HasBorderOutline Property

 Copy code hover
[image]

HasBorderOutline Property
Send feedback

Published: July 16, 2012

True if the chart data table has outline borders. Read/write Boolean.

Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

Copy code Copy code
With myChart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With


HasBorderVertical Property

 Copy code hover
[image]

HasBorderVertical Property
Send feedback

Published: July 16, 2012

True if the chart data table has vertical cell borders. Read/write Boolean.

Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

Copy code Copy code
With myChart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With


HasDataLabel Property

 Copy code hover
[image]

HasDataLabel Property
Send feedback

Published: July 16, 2012

True if the point has a data label. Read/write Boolean.

Example

This example turns on the data label for point seven in series three, and then it sets the data label color to blue.

Copy code Copy code
With myChart.SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels Type:=xlValue
 .DataLabel.Font.ColorIndex = 5
End With


HasDataLabels Property

 Copy code hover
[image]

HasDataLabels Property
Send feedback

Published: July 16, 2012

True if the series has data labels. Read/write Boolean.

Example

This example turns on data labels for series three.

Copy code Copy code
With myChart.SeriesCollection(3)
 .HasDataLabels = True
 .ApplyDataLabels Type:=xlValue
End With


HasDataTable Property

 Copy code hover
[image]

HasDataTable Property
Send feedback

Published: July 16, 2012

True if the chart has a data table. Read/write Boolean.

Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

Copy code Copy code
With myChart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
End With


HasDisplayUnitLabel Property

 Copy code hover
[image]

HasDisplayUnitLabel Property
Send feedback

Published: July 16, 2012

True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the value axis. False if no units are displayed. The default value is True. Read/write Boolean.

Example

This example sets the units on the value axis in myChart to increments of 500 but hides the unit label itself.

Copy code Copy code
With myChart.Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .AxisTitle.Caption = "Rebate Amounts"
 .HasDisplayUnitLabel = False
End With


HasDropLines Property

 Copy code hover
[image]

HasDropLines Property
Send feedback

Published: July 16, 2012

True if the line chart or area chart has drop lines. Applies only to line and area charts. Read/write Boolean.

Example

This example turns on drop lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


HasErrorBars Property

 Copy code hover
[image]

HasErrorBars Property
Send feedback

Published: July 16, 2012

True if the series has error bars. This property isn't available for 3-D charts. Read/write Boolean.

Example

This example removes error bars from series one. The example should be run on a 2-D line chart that has error bars for series one.

Copy code Copy code
myChart.SeriesCollection(1).HasErrorBars = False


HasHiLoLines Property

 Copy code hover
[image]

HasHiLoLines Property
Send feedback

Published: July 16, 2012

True if the line chart has high-low lines. Applies only to line charts. Read/write Boolean.

Example

This example turns on high-low lines for chart group one and then sets line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

Copy code Copy code
With myChart.ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


HasLeaderLines Property

 Copy code hover
[image]

HasLeaderLines Property
Send feedback

Published: July 16, 2012

True if the series has leader lines. Read/write Boolean.

Example

This example adds data labels and blue leader lines to series one on the pie chart.

Copy code Copy code
With myChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With


HasLegend Property

 Copy code hover
[image]

HasLegend Property
Send feedback

Published: July 16, 2012

True if the chart has a legend. Read/write Boolean.

Example

This example turns on the legend for the chart and then sets the legend font color to blue.

Copy code Copy code
With myChart
 .HasLegend = True
 .Legend.Font.ColorIndex = 5
End With


HasLinks Property

 Copy code hover
[image]

HasLinks Property
Send feedback

Published: July 16, 2012

True if the specified chart has links to an external data source. Read-only Boolean.

Example

This example clears cells A1:D4 on the datasheet if the chart has no links.

Copy code Copy code
With myChart.Application
 If .HasLinks = False Then
 .DataSheet.Range("A1:D4").Clear
 End If
End With


HasMajorGridlines Property

 Copy code hover
[image]

HasMajorGridlines Property
Send feedback

Published: July 16, 2012

True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.

Example

This example sets the color of the major gridlines for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 If .HasMajorGridlines Then
 .MajorGridlines.Border.ColorIndex = 3 'set color to red
 End If
End With


HasMinorGridlines Property

 Copy code hover
[image]

HasMinorGridlines Property
Send feedback

Published: July 16, 2012

True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.

Example

This example sets the color of the minor gridlines for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 If .HasMinorGridlines Then
 .MinorGridlines.Border.ColorIndex = 4
 ' Set color to green.
 End If
End With


HasRadarAxisLabels Property

 Copy code hover
[image]

HasRadarAxisLabels Property
Send feedback

Published: July 16, 2012

True if a radar chart has axis labels. Applies only to radar charts. Read/write Boolean.

Example

This example turns on radar axis labels for chart group one and sets their color. The example should be run on a radar chart.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
End With


HasSeriesLines Property

 Copy code hover
[image]

HasSeriesLines Property
Send feedback

Published: July 16, 2012

True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to stacked column charts, bar charts, Pie of Pie charts, or Bar of Pie charts. Read/write Boolean.

Example

This example turns on series lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


HasTitle Property

 Copy code hover
[image]

HasTitle Property
Send feedback

Published: July 16, 2012

True if the axis or chart has a visible title. Read/write Boolean.

Remarks

An axis title is represented by an AxisTitle object.

A chart title is represented by a ChartTitle object.

Example

This example adds an axis label to the category axis.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
End With


HasUpDownBars Property

 Copy code hover
[image]

HasUpDownBars Property
Send feedback

Published: July 16, 2012

True if the specified line chart has up and down bars. Applies only to line charts. Read/write Boolean.

Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With


Height Property (Graph)

 Copy code hover
[image]

Height Property (Graph)
Send feedback

Published: July 16, 2012

The height of the main application window or the object. If the window is minimized, this property is read-only and refers to the height of the icon. If the window is maximized, this property cannot be set. Use the WindowState property to determine the window state. Read/write Double for all objects, except for the Chart object which is read/write Variant.

expression.Height

expression Required. An expression that returns one of the above objects.

Example

This example sets the height of the chart legend to 1 inch (72 points).

Copy code Copy code
myChart.Legend.Height = 72


HeightPercent Property

 Copy code hover
[image]

HeightPercent Property
Send feedback

Published: July 16, 2012

Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). Read/write Long.

Example

This example sets the height of the chart to 80 percent of its width. The example should be run on a 3-D chart.

Copy code Copy code
myChart.HeightPercent = 80


HiLoLines Property

 Copy code hover
[image]

HiLoLines Property
Send feedback

Published: July 16, 2012

Returns a HiLoLines object that represents the high-low lines for the specified series on a line chart. Applies only to line charts. Read-only.

Example

This example turns on high-low lines for chart group one on the chart and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

Copy code Copy code
With myChart.ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


HorizontalAlignment Property (Graph)

 Copy code hover
[image]

HorizontalAlignment Property (Graph)
Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write
XlHAlign
.

XlHAlign can be one of these XlHAlign constants.

xlHAlignCenter

xlHAlignCenterAcrossSelectionxlHAlignDistributedxlHAlignFillxlHAlignGeneralxlHAlignJustifyxlHAlignLeftxlHAlignRight

expression.HorizontalAlignment

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example centers the chart title.

Copy code Copy code
myChart.ChartTitle.HorizontalAlignment = xlCenter


Include Property

 Copy code hover
[image]

Include Property
Send feedback

Published: July 16, 2012

True if the data in the specified row or column is included in the chart. Read/write Variant.

expression.Include

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example causes the data in the second row on the datasheet to be excluded from the chart.

Copy code Copy code
With myChart.Application.DataSheet
 .Rows(2).Include = False
End With


Index Property

 Copy code hover
[image]

Index Property
Send feedback

Published: July 16, 2012

Returns the index number of the object within the collection of similar objects. Read-only Long.

Example

This example displays the index number of an object passed to this procedure.

Copy code Copy code
MsgBox "The index number of this object is " & obj.Index


InsideHeight Property

 Copy code hover
[image]

InsideHeight Property
Send feedback

Published: July 16, 2012

Returns the inside height of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Height property for the plot area uses the bounding rectangle that includes the axis labels.


InsideLeft Property

 Copy code hover
[image]

InsideLeft Property
Send feedback

Published: July 16, 2012

Returns the distance from the chart edge to the inside left edge of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Left property for the plot area uses the bounding rectangle that includes the axis labels.


InsideTop Property

 Copy code hover
[image]

InsideTop Property
Send feedback

Published: July 16, 2012

Returns the distance from the chart edge to the inside top edge of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Top property for the plot area uses the bounding rectangle that includes the axis labels.


InsideWidth Property

 Copy code hover
[image]

InsideWidth Property
Send feedback

Published: July 16, 2012

Returns the inside width of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Width property for the plot area uses the bounding rectangle that includes the axis labels.


Intercept Property

 Copy code hover
[image]

Intercept Property
Send feedback

Published: July 16, 2012

Returns or sets the point where the trendline crosses the value axis. Read/write Double.

Remarks

Setting this property sets the InterceptIsAuto property to False.

Example

This example sets trendline one to cross the value axis at 5. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1).Intercept = 5


InterceptIsAuto Property

 Copy code hover
[image]

InterceptIsAuto Property
Send feedback

Published: July 16, 2012

True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.

Remarks

Setting the Intercept property sets this property to False.

Example

This example sets Microsoft Graph to automatically determine the trendline intercept point. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1) _
 .InterceptIsAuto = True


Interior Property

 Copy code hover
[image]

Interior Property
Send feedback

Published: July 16, 2012

Returns an Interior object that represents the interior of the specified object. Read-only.

Example

This example sets the interior color of the chart title.

Copy code Copy code
myChart.ChartTitle.Interior.ColorIndex = 8


InvertIfNegative Property

 Copy code hover
[image]

InvertIfNegative Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph inverts the pattern in the item when it corresponds to a negative number. Read/write Boolean for all objects, except for the Interior object, which is read/write Variant.

expression.InvertIfNegative

expression Required. An expression that returns one of the above objects.

Example

This example inverts the pattern for negative values in series one. The example should be run on a 2-D column chart.

Copy code Copy code
myChart.SeriesCollection(1).InvertIfNegative = True


Italic Property

 Copy code hover
[image]

Italic Property
Send feedback

Published: July 16, 2012

True if the font style is italic. Read/write Variant.

expression.Italic

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the font style to italic for the chart title.

Copy code Copy code
myChart.ChartTitle.Font.Italic = True


Item Property (Graph)

 Copy code hover
[image]

Item Property (Graph)
Send feedback

Published: July 16, 2012

Returns a Range object that represents a range that's offset from the specified range. Read/write Variant.

expression.Item(RowIndex, ColumnIndex)

expression Required. An expression that returns one of the objects in the Applies To list.

RowIndexOptional Variant. The row number of the cell you want to work with (the first row in the range is 1).

ColumnIndexOptional Variant. A number or string that indicates the column number of the cell you want to work with (the first column in the range is either 1 or A).

Remarks

Syntax 1 uses a row number and either a column number or a letter as index arguments. For more information about this syntax, see the Range object. The RowIndex and ColumnIndex arguments are relative offsets. In other words, specifying 1 for RowIndex returns cells in the first row in the range, not the first row on the datasheet.

Example

This example clears cell B2 on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Range("A1").Item(2, 2).Clear


LeaderLines Property

 Copy code hover
[image]

LeaderLines Property
Send feedback

Published: July 16, 2012

Returns a LeaderLines object that represents the leader lines for the specified series. Read-only.

Example

This example adds data labels and blue leader lines to series one on the pie chart.

Copy code Copy code
With myChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
End With


Left Property

 Copy code hover
[image]

Left Property
Send feedback

Published: July 16, 2012

Left property as it applies to the Application, and DataSheet object.

Returns or sets the distance from the left edge of the screen to the left edge of the main Microsoft Graph window. Read/write Double.

expression.Left

expression Required. An expression that returns one of the above objects.

Remarks

If the window is maximized, Application.Left returns a negative number that varies based on the width of the window border. Setting Application.Left to 0 (zero) will make the window a tiny bit smaller than it would be if the application window were maximized. In other words, if Application.Left is 0, the left border of the main Microsoft Graph window will just barely be visible on the screen.

If the Microsoft Graph window is minimized, Application.Left controls the position of the window icon.

Example

As it applies to the ChartTitle object.

This example aligns the left edge of the chart title with the left edge of the chart area.

Copy code Copy code
myChart.ChartTitle.Left = 0

Left property as it applies to the AxisTitle, ChartArea, ChartTitle, DataLabel, DisplayUnitLabel, Legend, and PlotArea objects.

Returns or sets the distance from the left edge of the object to the left edge of the chart area. Read/write Double.

expression.Left

expression Required. An expression that returns one of the above objects.

Left property as it applies to the Axis, LegendEntry, and LegendKey objects.

Returns or sets the distance from the left edge of the object to the left edge of the chart area. Read-only Double.

expression.Left

expression Required. An expression that returns one of the above objects.

Left property as it applies to the Chart object.

Returns or sets the distance from the left edge of the object to the left edge of the Microsoft Graph window. Read/write Variant.

expression.Left

expression Required. An expression that returns a Chart object.


Legend Property

 Copy code hover
[image]

Legend Property
Send feedback

Published: July 16, 2012

Returns a Legend object that represents the legend for the specified chart. Read-only.

Example

This example turns on the legend for the chart and then sets the font color for the legend to blue.

Copy code Copy code
myChart.HasLegend = True
myChart.Legend.Font.ColorIndex = 5


LegendKey Property

 Copy code hover
[image]

LegendKey Property
Send feedback

Published: July 16, 2012

Returns a LegendKey object that represents the legend key associated with the entry.

Example

This example sets the legend key for legend entry one to be a triangle. The example should be run on a 2-D line chart.

Copy code Copy code
myChart.Legend.LegendEntries(1).LegendKey _
 .MarkerStyle = xlMarkerStyleTriangle


Line3DGroup Property

 Copy code hover
[image]

Line3DGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the line chart group on a 3-D chart. Read-only.

Example

This example sets the 3-D line group to use a different color for each data marker.

Copy code Copy code
myChart.Line3DGroup.VaryByCategories = True


LineStyle Property

 Copy code hover
[image]

LineStyle Property
Send feedback

Published: July 16, 2012

Returns or sets the line style for the border. Read/write
XlLineStyle
.

XlLineStyle can be one of these XlLineStyle constants.

xlContinuous

xlDash

xlDashDotxlDashDotDotxlDotxlDoublexlSlantDashDotxlLineStyleNone

expression.LineStyle

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example puts a border around the chart area and the plot area.

Copy code Copy code
With myChart
 .ChartArea.Border.LineStyle = xlDashDot
 With .PlotArea.Border
 .LineStyle = xlDashDotDot
 .Weight = xlThick
 End With
End With


MajorGridlines Property

 Copy code hover
[image]

MajorGridlines Property
Send feedback

Published: July 16, 2012

Returns a Gridlines object that represents the major gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.

Example

This example sets the color of the major gridlines for the value axis in the chart.

Copy code Copy code
With myChart.Axes(xlValue)
 If .HasMajorGridlines Then
 .MajorGridlines.Border.ColorIndex = 5
 End If
End With


MajorTickMark Property

 Copy code hover
[image]

MajorTickMark Property
Send feedback

Published: July 16, 2012

Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark .

XlTickMark can be one of these XlTickMark constants.

xlTickMarkCross

xlTickMarkInside

xlTickMarkNone

xlTickMarkOutside

expression.MajorTickMark

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the major tick marks for the value axis to be outside the axis.

Copy code Copy code
myChart.Axes(xlValue).MajorTickMark = xlTickMarkOutside


MajorUnit Property

 Copy code hover
[image]

MajorUnit Property
Send feedback

Published: July 16, 2012

Returns or sets the major units for the axis. Read/write Double.

Remarks

Setting this property sets the MajorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick-mark spacing on the category axis.

Example

This example sets the major and minor units for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
End With


MajorUnitIsAuto Property

 Copy code hover
[image]

MajorUnitIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph calculates the major units for the axis. Read/write Boolean.

Remarks

Setting the MajorUnit property sets this property to False.

Example

This example automatically sets the major and minor units for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
End With


MajorUnitScale Property

 Copy code hover
[image]

MajorUnitScale Property
Send feedback

Published: July 16, 2012

Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit .

XlTimeUnit can be one of these XlTimeUnit constants.

xlDays

xlMonths

xlYears

expression.MajorUnitScale

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the category axis to use a time scale and sets the major and minor units.

Copy code Copy code
With myChart.Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
End With


MarkerBackgroundColor Property

 Copy code hover
[image]

MarkerBackgroundColor Property
Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an RGB value. Applies only to line, scatter, and radar charts. Read/write Long.

Example

This example sets the marker background and foreground colors for the second point in series one.

Copy code Copy code
With myChart.SeriesCollection(1).Points(2)
 .MarkerBackgroundColor = RGB(0,255,0) ' green
 .MarkerForegroundColor = RGB(255,0,0) ' red
End With


MarkerBackgroundColorIndex Property

 Copy code hover
[image]

MarkerBackgroundColorIndex Property
Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants. Read/write XlColorIndex .

XlColorIndex can be one of these XlColorIndex constants.

xlColorIndexNone

xlColorIndexAutomatic

expression.MarkerBackgroundColorIndex

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the marker background and foreground colors for the second point in series one.

Copy code Copy code
With myChart.SeriesCollection(1).Points(2)
 .MarkerBackgroundColorIndex = 4 'green
 .MarkerForegroundColorIndex = 3 'red
End With


MarkerForegroundColor Property

 Copy code hover
[image]

MarkerForegroundColor Property
Send feedback

Published: July 16, 2012

Returns or sets the foreground color of the marker as an RGB value. Applies only to line, scatter, and radar charts. Read/write Long.

Example

This example sets the marker background and foreground colors for the second point in series one.

Copy code Copy code
With myChart.SeriesCollection(1).Points(2)
 .MarkerBackgroundColor = RGB(0,255,0) ' green
 .MarkerForegroundColor = RGB(255,0,0) ' red
End With


MarkerForegroundColorIndex Property

 Copy code hover
[image]

MarkerForegroundColorIndex Property
Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants. Read/write XlColorIndex .

XlColorIndex can be one of these XlColorIndex constants.

xlColorIndexNone

xlColorIndexAutomatic

expression.MarkerForegroundColorIndex

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the marker background and foreground colors for the second point in series one.

Copy code Copy code
With myChart.SeriesCollection(1).Points(2)
 .MarkerBackgroundColorIndex = 4 'green
 .MarkerForegroundColorIndex = 3 'red
End With


MarkerSize Property

 Copy code hover
[image]

MarkerSize Property
Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Read/write Long.

Example

This example sets the data-marker size for all data markers in series one.

Copy code Copy code
MyChart.SeriesCollection(1).MarkerSize = 10


MarkerStyle Property

 Copy code hover
[image]

MarkerStyle Property
Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle .

XlMarkerStyle can be one of these XlMarkerStyle constants.

xlMarkerStyleCircle. Circular markers

xlMarkerStyleDiamond. Diamond-shaped markers

xlMarkerStyleNone. No markers

xlMarkerStylePlus. Square markers with a plus sign

xlMarkerStyleStar. Square markers with an asterisk

xlMarkerStyleX. Square markers with an X

xlMarkerStyleAutomatic. Automatic markers

xlMarkerStyleDash. Long bar markers

xlMarkerStyleDot. Short bar markers

xlMarkerStylePicture. Picture markers

xlMarkerStyleSquare. Square markers

xlMarkerStyleTriangle. Triangular markers

expression.MarkerStyle

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the marker style for series one. The example should be run on a 2-D line chart.

Copy code Copy code
myChart.SeriesCollection(1).MarkerStyle = xlMarkerStyleCircle


MaximumScale Property

 Copy code hover
[image]

MaximumScale Property
Send feedback

Published: July 16, 2012

Returns or sets the maximum value on the axis. Read/write Double.

Remarks

Setting this property sets the MaximumScaleIsAuto property to False.

Example

This example sets the minimum and maximum values for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
End With


MaximumScaleIsAuto Property

 Copy code hover
[image]

MaximumScaleIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph calculates the maximum value for the axis. Read/write Boolean.

Remarks

Setting the MaximumScale property sets this property to False.

Example

This example automatically calculates the minimum scale and the maximum scale for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
End With


MinimumScale Property

 Copy code hover
[image]

MinimumScale Property
Send feedback

Published: July 16, 2012

Returns or sets the minimum value on the axis. Read/write Double.

Remarks

Setting this property sets the MinimumScaleIsAuto property to False.

Example

This example sets the minimum and maximum values for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
End With


MinimumScaleIsAuto Property

 Copy code hover
[image]

MinimumScaleIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph calculates the minimum value for the axis. Read/write Boolean.

Remarks

Setting the MinimumScale property sets this property to False.

Example

This example automatically calculates the minimum scale and the maximum scale for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
End With


MinorGridlines Property

 Copy code hover
[image]

MinorGridlines Property
Send feedback

Published: July 16, 2012

Returns a Gridlines object that represents the minor gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.

Example

This example sets the color of the minor gridlines for the value axis in the chart to blue.

Copy code Copy code
With myChart.Axes(xlValue)
 If .HasMinorGridlines Then
 .MinorGridlines.Border.ColorIndex = 5
 End If
End With


MinorTickMark Property

 Copy code hover
[image]

MinorTickMark Property
Send feedback

Published: July 16, 2012

Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark .

XlTickMark can be one of these XlTickMark constants.

xlTickMarkCross

xlTickMarkInside

xlTickMarkNone

xlTickMarkOutside

expression.MinorTickMark

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the minor tick marks for the value axis to be inside the axis.

Copy code Copy code
myChart.Axes(xlValue).MinorTickMark = xlTickMarkInside


MinorUnit Property

 Copy code hover
[image]

MinorUnit Property
Send feedback

Published: July 16, 2012

Returns or sets the minor units on the axis. Read/write Double.

expression.MinorUnit

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Setting this property sets the MinorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick-mark spacing on the category axis.

Example

This example sets the major and minor units for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
End With


MinorUnitIsAuto Property

 Copy code hover
[image]

MinorUnitIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph calculates minor units for the axis. Read/write Boolean.

Remarks

Setting the MinorUnit property sets this property to False.

Example

This example automatically calculates major and minor units for the value axis.

Copy code Copy code
With myChart.Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
End With


MinorUnitScale Property

 Copy code hover
[image]

MinorUnitScale Property
Send feedback

Published: July 16, 2012

Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit .

XlTimeUnit can be one of these XlTimeUnit constants.

xlDays

xlMonths

xlYears

expression.MinorUnitScale

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the category axis to use a time scale and sets the major and minor units.

Copy code Copy code
With myChart.Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
End With


MoveAfterReturn Property

 Copy code hover
[image]

MoveAfterReturn Property
Send feedback

Published: July 16, 2012

True if the active cell will be moved as soon as the ENTER (RETURN) key is pressed. Read/write Boolean.

Example

This example sets the MoveAfterReturn property to True.

Copy code Copy code
myChart.Application.MoveAfterReturn = True


Name Property (Graph)

 Copy code hover
[image]

Name Property (Graph)
Send feedback

Published: July 16, 2012

Name property as it applies to the Application and Trendline objects.

Returns or sets the name of the object. Read/write String.

expression.Name

expression Required. An expression that returns one of the above objects.

Name property as it applies to the Font object.

Returns or sets the name of the object. Read/write Variant.

expression.Name

expression Required. An expression that returns a Font object.

Name property as it applies to the all other objects.

Returns or sets the name of the object. Read-only String.

expression.Name

expression Required. An expression that returns one of the above objects.

Example

This example assigns the name of the first trendline to the variable myTrendname.

Copy code Copy code
myTrendname = myChart.SeriesCollection(1).Trendlines(1).Name


NameIsAuto Property

 Copy code hover
[image]

NameIsAuto Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph automatically determines the name of the trendline. Read/write Boolean.

Example

This example sets Microsoft Graph to automatically determine the name for trendline one. The example should be run on a 2-D column chart that contains a single series with a trendline.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1).NameIsAuto = True


NumberFormat Property

 Copy code hover
[image]

NumberFormat Property
Send feedback

Published: July 16, 2012

Returns or sets the format code for the object. Returns Null if the cells in the specified range don't all have the same number format. Read/write String for all objects, except for the Range object, which is read/write Variant.

expression.NumberFormat

expression Required. An expression that returns one of the above objects.

Example

This example sets the number format for the data labels for series one.

Copy code Copy code
myChart.SeriesCollection(1).DataLabels.NumberFormat = "General"


NumberFormatLocal Property

 Copy code hover
[image]

NumberFormatLocal Property
Send feedback

Published: July 16, 2012

Returns or sets the format code for the specified object as a string in the language of the user. Read/write Variant.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

Example

This example displays the number format for the data labels in the first series on the chart, in the language of the user.

Copy code Copy code
MsgBox "The number format for the first series is " & _
 myChart.SeriesCollection(1).DataLabels.NumberFormatLocal


Offset Property

 Copy code hover
[image]

Offset Property
Send feedback

Published: July 16, 2012

Returns or sets the distance between each of the levels of labels, and the distance between the first level and the axis line. The default is 100, which represents the spacing between the axis labels and axis line. The value can be an integer from 0 to 1000, relative to the size of the font of the axis label. Read/write Long.

Example

This example doubles the existing tick-mark spacing on the value axis in myChart, if the offset is less than 500.

Copy code Copy code
With myChart.Axes(xlCategory).TickLabels
 If .Offset < 500 then
 .Offset = .Offset * 2
 End If
End With


Order Property

 Copy code hover
[image]

Order Property
Send feedback

Published: July 16, 2012

Returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial. Read/write Long.

Example

This example sets the order of the first trendline for series one if it's polynomial.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 If .Type = xlPolynomial Then .Order = 3
End With


Orientation Property (Graph)

 Copy code hover
[image]

Orientation Property (Graph)
Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Can be an integer value from - 90 degrees to 90 degrees or one of the following XlOrientation constants. Read/write XlTickLabelOrientation for all objects, except for the TickLabels object, which is read/write Variant.

XlTickLabelOrientation can be one of these XlTickLabelOrientation constants.

xlTickLabelOrientationAutomatic

xlTickLabelOrientationDownward

xlTickLabelOrientationHorizontal

xlTickLabelOrientationUpward

xlTickLabelOrientationVertical

expression.Orientation

expression Required. An expression that returns one of the above objects.

Example

This example sets the orientation for the chart title.

Copy code Copy code
myChart.ChartTitle.Orientation = xlHorizontal


OutlineFont Property

 Copy code hover
[image]

OutlineFont Property
Send feedback

Published: July 16, 2012

True if the font is an outline font. Read/write Variant.

expression.OutlineFont

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property has no effect in Windows, but its value is retained (it can be set and returned).

Example

This example sets the font for the chart title to an outline font.

Copy code Copy code
myChart.ChartTitle.Font.OutlineFont = True


Overlap Property

 Copy code hover
[image]

Overlap Property
Send feedback

Published: July 16, 2012

Specifies how bars and columns are positioned. Can be a value between - 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/write Long.

Remarks

If this property is set to - 100, bars are positioned so that there's one bar width between them. If the overlap is 0 (zero), there's no space between bars (one bar starts immediately after the preceding bar). If the overlap is 100, bars are positioned on top of each other.

Example

This example sets the overlap for chart group one to - 50. The example should be run on a 2-D column chart that has two or more series.

Copy code Copy code
myChart.ChartGroups(1).Overlap = -50


Parent Property

 Copy code hover
[image]

Parent Property
Send feedback

Published: July 16, 2012

Returns the parent object.

expression.Parent

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example returns the parent object of the application.

Copy code Copy code
Sub UseParent()

 Application.Parent

End Sub


Pattern Property

 Copy code hover
[image]

Pattern Property
Send feedback

Published: July 16, 2012

For the ChartFillFormat object, returns or sets the fill pattern, read-only MsoPatternType . For the Interior object, returns or sets the interior pattern, read/write Variant.

MsoPatternType can be one of these MsoPatternType constants.

msoPattern10Percent

msoPattern20Percent

msoPattern25Percent

msoPattern30Percent

msoPattern40Percent

msoPattern50Percent

msoPattern5Percent

msoPattern60Percent

msoPattern70Percent

msoPattern75Percent

msoPattern80Percent

msoPattern90Percent

msoPatternDarkDownwardDiagonal

msoPatternDarkHorizontal

msoPatternDarkUpwardDiagonal

msoPatternDarkVertical

msoPatternDashedDownwardDiagonal

msoPatternDashedHorizontal

msoPatternDashedUpwardDiagonal

msoPatternDashedVertical

msoPatternDiagonalBrick

msoPatternDivot

msoPatternDottedDiamond

msoPatternDottedGrid

msoPatternHorizontalBrick

msoPatternLargeCheckerBoard

msoPatternLargeConfetti

msoPatternLargeGrid

msoPatternLightDownwardDiagonal

msoPatternLightHorizontal

msoPatternLightUpwardDiagonal

msoPatternLightVertical

msoPatternMixed

msoPatternNarrowHorizontal

msoPatternNarrowVertical

msoPatternOutlinedDiamond

msoPatternPlaid

msoPatternShingle

msoPatternSmallCheckerBoard

msoPatternSmallConfetti

msoPatternSmallGrid

msoPatternSolidDiamond

msoPatternSphere

msoPatternTrellis

msoPatternWave

msoPatternWeave

msoPatternWideDownwardDiagonal

msoPatternWideUpwardDiagonal

msoPatternZigZag

expression.Pattern

expression Required. An expression that returns one of the above objects.

Example

This example adds a crisscross pattern to the interior of the plot area.

Copy code Copy code
myChart.PlotArea.Interior.Pattern = xlPatternCrissCross


PatternColor Property

 Copy code hover
[image]

PatternColor Property
Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.

expression.PatternColor

expression Required. An expression that returns an Interior object.

Example

This example sets the color of the interior pattern for the chart area.

Copy code Copy code
myChart.ChartArea.Interior.PatternColor = RGB(255,0,0)


PatternColorIndex Property

 Copy code hover
[image]

PatternColorIndex Property
Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants. Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.

xlColorIndexAutomatic

xlColorIndexNone

expression.PatternColorIndex

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Set this property to xlColorIndexAutomatic to specify the automatic pattern for cells or the automatic fill style for drawing objects. Set this property to xlColorIndexNone to specify that you don't want a pattern (this is the same as setting the Pattern property of the Interior object to xlPatternNone).

Example

This example sets the color of the interior pattern for the chart area.

Copy code Copy code
myChart.ChartArea.Interior.PatternColorIndex = 5


Period Property

 Copy code hover
[image]

Period Property
Send feedback

Published: July 16, 2012

Returns or sets the period for the moving-average trendline. Read/write Long.

Example

This example sets the period for the moving-average trendline. The example should be run on a 2-D column chart with a single series that contains 10 data points and a moving-average trendline.

Copy code Copy code
With myChart.SeriesCollection(1).Trendlines(1)
 If .Type = xlMovingAvg Then .Period = 5
End With


Perspective Property

 Copy code hover
[image]

Perspective Property
Send feedback

Published: July 16, 2012

Returns or sets the perspective for the 3-D chart view. Must be from 0 through 100. This property is ignored if the RightAngleAxes property is True. Read/write Long.

Example

This example sets the perspective of myChart to 70. The example should be run on a 3-D chart.

Copy code Copy code
myChart.RightAngleAxes = False
myChart.Perspective = 70


PictureType Property

 Copy code hover
[image]

PictureType Property
Send feedback

Published: July 16, 2012

Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls and faces of a 3-D chart. For the Point and Series objects, read/write XlChartPictureType . For the LegendKey object, read/write Long. For the Floor and Walls objects, read/write Variant.

XlChartPictureType can be one of these XlChartPictureType constants.

xlStack. Stacks the pictures to reach the necessary value.

xlStretch. Stretches the picture to reach the necessary value.

xlStackScale. Stacks the pictures; use the PictureUnit property to determine what unit each picture represents.

expression.PictureType

expression Required. An expression that returns one of the above objects.

Example

This example sets series one to stretch pictures. The example should be run on a 2-D column chart with picture data markers.

Copy code Copy code
myChart.SeriesCollection(1).PictureType = xlStretch


PictureUnit Property

 Copy code hover
[image]

PictureUnit Property
Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlScale (otherwise, this property is ignored). Read/write Long for all objects, except for the Walls object, which is read/write Variant.

expression.PictureUnit

expression Required. An expression that returns one of the above objects.

Example

This example sets series one to stack pictures and uses each picture to represent five units. The example should be run on a 2-D column chart with picture data markers.

Copy code Copy code
With myChart.SeriesCollection(1)
 .PictureType = xlScale
 .PictureUnit = 5
End With


Pie3DGroup Property

 Copy code hover
[image]

Pie3DGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the pie chart group on a 3-D chart. Read-only.

Example

This example sets the 3-D pie group to use a different color for each data marker.

Copy code Copy code
myChart.Pie3DGroup.VaryByCategories = True


PlotArea Property

 Copy code hover
[image]

PlotArea Property
Send feedback

Published: July 16, 2012

Returns a PlotArea object that represents the plot area of a chart. Read-only.

Example

This example sets the color of the plot area interior of myChart to cyan.

Copy code Copy code
myChart.PlotArea.Interior.ColorIndex = 8


PlotBy Property

 Copy code hover
[image]

PlotBy Property
Send feedback

Published: July 16, 2012

Returns or sets the way columns or rows are used as data series on the chart. Read/write XlRowCol .

XlRowCol can be one of these XlRowCol constants.

xlColumns

xlRows

expression.PlotBy

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example causes the embedded chart to plot data by columns.

Copy code Copy code
myChart.PlotBy = xlColumns


PlotOnX Property

 Copy code hover
[image]

PlotOnX Property
Send feedback

Published: July 16, 2012

Returns or sets the index of the data sheet row whose contents are to be used as the X-axis values in the specified X-Y scatter chart. Read/write Long.

Example

This example sets row 0 as the row whose contents will be plotted as values on the X-axis in myChart.

Copy code Copy code
myChart.PlotOnX = 0


Position Property

 Copy code hover
[image]

Position Property
Send feedback

Published: July 16, 2012

Position property as it applies to the DataLabel and DataLabels objects.

Returns or sets the position of the data label. Read/write XlDataLabelPosition .

XlDataLabelPosition can be one of these XlDataLabelPosition constants.

xlLabelPositionBelow

xlLabelPositionCenter

xlLabelPositionInsideBase

xlLabelPositionInsideEnd

xlLabelPositionLeft

xlLabelPositionMixed

xlLabelPositionOutsideEnd

xlLabelPositionRight

xlLabelPositionAbove

xlLabelPositionBestFit

xlLabelPositionCustom

expression.Position

expression Required. An expression that returns one of the above objects.

Position property as it applies to the Legend object.

Returns or sets the position of the legend on the chart. Read/write XlLegendPosition .

XlLegendPosition can be one of these XlLegendPosition constants.

xlLegendPositionBottom

xlLegendPositionCorner

xlLegendPositionLeft

xlLegendPositionRight

xlLegendPositionTop

expression.Position

expression Required. An expression that returns one of the above objects.

Example

This example sets the position of the legend to the top of the chart.

Copy code Copy code
myChart.Legend.Position = xlLegendPositionTop


PresetGradientType Property

 Copy code hover
[image]

PresetGradientType Property
Send feedback

Published: July 16, 2012

Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType .

MsoPresetGradientType can be one of these MsoPresetGradientType constants.

msoGradientBrass

msoGradientChrome

msoGradientDaybreak

msoGradientEarlySunset

msoGradientFog

msoGradientGoldII

msoGradientLateSunset

msoGradientMoss

msoGradientOcean

msoGradientPeacock

msoGradientRainbowII

msoGradientSilver

msoGradientWheat

msoPresetGradientMixed

msoGradientCalmWater

msoGradientChromeII

msoGradientDesert

msoGradientFire

msoGradientGold

msoGradientHorizon

msoGradientMahogany

msoGradientNightfall

msoGradientParchment

msoGradientRainbow

msoGradientSapphire

expression.PresetGradientType

expression Required. An expression that returns one of the objects in the Applies To list.

This property is read-only. Use the PresetGradient method to set the preset gradient type for the fill.

Example

This example changes the chart's preset gradient fill format from silver to gold.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillGradient Then
 If .GradientColorType = msoGradientPresetColors Then
 If .PresetGradientType = msoGradientSilver Then
 .PresetGradient .GradientStyle, _
 .GradientVariant, msoGradientGold
 End If
 End If
 End If
End With


PresetTexture Property

 Copy code hover
[image]

PresetTexture Property
Send feedback

Published: July 16, 2012

Returns the preset texture for the specified fill. Read-only MsoPresetTexture .

MsoPresetTexture can be one of these MsoPresetTexture constants.

msoPresetTextureMixed

msoTextureBouquet

msoTextureCanvas

msoTextureDenim

msoTextureGranite

msoTextureMediumWood

msoTextureOak

msoTexturePapyrus

msoTexturePinkTissuePaper

msoTextureRecycledPaper

msoTextureStationery

msoTextureWaterDroplets

msoTextureWovenMat

msoTextureBlueTissuePaper

msoTextureBrownMarble

msoTextureCork

msoTextureFishFossil

msoTextureGreenMarble

msoTextureNewsprint

msoTexturePaperBag

msoTextureParchment

msoTexturePurpleMesh

msoTextureSand

msoTextureWalnut

msoTextureWhiteMarble

expression.PresetTexture

expression Required. An expression that returns one of the objects in the Applies To list.

This property is read-only. Use the PresetTextured method to set the preset texture for the fill.

Example

This example changes the chart's textured fill format from oak to walnut.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillTextured Then
 If .TextureType = msoTexturePreset Then
 If .PresetTexture = msoTextureOak Then
 .PresetTextured msoTextureWalnut
 End If
 End If
 End If
End With


RadarAxisLabels Property

 Copy code hover
[image]

RadarAxisLabels Property
Send feedback

Published: July 16, 2012

Returns a TickLabels object that represents the radar axis labels for the specified chart group. Read-only.

Example

This example turns on radar axis labels for chart group one on the chart and then sets the color for the labels. The example should be run on a radar chart.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
End With


Range Property

 Copy code hover
[image]

Range Property
Send feedback

Published: July 16, 2012

Returns a Range object that represents the specified cell or range of cells. Read-only Range object.

expression.Range(Range1, Range2)

expression Required. An expression that returns a DataSheet object.

Range 1 Required for a single cell. The name of the specified range. This must be an A1-style reference in the language the macro is written in. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but they're ignored.

OR

Range1, Range2 Required for a range of cells. The cells in the upper-left and lower-right corners of the specified range. Each argument can be a Range object that contains a single cell (or an entire column or entire row), or the argument can be a string that names a single cell in the language the macro is written in.

Remarks

On the datasheet, the first column heading (starting on the left) is A, followed by B, C, D, and so on. The first row heading (starting at the top) is 1, followed by 2, 3, 4, and so on. Neither the leftmost column nor the top row has a heading. In other words, column A is actually the second column from the left; likewise, row 1 is the second row from the top. The leftmost column and the top row, which are commonly used for legend text or axis labels, are referred to as column 0 (zero) and row 0 (zero). Thus, the following example inserts the text "Annual Sales" in the top cell in column A (the second column).

Copy code Copy code
myChart.Application.DataSheet.Range("A0").Value = "Annual Sales"

And the following example inserts the text "District 1" in the leftmost cell in row 2 (the third row).

Copy code Copy code
myChart.Application.DataSheet.Range("02").Value = "District 1"

Example

This example sets the value of cell A1 on the datasheet to 3.14159.

Copy code Copy code
myChart.DataSheet.Range("A1").Value = 3.14159

This example loops on cells A1:C3 on the datasheet. If one of the cells has a value less than 0.001, the example replaces that value with 0 (zero).

Copy code Copy code
With myChart.Application.DataSheet
 For Each c in .Range("A1:C3")
 If c.Value < .001 Then
 c.Value = 0
 End If
 Next c
End With


ReadingOrder Property

 Copy code hover
[image]

ReadingOrder Property
Send feedback

Published: July 16, 2012

Returns or sets the reading order for the specified object. Can be one of the following
constants
. Read/write Long.

xlContext

xlLTR (left-to-right)

xlRTL (right-to-left)

expression.CharacterType

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets the chart title's reading order to right-to-left.

Copy code Copy code
myChart.ChartTitle.ReadingOrder = xlRTL


ReplacementList Property

 Copy code hover
[image]

ReplacementList Property
Send feedback

Published: July 16, 2012

Returns the array of AutoCorrect replacements.

expression.ReplacementList(Index)

expression Required. An expression that returns an AutoCorrect object.

IndexOptional Variant. The row index of the array of AutoCorrect replacements to be returned. The row is returned as a one-dimensional array with two elements: The first element is the text in column 1, and the second element is the text in column 2.

Remarks

Use the AddReplacement method to add an entry to the replacement list.

Example

This example searches the replacement list for "Temperature" and displays the replacement entry if it exists.

Copy code Copy code
repl = Application.AutoCorrect.ReplacementList
For x = 1 To UBound(repl)
 If repl(x, 1) = "Temperature" Then MsgBox repl(x, 2)
Next


ReplaceText Property

 Copy code hover
[image]

ReplaceText Property
Send feedback

Published: July 16, 2012

True if text in the list of AutoCorrect replacements is replaced automatically. Read/write Boolean.

Example

This example turns off automatic text replacement for the chart.

Copy code Copy code
With myChart.Application.AutoCorrect
 .CapitalizeNamesOfDays = True
 .ReplaceText = False
End With


ReversePlotOrder Property

 Copy code hover
[image]

ReversePlotOrder Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph plots data points from last to first. Read/write Boolean.

Remarks

This property cannot be used on radar charts.

Example

This example plots data points from last to first on the value axis.

Copy code Copy code
myChart.Axes(xlValue).ReversePlotOrder = True


RGB Property

 Copy code hover
[image]

RGB Property
Send feedback

Published: July 16, 2012

Returns the red-green-blue value of the specified color. Read-only Long.

Example

This example sets the color of the legend font to the foreground fill color of the plot area.

Copy code Copy code
myChart.Legend.Font.Color = _
 myChart.PlotArea.Fill.ForeColor.RGB


RightAngleAxes Property

 Copy code hover
[image]

RightAngleAxes Property
Send feedback

Published: July 16, 2012

True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. Read/write Variant.

expression.RightAngleAxes

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

If this property is True, the Perspective property is ignored.

Example

This example sets the axes to intersect at right angles. The example should be run on a 3-D chart.

Copy code Copy code
myChart.RightAngleAxes = True


Rotation Property

 Copy code hover
[image]

Rotation Property
Send feedback

Published: July 16, 2012

Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts. Read/write Variant.

Example

This example sets the rotation of myChart to 30 degrees. The example should be run on a 3-D chart.

Copy code Copy code
myChart.Rotation = 30


Rows Property (Graph)

 Copy code hover
[image]

Rows Property (Graph)
Send feedback

Published: July 16, 2012

Returns a Range object that represents the rows in the specified Range or DataSheet object. Read-only.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example deletes row three on the datasheet.

Copy code Copy code
myChart.Application.DataSheet.Rows(3).Delete


ScaleType Property

 Copy code hover
[image]

ScaleType Property
Send feedback

Published: July 16, 2012

Returns or sets the value axis scale type. Applies only to the value axis. Read/write XlScaleType .

XlScaleType can be one of these XlScaleType constants.

xlScaleLinear

xlScaleLogarithmic

expression.ScaleType

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

A logarithmic scale uses base 10 logarithms.

Example

This example sets the value axis to use a logarithmic scale.

Copy code Copy code
myChart.Axes(xlValue).ScaleType = xlScaleLogarithmic


SchemeColor Property

 Copy code hover
[image]

SchemeColor Property
Send feedback

Published: July 16, 2012

Returns or sets the color of the specified ChartColorFormat object as an index in the current color scheme. Read/write Long.

Example

This example sets the foreground color, background color, and gradient for the chart area fill on the chart.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = True
 .ForeColor.SchemeColor = 15
 .BackColor.SchemeColor = 17
 .TwoColorGradient msoGradientHorizontal, 1
End With


SecondaryPlot Property

 Copy code hover
[image]

SecondaryPlot Property
Send feedback

Published: July 16, 2012

True if the point is in the secondary section of either a pie of pie chart or a bar of pie chart. Applies only to points on pie of pie charts or bar of pie charts. Read/write Boolean.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example moves point four to the secondary section of the chart.

Copy code Copy code
With myChart.SeriesCollection(1)
 .Points(4).SecondaryPlot = True
End With


SecondPlotSize Property

 Copy code hover
[image]

SecondPlotSize Property
Send feedback

Published: July 16, 2012

Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 through 200. Read/write Long.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. The secondary section is 50 percent of the size of the primary pie.

Copy code Copy code
With myChart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
 .SecondPlotSize = 50
End With


Separator Property

 Copy code hover
[image]

Separator Property
Send feedback

Published: July 16, 2012

Allows the user to set or return the separator used for the data labels on a chart. Read/write Variant.

expression.Separator

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example sets the data label separator, for the first series, on the first chart, to a semi-colon.

Copy code Copy code
Sub ChangeSeparator()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.Separator = ";"

End Sub


SeriesLines Property

 Copy code hover
[image]

SeriesLines Property
Send feedback

Published: July 16, 2012

Returns a SeriesLines object that represents the series lines for the specified stacked bar chart or stacked column chart. Applies only to stacked bar and stacked column charts. Read-only.

Example

This example turns on series lines for chart group one on the chart and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
End With


Shadow Property

 Copy code hover
[image]

Shadow Property
Send feedback

Published: July 16, 2012

Shadow property as it applies to the AxisTitle, ChartArea, ChartTitle, DataLabel, DataLabels, DisplayUnitLabel, Legend, LegendKey, Point, and Series objects.

True if the font is a shadow font or if the specified object has a shadow. Read/write Boolean.

expression.Shadow

expression Required. An expression that returns one of the above objects.

Shadow property as it applies to the Font object.

True if the font is a shadow font or if the specified object has a shadow. Read/write Variant.

expression.Shadow

expression Required. An expression that returns one of the above objects.

Remarks

For the Font object, this property has no effect in Microsoft Windows, but its value is retained (it can be set and returned).

Example

This example adds a shadow to the title of myChart.

Copy code Copy code
myChart.ChartTitle.Shadow = True


ShowBubbleSize Property

 Copy code hover
[image]

ShowBubbleSize Property
Send feedback

Published: July 16, 2012

Allows the user to show the bubble size for the data labels on a chart. Read/write Boolean.

expression.ShowBubbleSize

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example enables the bubble size to be shown for the data labels of the first series on the first chart.

Copy code Copy code
Sub UseBubbleSize()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowBubbleSize = True

End Sub


ShowCategoryName Property

 Copy code hover
[image]

ShowCategoryName Property
Send feedback

Published: July 16, 2012

Allows the user to show the category name for the data labels on a chart. Read/write Boolean.

expression.ShowCategoryName

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example enables the category name to be shown for the data labels of the first series on the first chart.

Copy code Copy code
Sub UseCategoryName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowCategoryName = True

End Sub


ShowChartTipNames Property

 Copy code hover
[image]

ShowChartTipNames Property
Send feedback

Published: July 16, 2012

True if charts show chart tip names. The default value is True. Read/write Boolean.

Example

This example turns off chart tip names and values.

Copy code Copy code
With myChart.Application
 .ShowChartTipNames = False
 .ShowChartTipValues = False
End With


ShowChartTipValues Property

 Copy code hover
[image]

ShowChartTipValues Property
Send feedback

Published: July 16, 2012

True if charts show chart tip values. The default value is True. Read/write Boolean.

Example

This example turns off chart tip names and values.

Copy code Copy code
With myChart.Application
 .ShowChartTipNames = False
 .ShowChartTipValues = False
End With


ShowLegendKey Property

 Copy code hover
[image]

ShowLegendKey Property
Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Example

This example sets the data labels for series one to show values and the legend key.

Copy code Copy code
With myChart.SeriesCollection(1).DataLabels
 .ShowLegendKey = True
 .Type = xlShowValue
End With


ShowNegativeBubbles Property

 Copy code hover
[image]

ShowNegativeBubbles Property
Send feedback

Published: July 16, 2012

True if negative bubbles are shown for the chart group. Valid only for bubble charts. Read/write Boolean.

Example

This example makes negative bubbles visible for chart group one.

Copy code Copy code
myChart.ChartGroups(1).ShowNegativeBubbles = True


ShowPercentage Property

 Copy code hover
[image]

ShowPercentage Property
Send feedback

Published: July 16, 2012

Allows the user to show the percentage value for the data labels on a chart. Read/write Boolean.

expression.ShowPercentage

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example enables the percentage value to be shown for the data labels of the first series on the first chart.

Copy code Copy code
Sub UsePercentage()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowPercentage = True

End Sub


ShowSeriesName Property

 Copy code hover
[image]

ShowSeriesName Property
Send feedback

Published: July 16, 2012

Allows the user to show the series name for the data labels on a chart. Read/write Boolean.

expression.ShowSeriesName

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example enables the series name to be shown for the data labels of the first series on the first chart.

Copy code Copy code
Sub UseSeriesName()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowSeriesName = True

End Sub


ShowValue Property

 Copy code hover
[image]

ShowValue Property
Send feedback

Published: July 16, 2012

Allows the user to show the value for the data labels on a chart. Read/write Boolean.

expression.ShowValue

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The chart must first be active before you can access the data labels programmatically.

Example

This example enables the value to be shown for the data labels of the first series on the first chart.

Copy code Copy code
Sub UseValue()

 ActiveSheet.ChartObjects(1).Activate
 ActiveChart.SeriesCollection(1) _
 .DataLabels.ShowValue = True

End Sub


Size Property

 Copy code hover
[image]

Size Property
Send feedback

Published: July 16, 2012

Returns or sets the size of the font. Read/write Variant.

Example

This example sets the font size for the chart title.

Copy code Copy code
myChart.ChartTitle.Font.Size = 12


SizeRepresents Property

 Copy code hover
[image]

SizeRepresents Property
Send feedback

Published: July 16, 2012

Returns or sets what the bubble size represents on a bubble chart. Read/write XlSizeRepresents .

XlSizeRepresents can be one of these XlSizeRepresents constants.

xlSizeIsArea

xlSizeIsWidth

expression.SizeRepresents

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets what the bubble size represents for the chart. (The example assumes that the chart is a bubble chart.)

Copy code Copy code
myChart.ChartGroups(1).SizeRepresents = xlSizeIsWidth


Smooth Property

 Copy code hover
[image]

Smooth Property
Send feedback

Published: July 16, 2012

True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter charts. Read/write Boolean.

expression.Smooth

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example turns on curve smoothing for series one. The example should be run on a 2-D line chart.

Copy code Copy code
myChart.SeriesCollection(1).Smooth = True


SplitType Property

 Copy code hover
[image]

SplitType Property
Send feedback

Published: July 16, 2012

Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/write XlChartSplitType .

XlChartSplitType can be one of these XlChartSplitType constants.

xlSplitByPercentValue

xlSplitByValue

xlSplitByCustomSplit

xlSplitByPosition

expression.SplitType

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

Copy code Copy code
With myChart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
End With


SplitValue Property

 Copy code hover
[image]

SplitValue Property
Send feedback

Published: July 16, 2012

Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart. Read/write Variant.

Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

Copy code Copy code
With myChart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
End With


Strikethrough Property

 Copy code hover
[image]

Strikethrough Property
Send feedback

Published: July 16, 2012

True if the font is struck through with a horizontal line. Read/write Variant.

expression.Strikethrough

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the font in the chart title to strikethrough.

Copy code Copy code
myChart.ChartTitle.Font.Strikethrough = True


Subscript Property

 Copy code hover
[image]

Subscript Property
Send feedback

Published: July 16, 2012

True if the specified font is formatted as subscript. The default value is False. Read/write Variant.


Superscript Property

 Copy code hover
[image]

Superscript Property
Send feedback

Published: July 16, 2012

True if the specified font is formatted as superscript. The default value is False. Read/write Variant.


SurfaceGroup Property

 Copy code hover
[image]

SurfaceGroup Property
Send feedback

Published: July 16, 2012

Returns a ChartGroup object that represents the surface chart group of a 3-D chart. Read-only ChartGroup object.

expression.SurfaceGroup

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the 3-D surface group to use a different color for each data marker. The example should be run on a 3-D chart.

Copy code Copy code
myChart.SurfaceGroup.VaryByCategories = True


Text Property

 Copy code hover
[image]

Text Property
Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

expression.Text

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the text for the title of the chart.

Copy code Copy code
With myChart
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With

This example sets the axis title text for the category axis.

Copy code Copy code
With myChart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "Month"
End With


TextureName Property

 Copy code hover
[image]

TextureName Property
Send feedback

Published: July 16, 2012

Returns the name of the custom texture file for the specified fill. Read-only String.

This property is read-only. Use the UserPicture or UserTextured method to set the texture file for the fill.

Example

This example changes the user-defined texture type for the chart's fill format.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillTextured Then
 If .TextureType = msoTextureUserDefined Then
 If .TextureName = "brick.bmp" Then
 .UserTextured "stone.bmp"
 End If
 End If
 End If
End With


TextureType Property

 Copy code hover
[image]

TextureType Property
Send feedback

Published: July 16, 2012

Returns the texture type for the specified fill. Read-only MsoTextureType .

MsoTextureType can be one of these MsoTextureType constants.

msoTexturePreset

msoTextureTypeMixed

msoTextureUserDefined This property is read-only. Use the UserTextured method to set the texture type for the fill.

expression.TextureType

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example changes the user-defined texture type for the chart's fill format.

Copy code Copy code
With myChart.ChartArea.Fill
 If .Type = msoFillTextured Then
 If .TextureType = msoTextureUserDefined Then
 If .TextureName = "C:\brick.bmp" Then
 .UserTextured "C:\stone.bmp"
 End If
 End If
 End If
End With


TickLabelPosition Property

 Copy code hover
[image]

TickLabelPosition Property
Send feedback

Published: July 16, 2012

Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition .

XlTickLabelPosition can be one of these XlTickLabelPosition constants.

xlTickLabelPositionHigh

xlTickLabelPositionLow

xlTickLabelPositionNextToAxis

xlTickLabelPositionNone

expression.TickLabelPosition

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets tick-mark labels on the category axis to the high position (above the chart).

Copy code Copy code
myChart.Axes(xlCategory) _
 .TickLabelPosition = xlTickLabelPositionHigh


TickLabels Property

 Copy code hover
[image]

TickLabels Property
Send feedback

Published: July 16, 2012

Returns a TickLabels collection that represents the tick-mark labels for the specified axis. Read-only.

Example

This example sets the color of the tick-mark label font for the value axis.

Copy code Copy code
myChart.Axes(xlValue).TickLabels.Font.ColorIndex = 3


TickLabelSpacing Property

 Copy code hover
[image]

TickLabelSpacing Property
Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick-mark labels. Applies only to category and series axes. Read/write Long.

Remarks

Tick-mark label spacing on the value axis is always calculated by Microsoft Graph.

Example

This example sets the number of categories between tick-mark labels on the category axis.

Copy code Copy code
myChart.Axes(xlCategory).TickLabelSpacing = 10


TickMarkSpacing Property

 Copy code hover
[image]

TickMarkSpacing Property
Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. Read/write Long.

Remarks

Use the MajorUnit and MinorUnit properties to set tick-mark spacing on the value axis.

Example

This example sets the number of categories between tick marks on the category axis.

Copy code Copy code
myChart.Axes(xlCategory).TickMarkSpacing = 10


Top Property

 Copy code hover
[image]

Top Property
Send feedback

Published: July 16, 2012

Top property as it applies to the Application object.

Returns or sets the position of the Application object. The distance from the top edge of the screen to the top edge of the main Microsoft Graph window. In Windows, if the application window is minimized, this property controls the position of the window icon (anywhere on the screen). Read/write Double.

expression.Top

expression Required. An expression that returns one of the above objects.

Top property as it applies to the AxisTitle, ChartArea, ChartTitle, DataLabel, DataSheet, DisplayUnitLabel, Legend, and PlotArea objects.

The distance from the top edge of the object to the top of row 1 (on a datasheet) or the top of the chart area (on a chart). Read/write Double.

expression.Top

expression Required. An expression that returns one of the above objects.

Top property as it applies to the Axis, LegendEntry, and LegendKey objects.

The distance from the top edge of the object to the top of row 1 (on a datasheet) or the top of the chart area (on a chart). Read-only Double.

expression.Top

expression Required. An expression that returns one of the above objects.

Top property as it applies to the Chart object.

The distance from the top edge of the object to the top of row 1 (on a datasheet) or the top of the chart area (on a chart). Read/write Variant.

expression.Top

expression Required. An expression that returns one of the above objects.

Example

This example sets the position of the top of the chart title.

Copy code Copy code
myChart.ChartTitle.Top = 10


TwoInitialCapitals Property

 Copy code hover
[image]

TwoInitialCapitals Property
Send feedback

Published: July 16, 2012

True if words that begin with two capital letters are corrected automatically. Read/write Boolean.

Example

This example sets Microsoft Graph to automatically correct words that begin with two capital letters.

Copy code Copy code
With myChart.Application.AutoCorrect
 .TwoInitialCapitals = True
 .ReplaceText = True
End With


Type Property

 Copy code hover
[image]

Type Property
Send feedback

Published: July 16, 2012

Type property as it applies to the Axis object.

Returns or sets the axis type. Read/write XlAxisType .

XlAxisType can be one of these XlAxisType constants.

xlSeriesAxis

xlCategory

xlValue

expression.Type

expression Required. An expression that returns an Axis object.

Type property as it applies to the ChartColorFormat object.

Returns the color type. Read-only Long.

expression.Type

expression Required. An expression that returns a ChartColorFormat object.

Type property as it applies to the ChartFillFormat object.

Returns the fill type. Read-only MsoFillType .

MsoFillType can be one of these MsoFillType constants.

msoFillGradient

msoFillBackground

msoFillMixed

msoFillPatterned

msoFillPicture

msoFillSolid

msoFillTextured

expression.Type

expression Required. An expression that returns a ChartFillFormat object.

Type property as it applies to the DataLabel and DataLabels objects.

Returns or sets the data label type. Read/write Variant.

expression.Type

expression Required. An expression that returns one of the above objects.

Type property as it applies to the Series object.

Returns or sets the series type. Read/write Long.

expression.Type

expression Required. An expression that returns a Series object.

Type property as it applies to the Trendline object.

Returns or sets the trendline type. Read/write XlTrendlineType .

XlTrendlineType can be one of these XlTrendlineType constants.

xlExponential

xlLinear

xlLogarithmic

xlMovingAvg

xlPolynomial

xlPower

expression.Type

expression Required. An expression that returns a Trendline object.

Example

As it applies to the Trendline object.

This example changes the trendline type for the first series in the chart. If the series has no trendline, this example fails.

Copy code Copy code
myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg


Underline Property

 Copy code hover
[image]

Underline Property
Send feedback

Published: July 16, 2012

Returns or sets the type of underline applied to the font. Required
XlUnderlineStyle
.

XlUnderlineStyle can be one of these XlUnderlineStyle constants.

xlUnderlineStyleNone

xlUnderlineStyleSinglexlUnderlineStyleDoublexlUnderlineStyleSingleAccountingxlUnderlineStyleDoubleAccounting

expression.Underline

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the font in the chart title to single underline.

Copy code Copy code
myChart.ChartTitle.Font.Underline = xlUnderlineStyleSingle


UpBars Property

 Copy code hover
[image]

UpBars Property
Send feedback

Published: July 16, 2012

Returns an UpBars object that represents the up bars on a line chart. Applies only to line charts. Read-only.

Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

Copy code Copy code
With myChart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With


Value Property (Graph)

 Copy code hover
[image]

Value Property (Graph)
Send feedback

Published: July 16, 2012

Returns the value of the specified cell. If the cell is empty, Value returns the value Empty (use the IsEmpty function to test for this case). If the Range object contains more than one cell, this property returns an array of values (use the IsArray function to test for this case). Read/write Variant.

expression.Value(RangeValueDataType)

expression Required. An expression that returns one of the objects in the Applies To list.

RangeValueDataTypeOptional Variant.

Example

This example sets the value of cell A1 on the datasheet to 3.14159.

Copy code Copy code
myChart.Application.DataSheet.Range("A1").Value = 3.14159


VaryByCategories Property

 Copy code hover
[image]

VaryByCategories Property
Send feedback

Published: July 16, 2012

True if Microsoft Graph assigns a different color or pattern to each data marker. The chart must contain only one series. Read/write Boolean.

Example

This example assigns a different color or pattern to each data marker in chart group one. The example should be run on a 2-D line chart that has data markers on a series.

Copy code Copy code
myChart.ChartGroups(1).VaryByCategories = True


Version Property

 Copy code hover
[image]

Version Property
Send feedback

Published: July 16, 2012

Returns the Microsoft Graph version number. Read-only String.

Example

This example displays a message box that contains the Microsoft Graph version number.

Copy code Copy code
MsgBox "Welcome to Microsoft Graph version " & _
 myChart.Application.Version


VerticalAlignment Property (Graph)

 Copy code hover
[image]

VerticalAlignment Property (Graph)
Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Required
XlVAlign
.

XlVAlign can be one of these XlVAlign constants.

xlVAlignBottom

xlVAlignCenterxlVAlignDistributedxlVAlignJustifyxlVAlignTop

expression.VerticalAlignment

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Some of these constants may not be available to you depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example centers the chart title vertically.

Copy code Copy code
myChart.ChartTitle.VerticalAlignment = xlCenter


Visible Property (Graph)

 Copy code hover
[image]

Visible Property (Graph)
Send feedback

Published: July 16, 2012

Visible property as it applies to the Application object.

Determines whether the object is visible. Read/write Boolean.

expression.Visible

expression Required. An expression that returns an Application object.

Visible property as it applies to the ChartFillFormat object.

Determines whether the application is visible. Read/write MsoTriState .

MsoTriState can be one of these MsoTriState constants.

msoCTrue

msoFalse

msoTriStateMixed

msoTriStateToggle

msoTrue The object is visible.

expression.Visible

expression Required. An expression that returns a ChartFillFormat object.

Example

As it applies to the ChartFillFormat object.

This example formats the chart's fill with a preset gradient and then makes the fill visible.

Copy code Copy code
With myChart.ChartArea.Fill
 .Visible = msoTrue
 .PresetGradient msoGradientDiagonalDown, _
 3, msoGradientBrass
End With


Walls Property

 Copy code hover
[image]

Walls Property
Send feedback

Published: July 16, 2012

Returns a Walls collection that represents the walls of the 3-D chart. Read-only.

Remarks

This property doesn't apply to 3-D pie charts.

Example

This example sets the color of the wall border of the chart to red. The example should be run on a 3-D chart.

Copy code Copy code
myChart.Walls.Border.ColorIndex = 3


WallsAndGridlines2D Property

 Copy code hover
[image]

WallsAndGridlines2D Property
Send feedback

Published: July 16, 2012

True if gridlines are drawn two-dimensionally on a 3-D chart. Read/write Boolean.

Example

This example causes Microsoft Graph to draw 2-D gridlines for the chart.

Copy code Copy code
myChart.WallsAndGridlines2D = True


Weight Property

 Copy code hover
[image]

Weight Property
Send feedback

Published: July 16, 2012

Returns or sets the weight of the border. Read/write
XlBorderWeight
.

XlBorderWeight can be one of these XlBorderWeight constants.

xlHairline

xlThinxlMediumxlThick

expression.Weight

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the border weight for the chart area.

Copy code Copy code
myChart.ChartArea.Border.Weight = xlMedium


Width Property (Graph)

 Copy code hover
[image]

Width Property (Graph)
Send feedback

Published: July 16, 2012

As it applies to the Application object, the Width property determines the distance from the left edge of the application window to the right edge of the application window. For all other objects, the Width property, determines the width of the object. Read/write Double for all objects, except for the Chart object, which is read/write Variant.

expression.Width

expression Required. An expression that returns one of the above objects.

If the window is minimized,

VBA Copy code Copy code
Application.Width

is read-only and returns the width of the window icon.

Example

This example sets the width of the chart.

Copy code Copy code
myChart.Width = 360


WindowState Property

 Copy code hover
[image]

WindowState Property
Send feedback

Published: July 16, 2012

Returns or sets the state of the window. Read/write XlWindowState .

XlWindowState can be one of these XlWindowState constants.

xlMaximized

xlNormal

xlMinimized

expression.WindowState

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example maximizes the Microsoft Graph application window.

Copy code Copy code
myChart.Application.WindowState = xlMaximized


Enumerations (Graph)

 Copy code hover
[image]

Enumerations (Graph)
Send feedback

Published: July 16, 2012

This topic provides a list of all enumerations in the Graph object model.

XlArabicModes

Name | Value
xlArabicBothStrict | 3
xlArabicNone | 0
xlArabicStrictAlefHamza | 1
xlArabicStrictFinalYaa | 2

XlArrowHeadLength

Name | Value
xlArrowHeadLengthLong | 3
xlArrowHeadLengthMedium | -4138
xlArrowHeadLengthShort | 1

XlArrowHeadStyle

Name | Value
xlArrowHeadStyleClosed | 3
xlArrowHeadStyleDoubleClosed | 5
xlArrowHeadStyleDoubleOpen | 4
xlArrowHeadStyleNone | -4142
xlArrowHeadStyleOpen | 2

XlArrowHeadWidth

Name | Value
xlArrowHeadWidthMedium | -4138
xlArrowHeadWidthNarrow | 1
xlArrowHeadWidthWide | 3

XlAxisCrosses

Name | Value
xlAxisCrossesAutomatic | -4105
xlAxisCrossesCustom | -4114
xlAxisCrossesMaximum | 2
xlAxisCrossesMinimum | 4

XlAxisGroup

Name | Value
xlPrimary | 1
xlSecondary | 2

XlAxisType

Name | Value
xlCategory | 1
xlSeriesAxis | 3
xlValue | 2

XlBackground

Name | Value
xlBackgroundAutomatic | -4105
xlBackgroundOpaque | 3
xlBackgroundTransparent | 2

XlBarShape

Name | Value
xlBox | 0
xlConeToMax | 5
xlConeToPoint | 4
xlCylinder | 3
xlPyramidToMax | 2
xlPyramidToPoint | 1

XlBorderWeight

Name | Value
xlHairline | 1
xlMedium | -4138
xlThick | 4
xlThin | 2

XlCalculatedMemberType

Name | Value
xlCalculatedMember | 0
xlCalculatedSet | 1

XlCategoryType

Name | Value
xlAutomaticScale | -4105
xlCategoryScale | 2
xlTimeScale | 3

XlChartGallery

Name | Value
xlAnyGallery | 23
xlBuiltIn | 21
xlUserDefined | 22

XlChartItem

Name | Value
xlAxis | 21
xlAxisTitle | 17
xlChartArea | 2
xlChartTitle | 4
xlCorners | 6
xlDataLabel | 0
xlDataTable | 7
xlDisplayUnitLabel | 30
xlDownBars | 20
xlDropLines | 26
xlErrorBars | 9
xlFloor | 23
xlHiLoLines | 25
xlLeaderLines | 29
xlLegend | 24
xlLegendEntry | 12
xlLegendKey | 13
xlMajorGridlines | 15
xlMinorGridlines | 16
xlNothing | 28
xlPivotChartDropZone | 32
xlPivotChartFieldButton | 31
xlPlotArea | 19
xlRadarAxisLabels | 27
xlSeries | 3
xlSeriesLines | 22
xlShape | 14
xlTrendline | 8
xlUpBars | 18
xlWalls | 5
xlXErrorBars | 10
xlYErrorBars | 11

XlChartPicturePlacement

Name | Value
xlAllFaces | 7
xlEnd | 2
xlEndSides | 3
xlFront | 4
xlFrontEnd | 6
xlFrontSides | 5
xlSides | 1

XlChartPictureType

Name | Value
xlStack | 2
xlStackScale | 3
xlStretch | 1

XlChartSplitType

Name | Value
xlSplitByCustomSplit | 4
xlSplitByPercentValue | 3
xlSplitByPosition | 1
xlSplitByValue | 2

XlChartType

Name | Value
xl3DArea | -4098
xl3DAreaStacked | 78
xl3DAreaStacked100 | 79
xl3DBarClustered | 60
xl3DBarStacked | 61
xl3DBarStacked100 | 62
xl3DColumn | -4100
xl3DColumnClustered | 54
xl3DColumnStacked | 55
xl3DColumnStacked100 | 56
xl3DLine | -4101
xl3DPie | -4102
xl3DPieExploded | 70
xlArea | 1
xlAreaStacked | 76
xlAreaStacked100 | 77
xlBarClustered | 57
xlBarOfPie | 71
xlBarStacked | 58
xlBarStacked100 | 59
xlBubble | 15
xlBubble3DEffect | 87
xlColumnClustered | 51
xlColumnStacked | 52
xlColumnStacked100 | 53
xlConeBarClustered | 102
xlConeBarStacked | 103
xlConeBarStacked100 | 104
xlConeCol | 105
xlConeColClustered | 99
xlConeColStacked | 100
xlConeColStacked100 | 101
xlCylinderBarClustered | 95
xlCylinderBarStacked | 96
xlCylinderBarStacked100 | 97
xlCylinderCol | 98
xlCylinderColClustered | 92
xlCylinderColStacked | 93
xlCylinderColStacked100 | 94
xlDoughnut | -4120
xlDoughnutExploded | 80
xlLine | 4
xlLineMarkers | 65
xlLineMarkersStacked | 66
xlLineMarkersStacked100 | 67
xlLineStacked | 63
xlLineStacked100 | 64
xlPie | 5
xlPieExploded | 69
xlPieOfPie | 68
xlPyramidBarClustered | 109
xlPyramidBarStacked | 110
xlPyramidBarStacked100 | 111
xlPyramidCol | 112
xlPyramidColClustered | 106
xlPyramidColStacked | 107
xlPyramidColStacked100 | 108
xlRadar | -4151
xlRadarFilled | 82
xlRadarMarkers | 81
xlStockHLC | 88
xlStockOHLC | 89
xlStockVHLC | 90
xlStockVOHLC | 91
xlSurface | 83
xlSurfaceTopView | 85
xlSurfaceTopViewWireframe | 86
xlSurfaceWireframe | 84
xlXYScatter | -4169
xlXYScatterLines | 74
xlXYScatterLinesNoMarkers | 75
xlXYScatterSmooth | 72
xlXYScatterSmoothNoMarkers | 73

XlCmdType

Name | Value
xlCmdCube | 1
xlCmdDefault | 4
xlCmdList | 5
xlCmdSql | 2
xlCmdTable | 3

XlColorIndex

Name | Value
xlColorIndexAutomatic | -4105
xlColorIndexNone | -4142

XlColumnDataType

Name | Value
xlDMYFormat | 4
xlDYMFormat | 7
xlEMDFormat | 10
xlGeneralFormat | 1
xlMDYFormat | 3
xlMYDFormat | 6
xlSkipColumn | 9
xlTextFormat | 2
xlYDMFormat | 8
xlYMDFormat | 5

XlConsolidationFunction

Name | Value
xlAverage | -4106
xlCount | -4112
xlCountNums | -4113
xlMax | -4136
xlMin | -4139
xlProduct | -4149
xlStDev | -4155
xlStDevP | -4156
xlSum | -4157
xlUnknown | 1000
xlVar | -4164
xlVarP | -4165

XlCopyPictureFormat

Name | Value
xlBitmap | 2
xlPicture | -4147

XlCreator

Name | Value
xlCreatorCode | 1480803660

XlCubeFieldType

Name | Value
xlHierarchy | 1
xlMeasure | 2
xlSet | 3

XlDataLabelPosition

Name | Value
xlLabelPositionAbove | 0
xlLabelPositionBelow | 1
xlLabelPositionBestFit | 5
xlLabelPositionCenter | -4108
xlLabelPositionCustom | 7
xlLabelPositionInsideBase | 4
xlLabelPositionInsideEnd | 3
xlLabelPositionLeft | -4131
xlLabelPositionMixed | 6
xlLabelPositionOutsideEnd | 2
xlLabelPositionRight | -4152

XlDataLabelSeparator

Name | Value
xlDataLabelSeparatorDefault | 1

XlDataLabelsType

Name | Value
xlDataLabelsShowBubbleSizes | 6
xlDataLabelsShowLabel | 4
xlDataLabelsShowLabelAndPercent | 5
xlDataLabelsShowNone | -4142
xlDataLabelsShowPercent | 3
xlDataLabelsShowValue | 2

XlDataSeriesDate

Name | Value
xlDay | 1
xlMonth | 3
xlWeekday | 2
xlYear | 4

XlDataSeriesType

Name | Value
xlAutoFill | 4
xlChronological | 3
xlDataSeriesLinear | -4132
xlGrowth | 2

XlDeleteShiftDirection

Name | Value
xlShiftToLeft | -4159
xlShiftUp | -4162

XlDirection

Name | Value
xlDown | -4121
xlToLeft | -4159
xlToRight | -4161
xlUp | -4162

XlDisplayBlanksAs

Name | Value
xlInterpolated | 3
xlNotPlotted | 1
xlZero | 2

XlDisplayDrawingObjects

Name | Value
xlDisplayShapes | -4104
xlHide | 3
xlPlaceholders | 2

XlDisplayUnit

Name | Value
xlHundredMillions | -8
xlHundreds | -2
xlHundredThousands | -5
xlMillionMillions | -10
xlMillions | -6
xlTenMillions | -7
xlTenThousands | -4
xlThousandMillions | -9
xlThousands | -3

XlEndStyleCap

Name | Value
xlCap | 1
xlNoCap | 2

XlErrorBarDirection

Name | Value
xlX | -4168
xlY | 1

XlErrorBarInclude

Name | Value
xlErrorBarIncludeBoth | 1
xlErrorBarIncludeMinusValues | 3
xlErrorBarIncludeNone | -4142
xlErrorBarIncludePlusValues | 2

XlErrorBarType

Name | Value
xlErrorBarTypeCustom | -4114
xlErrorBarTypeFixedValue | 1
xlErrorBarTypePercent | 2
xlErrorBarTypeStDev | -4155
xlErrorBarTypeStError | 4

XlFindLookIn

Name | Value
xlComments | -4144
xlFormulas | -4123
xlValues | -4163

XlHAlign

Name | Value
xlHAlignCenter | -4108
xlHAlignCenterAcrossSelection | 7
xlHAlignDistributed | -4117
xlHAlignFill | 5
xlHAlignGeneral | 1
xlHAlignJustify | -4130
xlHAlignLeft | -4131
xlHAlignRight | -4152

XlHebrewModes

Name | Value
xlHebrewFullScript | 0
xlHebrewMixedAuthorizedScript | 3
xlHebrewMixedScript | 2
xlHebrewPartialScript | 1

XlImportDataAs

Name | Value
xlPivotTableReport | 1
xlQueryTable | 0

XlInsertFormatOrigin

Name | Value
xlFormatFromLeftOrAbove | 0
xlFormatFromRightOrBelow | 1

XlInsertShiftDirection

Name | Value
xlShiftDown | -4121
xlShiftToRight | -4161

XlLegendPosition

Name | Value
xlLegendPositionBottom | -4107
xlLegendPositionCorner | 2
xlLegendPositionLeft | -4131
xlLegendPositionRight | -4152
xlLegendPositionTop | -4160

XlLineStyle

Name | Value
xlContinuous | 1
xlDash | -4115
xlDashDot | 4
xlDashDotDot | 5
xlDot | -4118
xlDouble | -4119
xlLineStyleNone | -4142
xlSlantDashDot | 13

XlLocationInTable

Name | Value
xlColumnHeader | -4110
xlColumnItem | 5
xlDataHeader | 3
xlDataItem | 7
xlPageHeader | 2
xlPageItem | 6
xlRowHeader | -4153
xlRowItem | 4
xlTableBody | 8

XlMarkerStyle

Name | Value
xlMarkerStyleAutomatic | -4105
xlMarkerStyleCircle | 8
xlMarkerStyleDash | -4115
xlMarkerStyleDiamond | 2
xlMarkerStyleDot | -4118
xlMarkerStyleNone | -4142
xlMarkerStylePicture | -4147
xlMarkerStylePlus | 9
xlMarkerStyleSquare | 1
xlMarkerStyleStar | 5
xlMarkerStyleTriangle | 3
xlMarkerStyleX | -4168

XlOrientation

Name | Value
xlDownward | -4170
xlHorizontal | -4128
xlUpward | -4171
xlVertical | -4166

XlPattern

Name | Value
xlPatternAutomatic | -4105
xlPatternChecker | 9
xlPatternCrissCross | 16
xlPatternDown | -4121
xlPatternGray16 | 17
xlPatternGray25 | -4124
xlPatternGray50 | -4125
xlPatternGray75 | -4126
xlPatternGray8 | 18
xlPatternGrid | 15
xlPatternHorizontal | -4128
xlPatternLightDown | 13
xlPatternLightHorizontal | 11
xlPatternLightUp | 14
xlPatternLightVertical | 12
xlPatternNone | -4142
xlPatternSemiGray75 | 10
xlPatternSolid | 1
xlPatternUp | -4162
xlPatternVertical | -4166

XlPictureConvertorType

Name | Value
xlBMP | 1
xlCGM | 7
xlDRW | 4
xlDXF | 5
xlEPS | 8
xlHGL | 6
xlPCT | 13
xlPCX | 10
xlPIC | 11
xlPLT | 12
xlTIF | 9
xlWMF | 2
xlWPG | 3

XlPivotFieldDataType

Name | Value
xlDate | 2
xlNumber | -4145
xlText | -4158

XlPivotFormatType

Name | Value
xlPTClassic | 20
xlPTNone | 21
xlReport1 | 0
xlReport10 | 9
xlReport2 | 1
xlReport3 | 2
xlReport4 | 3
xlReport5 | 4
xlReport6 | 5
xlReport7 | 6
xlReport8 | 7
xlReport9 | 8
xlTable1 | 10
xlTable10 | 19
xlTable2 | 11
xlTable3 | 12
xlTable4 | 13
xlTable5 | 14
xlTable6 | 15
xlTable7 | 16
xlTable8 | 17
xlTable9 | 18

XlPivotTableSourceType

Name | Value
xlConsolidation | 3
xlDatabase | 1
xlExternal | 2
xlPivotTable | -4148
xlScenario | 4

XlQueryType

Name | Value
xlADORecordset | 7
xlDAORecordset | 2
xlODBCQuery | 1
xlOLEDBQuery | 5
xlTextImport | 6
xlWebQuery | 4

XlRangeValueDataType

Name | Value
xlRangeValueDefault | 10
xlRangeValueMSPersistXML | 12
xlRangeValueXMLSpreadsheet | 11

XlReferenceStyle

Name | Value
xlA1 | 1
xlR1C1 | -4150

XlRowCol

Name | Value
xlColumns | 2
xlRows | 1

XlScaleType

Name | Value
xlScaleLinear | -4132
xlScaleLogarithmic | -4133

XlSheetType

Name | Value
xlChart | -4109
xlDialogSheet | -4116
xlExcel4IntlMacroSheet | 4
xlExcel4MacroSheet | 3
xlWorksheet | -4167

XlSizeRepresents

Name | Value
xlSizeIsArea | 1
xlSizeIsWidth | 2

XlSubtototalLocationType

Name | Value
xlAtBottom | 2
xlAtTop | 1

XlTickLabelOrientation

Name | Value
xlTickLabelOrientationAutomatic | -4105
xlTickLabelOrientationDownward | -4170
xlTickLabelOrientationHorizontal | -4128
xlTickLabelOrientationUpward | -4171
xlTickLabelOrientationVertical | -4166

XlTickLabelPosition

Name | Value
xlTickLabelPositionHigh | -4127
xlTickLabelPositionLow | -4134
xlTickLabelPositionNextToAxis | 4
xlTickLabelPositionNone | -4142

XlTickMark

Name | Value
xlTickMarkCross | 4
xlTickMarkInside | 2
xlTickMarkNone | -4142
xlTickMarkOutside | 3

XlTimeUnit

Name | Value
xlDays | 0
xlMonths | 1
xlYears | 2

XlTrendlineType

Name | Value
xlExponential | 5
xlLinear | -4132
xlLogarithmic | -4133
xlMovingAvg | 6
xlPolynomial | 3
xlPower | 4

XlUnderlineStyle

Name | Value
xlUnderlineStyleDouble | -4119
xlUnderlineStyleDoubleAccounting | 5
xlUnderlineStyleNone | -4142
xlUnderlineStyleSingle | 2
xlUnderlineStyleSingleAccounting | 4

XlVAlign

Name | Value
xlVAlignBottom | -4107
xlVAlignCenter | -4108
xlVAlignDistributed | -4117
xlVAlignJustify | -4130
xlVAlignTop | -4160

XlWebFormatting

Name | Value
xlWebFormattingAll | 1
xlWebFormattingNone | 3
xlWebFormattingRTF | 2

XlWebSelectionType

Name | Value
xlAllTables | 2
xlEntirePage | 1
xlSpecifiedTables | 3

XlWindowState

Name | Value
xlMaximized | -4137
xlMinimized | -4140
xlNormal | -4143

XlWindowType

Name | Value
xlChartAsWindow | 5
xlChartInPlace | 4
xlClipboard | 3
xlInfo | -4129
xlWorkbook | 1


Office 2013 documentation copyright notice

 Copy code hover
[image]

Office 2013 documentation copyright notice
Send feedback

Published: July 16, 2012

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2013 Microsoft Corporation. All rights reserved.

Microsoft, Access, ActiveX, ClearType, Excel, FrontPage, InfoPath, IntelliSense, JScript, MSDN, MS-DOS, MSN, OneNote, Outlook, PowerPoint, SharePoint, Silverlight, SmartArt, SQL Server, Visio, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.